Skip to content

Commit 5007f22

Browse files
author
Serhii Balko
committed
MC-41614: When dimensions-mode is set to "wesbite" and let price indexer to execute parallel process, Lockwait timeout errors occur when bundle prices are indexed
1 parent be82efb commit 5007f22

File tree

1 file changed

+45
-3
lines changed
  • app/code/Magento/Bundle/Model/ResourceModel/Indexer

1 file changed

+45
-3
lines changed

app/code/Magento/Bundle/Model/ResourceModel/Indexer/Price.php

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,21 @@ class Price implements DimensionalIndexerInterface
9191
*/
9292
private $moduleManager;
9393

94+
/**
95+
* @var string
96+
*/
97+
private $tmpBundlePriceTable;
98+
99+
/**
100+
* @var string
101+
*/
102+
private $tmpBundleSelectionTable;
103+
104+
/**
105+
* @var string
106+
*/
107+
private $tmpBundleOptionTable;
108+
94109
/**
95110
* @param IndexTableStructureFactory $indexTableStructureFactory
96111
* @param TableMaintainer $tableMaintainer
@@ -184,7 +199,16 @@ public function executeByDimensions(array $dimensions, \Traversable $entityIds)
184199
*/
185200
private function getBundlePriceTable()
186201
{
187-
return $this->getTable('catalog_product_index_price_bundle_tmp');
202+
if ($this->tmpBundlePriceTable === null) {
203+
$this->tmpBundlePriceTable = 'catalog_product_index_price_bundle_temp';
204+
$this->getConnection()->createTemporaryTableLike(
205+
$this->tmpBundlePriceTable,
206+
$this->getTable('catalog_product_index_price_bundle_tmp'),
207+
true
208+
);
209+
}
210+
211+
return $this->tmpBundlePriceTable;
188212
}
189213

190214
/**
@@ -194,7 +218,16 @@ private function getBundlePriceTable()
194218
*/
195219
private function getBundleSelectionTable()
196220
{
197-
return $this->getTable('catalog_product_index_price_bundle_sel_tmp');
221+
if ($this->tmpBundleSelectionTable === null) {
222+
$this->tmpBundleSelectionTable = 'catalog_product_index_price_bundle_sel_temp';
223+
$this->getConnection()->createTemporaryTableLike(
224+
$this->tmpBundleSelectionTable,
225+
$this->getTable('catalog_product_index_price_bundle_sel_tmp'),
226+
true
227+
);
228+
}
229+
230+
return $this->tmpBundleSelectionTable;
198231
}
199232

200233
/**
@@ -204,7 +237,16 @@ private function getBundleSelectionTable()
204237
*/
205238
private function getBundleOptionTable()
206239
{
207-
return $this->getTable('catalog_product_index_price_bundle_opt_tmp');
240+
if ($this->tmpBundleOptionTable === null) {
241+
$this->tmpBundleOptionTable = 'catalog_product_index_price_bundle_opt_temp';
242+
$this->getConnection()->createTemporaryTableLike(
243+
$this->tmpBundleOptionTable,
244+
$this->getTable('catalog_product_index_price_bundle_opt_tmp'),
245+
true
246+
);
247+
}
248+
249+
return $this->tmpBundleOptionTable;
208250
}
209251

210252
/**

0 commit comments

Comments
 (0)