Description
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 (*)
- Issue is reproducible both on CE & EE versions. "2.4-develop" branch
- MySQL 8
Steps to reproduce (*)
- 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>
- 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>
- Enable test indexer to work on schedule mode.
- Enable "Catalog Search" indexer to work on schedule.
- Validate "catalog_product_super_link" table triggers.
Actual result (*)
- 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
- 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
- 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 (*)
- 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”.