-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Large stores with extremely active product databases can suffer many related problems with indexers not being kept up to date. Products can disappear from the website, product data can be out of date on the website, excessive cache flushing can cause huge server load spikes.
This is due to the manner in which triggers are created by the core magento code in
switch ($event) { |
INSERT INTO will insert a new record regardless of whether one exists or not.
REPLACE INTO will as the name says, replace a record - and in this case it will generate a new version_id since that is an auto_increment field.
Preconditions (*)
- An extremely large database. Example 500,000 products
- An active update schedule
Steps to reproduce (*)
- Create a sample database with 500,000 products
- Enable Asynchronous indexing
- Reduce crons to every 10 minutes
- Run a mass script to change the inventory for the products every 30 seconds. So within 10 minutes, you will have made 10 million updates
Expected result (*)
- When the indexer runs, it will index the latest product information once for each index
Actual result (*)
It will actually try to index each product 20 times, once for each update
Additional information to reproduce the issue
- Change the price of the product with SKU
24-MB01
20 times via APIrest/all/V1/products/24-MB01
- Doing the price change data inserted in the table
catalog_product_price_cl
- Adjust the
DEFAULT_BATCH_SIZE
in filelib/internal/Magento/Framework/Mview/View.php
with 10 from 1000. - Enable the DB logs via the
bin/magento dev:query-log:enable
command. - grep the text to get the SQL query on table
catalog_product_price_cl
. Please find attached the screenshot of db.log:
The query always returns entity_id 1
each time.
In this case, it seems that entity_id 1 will process many times, instead of only 1 time, and should be on the latest one.
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.
Metadata
Metadata
Labels
Type
Projects
Status