File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
app/code/Magento/Catalog/Model/Indexer/Product/Price/Action Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -415,11 +415,17 @@ private function moveDataFromReplicaTableToReplicaTables(array $dimensions)
415
415
if (!$ dimensions ) {
416
416
return ;
417
417
}
418
- //TODO: need to update logic for run this move only when replica table is not empty
419
418
$ select = $ this ->dimensionTableMaintainer ->getConnection ()->select ()->from (
420
- $ this ->dimensionTableMaintainer ->getMainReplicaTable ([])
419
+ $ mainReplicaTable = $ this ->dimensionTableMaintainer ->getMainReplicaTable ([])
421
420
);
422
421
422
+ $ check = clone $ select ;
423
+ $ check ->reset ('columns ' )->columns ('count(*) ' );
424
+
425
+ if (! $ count = $ this ->dimensionTableMaintainer ->getConnection ()->query ($ check )->fetchColumn ()) {
426
+ return ;
427
+ }
428
+
423
429
$ replicaTablesByDimension = $ this ->dimensionTableMaintainer ->getMainReplicaTable ($ dimensions );
424
430
425
431
foreach ($ dimensions as $ dimension ) {
@@ -439,6 +445,8 @@ private function moveDataFromReplicaTableToReplicaTables(array $dimensions)
439
445
\Magento \Framework \DB \Adapter \AdapterInterface::INSERT_ON_DUPLICATE
440
446
)
441
447
);
448
+
449
+ $ this ->_defaultIndexerResource ->getConnection ()->truncateTable ($ mainReplicaTable );
442
450
}
443
451
444
452
/**
You can’t perform that action at this time.
0 commit comments