Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Triggers created by MView are triggered all the time #23077

Closed
sebastien-kathmandu opened this issue May 31, 2019 · 2 comments
Closed

Triggers created by MView are triggered all the time #23077

sebastien-kathmandu opened this issue May 31, 2019 · 2 comments
Assignees
Labels
Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed

Comments

@sebastien-kathmandu
Copy link

sebastien-kathmandu commented May 31, 2019

Preconditions (*)

  1. Magento version: 2.2.8
  2. mysql 5.7

Steps to reproduce (*)

  1. Set an index on schedule ( ex: catalog_product_flat)
  2. update an attribute in the database with the same value as before
    I use this query to set the same value as 10 rows has previously to test the trigger on Update.
INSERT INTO `catalog_product_entity_int` (`value_id`, `attribute_id`, `store_id`, `row_id`, `value`)
SELECT `value_id`, `attribute_id`, `store_id`, `row_id`, `value`
FROM catalog_product_entity_int as value_from LIMIT 10
ON DUPLICATE KEY UPDATE `value` = value_from.`value`;

UPDATE catalog_product_entity_int value_to
,(SELECT * FROM catalog_product_entity_int LIMIT 10) value_from
SET value_to.value = value_from.value
WHERE value_to.attribute_id = value_from.attribute_id
    AND value_to.row_id = value_from.row_id
    AND value_to.store_id = value_from.store_id

Expected result (*)

  1. The trigger related to the attribute shouldn't insert a line in the ChangeLog _cl table as the value didn't change.
    here the update trigger on catalog_product_entity_int
BEGIN
SET @entity_id = (SELECT `entity_id` FROM `catalog_product_entity` WHERE `row_id` = NEW.`row_id`);
IF (NEW.`value_id` <=> OLD.`value_id` OR NEW.`attribute_id` <=> OLD.`attribute_id` OR NEW.`store_id` <=> OLD.`store_id` OR NEW.`row_id` <=> OLD.`row_id` OR NEW.`value` <=> OLD.`value`) THEN INSERT IGNORE INTO `catalogsearch_fulltext_cl` (`entity_id`) values(@entity_id); END IF;
IF (NEW.`value_id` <=> OLD.`value_id` OR NEW.`attribute_id` <=> OLD.`attribute_id` OR NEW.`store_id` <=> OLD.`store_id` OR NEW.`row_id` <=> OLD.`row_id` OR NEW.`value` <=> OLD.`value`) THEN INSERT IGNORE INTO `catalog_product_flat_cl` (`entity_id`) values(@entity_id); END IF;
IF (NEW.`value_id` <=> OLD.`value_id` OR NEW.`attribute_id` <=> OLD.`attribute_id` OR NEW.`store_id` <=> OLD.`store_id` OR NEW.`row_id` <=> OLD.`row_id` OR NEW.`value` <=> OLD.`value`) THEN INSERT IGNORE INTO `catalog_product_category_cl` (`entity_id`) values(@entity_id); END IF;
IF (NEW.`value_id` <=> OLD.`value_id` OR NEW.`attribute_id` <=> OLD.`attribute_id` OR NEW.`store_id` <=> OLD.`store_id` OR NEW.`row_id` <=> OLD.`row_id` OR NEW.`value` <=> OLD.`value`) THEN INSERT IGNORE INTO `catalog_product_attribute_cl` (`entity_id`) values(@entity_id); END IF;
IF (NEW.`value_id` <=> OLD.`value_id` OR NEW.`attribute_id` <=> OLD.`attribute_id` OR NEW.`store_id` <=> OLD.`store_id` OR NEW.`row_id` <=> OLD.`row_id` OR NEW.`value` <=> OLD.`value`) THEN INSERT IGNORE INTO `bazaarvoice_product_cl` (`entity_id`) values(@entity_id); END IF;
IF (NEW.`value_id` <=> OLD.`value_id` OR NEW.`attribute_id` <=> OLD.`attribute_id` OR NEW.`store_id` <=> OLD.`store_id` OR NEW.`row_id` <=> OLD.`row_id` OR NEW.`value` <=> OLD.`value`) THEN INSERT IGNORE INTO `catalog_product_price_cl` (`entity_id`) values(@entity_id); END IF;
END

Actual result (*)

  1. The trigger related to the attribute insert a line in the ChangeLog _cl table
    for example catalog_product_flat_cl :
version_id entity_id
1 1
2 3
3 4
4 5
5 7
6 8
7 11
8 18
9 20
10 22
11 1
12 3
13 4
14 5
15 7
16 8
17 11
18 18
19 20
20 22
@m2-assistant
Copy link

m2-assistant bot commented May 31, 2019

Hi @sebastien-kathmandu. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@sebastien-kathmandu do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@hostep
Copy link
Contributor

hostep commented Sep 10, 2019

I think we can close this since eec9c26 was merged in 2.3-develop.
If I'm mistaken, let me know!

(I'm not sure if we should also close #15939 though?)

@hostep hostep closed this as completed Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed
Projects
None yet
Development

No branches or pull requests

3 participants