Guest User

Untitled

a guest
Jan 23rd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.66 KB | None | 0 0
  1. <enterprise_refresh_index>
  2. <schedule>
  3. <cron_expr>always</cron_expr>
  4. </schedule>
  5. <run>
  6. <model>enterprise_index/observer::refreshIndex</model>
  7. </run>
  8. </enterprise_refresh_index>
  9.  
  10. public function refreshIndex(Mage_Cron_Model_Schedule $schedule)
  11. {
  12. /** @var $helper Enterprise_Index_Helper_Data */
  13. $helper = Mage::helper('enterprise_index');
  14.  
  15. /** @var $lock Enterprise_Index_Model_Lock */
  16. $lock = Enterprise_Index_Model_Lock::getInstance();
  17.  
  18. if ($lock->setLock(self::REINDEX_FULL_LOCK)) {
  19.  
  20. /**
  21. * Workaround for fatals and memory crashes: Invalidating indexers that are in progress
  22. * Successful lock setting is considered that no other full reindex processes are running
  23. */
  24. $this->_invalidateInProgressIndexers();
  25.  
  26. $client = Mage::getModel('enterprise_mview/client');
  27. try {
  28.  
  29. //full re-index
  30. $inactiveIndexes = $this->_getInactiveIndexersByPriority();
  31. $rebuiltIndexes = array();
  32. foreach ($inactiveIndexes as $inactiveIndexer) {
  33. $tableName = (string)$inactiveIndexer->index_table;
  34. $actionName = (string)$inactiveIndexer->action_model->all;
  35. $client->init($tableName);
  36. if ($actionName) {
  37. $client->execute($actionName);
  38. $rebuiltIndexes[] = $tableName;
  39. }
  40. }
  41.  
  42. //re-index by changelog
  43. $indexers = $helper->getIndexers(true);
  44. foreach ($indexers as $indexerName => $indexerData) {
  45. $indexTable = (string)$indexerData->index_table;
  46. $actionName = (string)$indexerData->action_model->changelog;
  47. $client->init($indexTable);
  48. if (isset($actionName) && !in_array($indexTable, $rebuiltIndexes)) {
  49. $client->execute($actionName);
  50. }
  51. }
  52.  
  53. } catch (Exception $e) {
  54. $lock->releaseLock(self::REINDEX_FULL_LOCK);
  55. throw $e;
  56. }
  57.  
  58. $lock->releaseLock(self::REINDEX_FULL_LOCK);
  59. }
  60.  
  61. return $this;
  62. }
  63.  
  64. 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
  65. Stack trace:
  66. #0 /home/website/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
  67. #1 /home/website/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
  68. #2 /home/website/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
  69. #3 /home/website/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `rg...', Array)
  70. #4 /home/website/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `rg...', Array)
  71. #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...')
  72. #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()
  73. #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)
  74. #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)
  75. #9 /home/website/public_html/app/code/core/Enterprise/Mview/Model/Client.php(123): Enterprise_Catalog_Model_Index_Action_Product_Price_Refresh_Changelog->execute()
  76. #10 /home/website/public_html/app/code/core/Enterprise/Index/Model/Observer.php(129): Enterprise_Mview_Model_Client->execute('enterprise_cata...')
  77. #11 [internal function]: Enterprise_Index_Model_Observer->refreshIndex(Object(Aoe_Scheduler_Model_Schedule))
  78. #12 /home/website/public_html/app/code/community/Aoe/Scheduler/Model/Schedule.php(196): call_user_func_array(Array, Array)
  79. #13 /home/website/public_html/app/code/community/Aoe/Scheduler/Model/Schedule.php(582): Aoe_Scheduler_Model_Schedule->runNow(false)
  80. #14 /home/website/public_html/app/code/community/Aoe/Scheduler/Model/Observer.php(79): Aoe_Scheduler_Model_Schedule->process()
  81. #15 /home/website/public_html/app/code/core/Mage/Core/Model/App.php(1358): Aoe_Scheduler_Model_Observer->dispatchAlways(Object(Varien_Event_Observer))
  82. #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))
  83. #17 /home/website/public_html/app/Mage.php(458): Mage_Core_Model_App->dispatchEvent('always', Array)
  84. #18 /home/website/public_html/cron.php(78): Mage::dispatchEvent('always')
  85. #19 {main}
Add Comment
Please, Sign In to add comment