From 7e4c317991ed8a640f9cbc6c22e6534df007656f Mon Sep 17 00:00:00 2001 From: Rob Wigginton Date: Mon, 27 Feb 2017 12:25:15 +0000 Subject: [PATCH] [impr-#188] Unnecessary table metadata locks when reindexing disable 'ALTER TABLE ... DISABLE KEYS' statements by default, and remove useless calls to useDisableKeys() --- .../Catalog/Model/Resource/Product/Indexer/Eav/Abstract.php | 2 -- .../core/Mage/Catalog/Model/Resource/Product/Indexer/Price.php | 2 -- .../Catalog/Model/Resource/Product/Indexer/Price/Default.php | 2 -- app/code/core/Mage/Index/Model/Indexer/Abstract.php | 2 -- app/code/core/Mage/Index/Model/Resource/Abstract.php | 2 +- 5 files changed, 1 insertion(+), 9 deletions(-) diff --git a/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Abstract.php b/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Abstract.php index 302a1a943440..a4189a95ab11 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Abstract.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Abstract.php @@ -99,9 +99,7 @@ public function reindexEntities($processIds) $adapter->delete($this->getMainTable(), $where); // insert new index - $this->useDisableKeys(false); $this->insertFromTable($this->getIdxTable(), $this->getMainTable()); - $this->useDisableKeys(true); $adapter->commit(); } catch (Exception $e) { diff --git a/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price.php b/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price.php index bc788c8b1519..72fbc3dbed76 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price.php @@ -131,9 +131,7 @@ protected function _copyIndexDataToMainTable($processIds) $write->delete($this->getIdxTable(), $where); // insert new index - $this->useDisableKeys(false); $this->insertFromTable($this->getIdxTable(), $this->getMainTable()); - $this->useDisableKeys(true); $this->commit(); } catch (Exception $e) { diff --git a/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Default.php b/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Default.php index 40dd17e35f42..0ec2b0d96e31 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Default.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Default.php @@ -136,11 +136,9 @@ public function reindexAll() */ public function reindexEntity($entityIds) { - $this->useDisableKeys(false); $this->_prepareFinalPriceData($entityIds); $this->_applyCustomOption(); $this->_movePriceDataToIndexTable(); - $this->useDisableKeys(true); return $this; } diff --git a/app/code/core/Mage/Index/Model/Indexer/Abstract.php b/app/code/core/Mage/Index/Model/Indexer/Abstract.php index 8a3f6d7e1d8c..0ae73a6831fd 100644 --- a/app/code/core/Mage/Index/Model/Indexer/Abstract.php +++ b/app/code/core/Mage/Index/Model/Indexer/Abstract.php @@ -191,7 +191,6 @@ public function disableKeys() $resourceModel = $this->getResource(); if ($resourceModel instanceof Mage_Index_Model_Resource_Abstract) { - $resourceModel->useDisableKeys(true); $resourceModel->disableTableKeys(); } @@ -211,7 +210,6 @@ public function enableKeys() $resourceModel = $this->getResource(); if ($resourceModel instanceof Mage_Index_Model_Resource_Abstract) { - $resourceModel->useDisableKeys(true); $resourceModel->enableTableKeys(); } diff --git a/app/code/core/Mage/Index/Model/Resource/Abstract.php b/app/code/core/Mage/Index/Model/Resource/Abstract.php index 4986ec1ab14f..ce4532a088a6 100644 --- a/app/code/core/Mage/Index/Model/Resource/Abstract.php +++ b/app/code/core/Mage/Index/Model/Resource/Abstract.php @@ -48,7 +48,7 @@ abstract class Mage_Index_Model_Resource_Abstract extends Mage_Core_Model_Resour * * @var bool */ - protected $_isDisableKeys = true; + protected $_isDisableKeys = false; /** * Whether table changes are allowed