Skip to content

Commit

Permalink
Merge pull request #188 from bob2021/disable-keys
Browse files Browse the repository at this point in the history
Disable `DISABLE KEYS` statements
  • Loading branch information
colinmollenhour authored Mar 22, 2017
2 parents 204cb68 + 24e9ad4 commit f63b9a0
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 0 additions & 2 deletions app/code/core/Mage/Index/Model/Indexer/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ public function disableKeys()

$resourceModel = $this->getResource();
if ($resourceModel instanceof Mage_Index_Model_Resource_Abstract) {
$resourceModel->useDisableKeys(true);
$resourceModel->disableTableKeys();
}

Expand All @@ -211,7 +210,6 @@ public function enableKeys()

$resourceModel = $this->getResource();
if ($resourceModel instanceof Mage_Index_Model_Resource_Abstract) {
$resourceModel->useDisableKeys(true);
$resourceModel->enableTableKeys();
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Index/Model/Resource/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f63b9a0

Please sign in to comment.