Skip to content

Random empty categories when using the multi process reindexing #30846

Closed
@alepane21

Description

@alepane21

Preconditions (*)

  1. Magento 2.3.3
  2. MAGE_INDEXER_THREADS_COUNT set to 3
  3. pcntl installed

Steps to reproduce (*)

  1. prepare an installation with lot of stores and website
  2. prepare some categories with lot of products
  3. wait for the reindex to complete all the work and have a clean situation
  4. write down the size of all the tables generated by the catalog_category_product index (you can use the query SELECT table_schema, table_name, round(((data_length + index_length) / 1024 / 1024), 2) FROM information_schema.TABLES WHERE table_name LIKE 'catalog_category_product_index_store%' ORDER BY table_name DESC;)
  5. than make invalid the catalog_category_product index
  6. now we have to simulate a LOCK on the catalog_category_product, I could reproduce the issues with the following commands:
    • SET GLOBAL lock_wait_timeout = 1;
    • SET GLOBAL innodb_lock_wait_timeout = 1;
    • launch a "LOCK TABLES catalog_category_product WRITE" in the db to force the situation where a user (or a process) is doing lot of DELETE from that table
  7. wait for the reindexing process to complete (Don't be fooled! The main process will die, but the children process will go on for some time)
  8. recheck the table size with the query made before: you will see

NOTE: The step 6 is obviously not what is happening in production, but is a way to always reproduce the issue. In production the bug will be way more hideous, emptying only some tables some times when someone is saving categories in magento backend while the re-index is running, for example.

Expected result (*)

  1. the cron should be in error and in the cron_schedule table you should se the error message
  2. the commerce should still use the index made before this failed reindex

Actual result (*)

  1. in the cron_schedule you see the error message
  2. in the indexer_state is set as invalid
  3. the reindex is STILL RUNNING and at completion the main process will switch all the replica tables to the main one, putting in use tables that have not been correctly generated

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”.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions