Composite products disappear on category pages during reindex for huge catalogs
- Dominant language
- PHP
- Stars
- 357
- Forks
- 262
- PR merge metrics
- No merged PRs in 30d
Description
According to current architecture, there is a possible situation that composite products will disappear for some time during inventory reindex.
Thinks become worse since 2.4.0, because stock status for products is taken from index table.
### Preconditions
1. Magento 2.3.5
2. Huge catalog (or set sleep in plugins to \Magento\InventoryIndexer\Indexer\SourceItem\Strategy\Sync)
### Steps to reproduce
1. Open category - see products (configurable and bundle).
2. Run reindex and wait until simple product will be reindexed and indexer will be busy with configurable/bundle reindex (or just wait with sleep)
3. Flush cache.
4. Open same category.
### Expected result (*)
1. Nothing changed. Products still appears on the category.
### Actual result (*)
1. No products are shown. Products will appear only after reindex finish.
The root cause of the problem is because switch happened before composite products are being reindexed.
https://github.com/magento/inventory/blob/265905238a467813363003f8ec29f7cbae5e1c33/InventoryIndexer/Indexer/Stock/Strategy/Sync.php#L148
Contributor guide
Research direction
Start with InventoryIndexer/Indexer/Stock/Strategy/Sync.php around line 148 and reproduce the category-page behavior during a large-catalog reindex, using the listed sleep-based setup if needed. Trace when the switch occurs relative to configurable and bundle reindexing; done means composite products remain visible while reindexing is still in progress.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100