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

Database table triggers creation using mview multiple subscriptions with different entity columns for one table #31192

Closed
5 tasks
aleksejsbaranovs10 opened this issue Dec 7, 2020 · 3 comments

Comments

@aleksejsbaranovs10
Copy link

Issue description

Two indexers with mview configuration, subscribed to the same table but using different "entity_column" values override each other when creating triggers (enabling indexers to work on schedule mode).

For reproduction was used Magento core indexer "Catalog Search" and custom indexer.
Both indexers subscribed to "catalog_product_super_link" table. "Catalog Search" indexer uses "entity_column" value "product_id". Custom indexer uses "entity_column" value "parent_id".

"catalogsearch_fulltext" mview subscription to "catalog_product_super_link" table changes:

<table name="catalog_product_super_link" entity_column="product_id" />

Custom indexer mview subscription to "catalog_product_super_link" table changes:

<table name="catalog_product_super_link" entity_column="parent_id" />

Preconditions (*)

  1. Issue is reproducible both on CE & EE versions. "2.4-develop" branch
  2. MySQL 8

Steps to reproduce (*)

  1. Create test indexer. Example:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Indexer/etc/indexer.xsd">
    <indexer id="test_view_id"
             view_id="test_view_id"
             class="Magento\TestModule\Model\Indexer\TestIndexer"
    >
        <title translate="true">Test indexer title</title>
    </indexer>
</config>
  1. Create mview configuration for test indexer with subscription on "catalog_product_super_link" and entity column "parent_id". Example:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Mview/etc/mview.xsd">
    <view id="test_view_id"
          class="Magento\TestModule\Model\Indexer\TestIndexer"
          group="indexer"
    >
        <subscriptions>
            <table name="catalog_product_super_link" entity_column="parent_id" />
        </subscriptions>
    </view>
</config>
  1. Enable test indexer to work on schedule mode.
  2. Enable "Catalog Search" indexer to work on schedule.
  3. Validate "catalog_product_super_link" table triggers.

Actual result (*)

  1. On reproduction step 3, after enabling the test indexer to work on schedule mode the following trigger is configured for "catalog_product_super_link" table (e.g insert trigger):
BEGIN
INSERT IGNORE INTO `test_view_id_cl` (`entity_id`) VALUES (NEW.`parent_id`);
END
  1. On reproduction step 4, after enabling the "catalog search" to work on schedule mode the following trigger is configured for "catalog_product_super_link" table (e.g insert trigger):
BEGIN
INSERT IGNORE INTO `catalogsearch_fulltext_cl` (`entity_id`) VALUES (NEW.`product_id`);
INSERT IGNORE INTO `test_view_id_cl` (`entity_id`) VALUES (NEW.`product_id`);
END
  1. Enabling "catalog search" indexer to work on schedule mode rewrote previously created trigger. For "test_view_id_cl" "parent_id" was changed to "product_id".

Expected result (*)

  1. On reproduction step 4, enabling the "catalog search" to work on schedule mode should not rewrite previously created trigger and change "entity_column" for that:
BEGIN
INSERT IGNORE INTO `catalogsearch_fulltext_cl` (`entity_id`) VALUES (NEW.`product_id`);
INSERT IGNORE INTO `test_view_id_cl` (`entity_id`) VALUES (NEW.`parent_id`);
END

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
@m2-assistant
Copy link

m2-assistant bot commented Dec 7, 2020

Hi @aleksejsbaranovs10. 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.4-develop instance - upcoming 2.4.x release

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

Please, add a comment to assign the issue: @magento I am working on this


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@m2-assistant
Copy link

m2-assistant bot commented Dec 15, 2020

Hi @engcom-Bravo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Bravo
Copy link
Contributor

Hello @aleksejsbaranovs10

Thank you for your report

This issue is already fixed by PR #21857 and soon should be delivered into 2.4-develop branch.

We are closing this issue. If you have any questions, please feel free to comment, reopen, or create a new ticket.

Thank you

( Duplicate of #21853 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants