-
Notifications
You must be signed in to change notification settings - Fork 254
Description
Several improvements need to be done for current indexation mechanism. As currently, we have a performance issue which leads to the whole re-indexation when any changes in SourceItem Qty happened (which is wrong).
1) Currently inventory_source_item
table is used in mview configuration.
https://github.com/magento-engcom/magento2/blob/develop/app/code/Magento/Inventory/etc/mview.xml#L11
And system observes for source_id
column.
But expected behavior should be an observation of source_item_id
column. So our algorithm for \Magento\Inventory\Indexer\StockItem\StockItem::executeList
should be like
- Obtain list of
source_item_id
- Filter this list. We need to remove items which are related to disabled sources, and items with
out_of_stock
status - Get index data only for these SKU that are related to
source_item_id
list after filtering - Update index data via
multiple insert on update
Now our behavior (get stocks, after that get sources) looks is familiar to full reindex
2) Also we need to track changes in the inventory_source_stock_link
table. In this case, we will work with source_id
list. So maybe we need to create separate index processor which will be work with source_id
.