Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <enterprise_refresh_index>
- <schedule>
- <cron_expr>always</cron_expr>
- </schedule>
- <run>
- <model>enterprise_index/observer::refreshIndex</model>
- </run>
- </enterprise_refresh_index>
- public function refreshIndex(Mage_Cron_Model_Schedule $schedule)
- {
- /** @var $helper Enterprise_Index_Helper_Data */
- $helper = Mage::helper('enterprise_index');
- /** @var $lock Enterprise_Index_Model_Lock */
- $lock = Enterprise_Index_Model_Lock::getInstance();
- if ($lock->setLock(self::REINDEX_FULL_LOCK)) {
- /**
- * Workaround for fatals and memory crashes: Invalidating indexers that are in progress
- * Successful lock setting is considered that no other full reindex processes are running
- */
- $this->_invalidateInProgressIndexers();
- $client = Mage::getModel('enterprise_mview/client');
- try {
- //full re-index
- $inactiveIndexes = $this->_getInactiveIndexersByPriority();
- $rebuiltIndexes = array();
- foreach ($inactiveIndexes as $inactiveIndexer) {
- $tableName = (string)$inactiveIndexer->index_table;
- $actionName = (string)$inactiveIndexer->action_model->all;
- $client->init($tableName);
- if ($actionName) {
- $client->execute($actionName);
- $rebuiltIndexes[] = $tableName;
- }
- }
- //re-index by changelog
- $indexers = $helper->getIndexers(true);
- foreach ($indexers as $indexerName => $indexerData) {
- $indexTable = (string)$indexerData->index_table;
- $actionName = (string)$indexerData->action_model->changelog;
- $client->init($indexTable);
- if (isset($actionName) && !in_array($indexTable, $rebuiltIndexes)) {
- $client->execute($actionName);
- }
- }
- } catch (Exception $e) {
- $lock->releaseLock(self::REINDEX_FULL_LOCK);
- throw $e;
- }
- $lock->releaseLock(self::REINDEX_FULL_LOCK);
- }
- return $this;
- }
- Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '186899-0-2' for key 'PRIMARY', query was: INSERT INTO `catalog_product_index_price_tmp` SELECT `catalog_product_index_price_final_tmp`.`entity_id`, `catalog_product_index_price_final_tmp`.`customer_group_id`, `catalog_product_index_price_final_tmp`.`_id`, `catalog_product_index_price_final_tmp`.`tax_class_id`, `catalog_product_index_price_final_tmp`.`orig_price` AS `price`, `catalog_product_index_price_final_tmp`.`price` AS `final_price`, `catalog_product_index_price_final_tmp`.`min_price`, `catalog_product_index_price_final_tmp`.`max_price`, `catalog_product_index_price_final_tmp`.`tier_price`, `catalog_product_index_price_final_tmp`.`group_price` FROM `catalog_product_index_price_final_tmp`' in /home/website/public_html/lib/Zend/Db/Statement/Pdo.php:235
- Stack trace:
- #0 /home/website/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
- #1 /home/website/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
- #2 /home/website/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
- #3 /home/website/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `rg...', Array)
- #4 /home/website/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `rg...', Array)
- #5 /home/website/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Default.php(564): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `rg...')
- #6 /home/website/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Default.php(142): Mage_Catalog_Model_Resource_Product_Indexer_Price_Default->_movePriceDataToIndexTable()
- #7 /home/website/public_html/app/code/core/Enterprise/Catalog/Model/Index/Action/Product/Price/Refresh/Changelog.php(121): Mage_Catalog_Model_Resource_Product_Indexer_Price_Default->reindexEntity(Array)
- #8 /home/website/public_html/app/code/core/Enterprise/Catalog/Model/Index/Action/Product/Price/Refresh/Changelog.php(50): Enterprise_Catalog_Model_Index_Action_Product_Price_Refresh_Changelog->_reindex(Array)
- #9 /home/website/public_html/app/code/core/Enterprise/Mview/Model/Client.php(123): Enterprise_Catalog_Model_Index_Action_Product_Price_Refresh_Changelog->execute()
- #10 /home/website/public_html/app/code/core/Enterprise/Index/Model/Observer.php(129): Enterprise_Mview_Model_Client->execute('enterprise_cata...')
- #11 [internal function]: Enterprise_Index_Model_Observer->refreshIndex(Object(Aoe_Scheduler_Model_Schedule))
- #12 /home/website/public_html/app/code/community/Aoe/Scheduler/Model/Schedule.php(196): call_user_func_array(Array, Array)
- #13 /home/website/public_html/app/code/community/Aoe/Scheduler/Model/Schedule.php(582): Aoe_Scheduler_Model_Schedule->runNow(false)
- #14 /home/website/public_html/app/code/community/Aoe/Scheduler/Model/Observer.php(79): Aoe_Scheduler_Model_Schedule->process()
- #15 /home/website/public_html/app/code/core/Mage/Core/Model/App.php(1358): Aoe_Scheduler_Model_Observer->dispatchAlways(Object(Varien_Event_Observer))
- #16 /home/website/public_html/app/code/core/Mage/Core/Model/App.php(1337): Mage_Core_Model_App->_callObserverMethod(Object(Aoe_Scheduler_Model_Observer), 'dispatchAlways', Object(Varien_Event_Observer))
- #17 /home/website/public_html/app/Mage.php(458): Mage_Core_Model_App->dispatchEvent('always', Array)
- #18 /home/website/public_html/cron.php(78): Mage::dispatchEvent('always')
- #19 {main}
Add Comment
Please, Sign In to add comment