Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAGETWO-84414 indexer DefaultStock #14139

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,16 @@ protected function _updateIndex($entityIds)
'stock_status' => (int)$row['status'],
];
if ($i % 1000 == 0) {
$this->deleteOldRecords(array_column($data, 'product_id'));
$this->_updateIndexTable($data);
$data = [];
}
}

$this->deleteOldRecords($entityIds);
$this->_updateIndexTable($data);

if (is_array($data) && !empty($data)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are considering fix for the following issue #12205, it's already fixed withing a scope of 2.2-develop. It should be enough to remove all records at the very beginning of the index update operation without performing a separate delete in a loop.

Please, check the latest commit here https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php for the clarification.

Thank you

$this->deleteOldRecords(array_column($data, 'product_id'));
$this->_updateIndexTable($data);
}
return $this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function updateAttributesDataProvider()
return [
[
'status' => 2,
'expected_count' => 0
'expected_count' => 1
],
[
'status' => 1,
Expand Down