1
votes

My catalog URL Rewrites in Magento are stuck on processing. When I run the shell/indexer.php script I get the following error

Catalog URL Rewrites index process unknown error: exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'sugar-tablets.html-1' for key 2' in /home/healthra/public_html/lib/Zend/Db/Statement/Pdo.php:228 Stack trace: #0 /home/healthra/public_html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->
execute(Array) #1 /home/healthra/public_html/lib/Zend/Db/Statement.php(300): Zend_Db_Statement_
Pdo->_execute(Array) #2 /home/healthra/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Sta
tement->execute(Array) #3 /home/healthra/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db
_Adapter_Abstract->query('UPDATE mg_core...', Array) \#4 /home/healthra/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(337): Zend_Db_
Adapter_Pdo_Abstract->query('UPDATE
mg_core...', Array) #5 /home/healthra/public_html/lib/Zend/Db/Adapter/Abstract.php(632): Varien_Db_A
dapter_Pdo_Mysql->query('UPDATE `mg_core...', Array) #6 /home/healthra/public_html/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysq l4/Url.php(257): Zend_Db_Adapter_Abstract->update('mg_core_url_rew...', Array, '
url_rewrite_id=...') #7 /home/healthra/public_html/app/code/core/Mage/Catalog/Model/Url.php(363): Mag
e_Catalog_Model_Resource_Eav_Mysql4_Url->saveRewrite(Array, Object(Varien_Object
)) #8 /home/healthra/public_html/app/code/core/Mage/Catalog/Model/Url.php(559): Mag
e_Catalog_Model_Url->_refreshProductRewrite(Object(Varien_Object), Object(Varien
_Object)) #9 /home/healthra/public_html/app/code/core/Mage/Catalog/Model/Url.php(253): Mag
e_Catalog_Model_Url->refreshProductRewrites('1') #10 /home/healthra/public_html/app/code/core/Mage/Catalog/Model/Url.php(246): Ma
ge_Catalog_Model_Url->refreshRewrites('1') #11 /home/healthra/public_html/app/code/core/Mage/Catalog/Model/Indexer/Url.php( 249): Mage_Catalog_Model_Url->refreshRewrites() #12 /home/healthra/public_html/app/code/core/Mage/Index/Model/Process.php(139): Mage_Catalog_Model_Indexer_Url->reindexAll() #13 /home/healthra/public_html/app/code/core/Mage/Index/Model/Process.php(167): Mage_Index_Model_Process->reindexAll() #14 /home/healthra/public_html/shell/indexer.php(158): Mage_Index_Model_Process-
reindexEverything() #15 /home/healthra/public_html/shell/indexer.php(198): Mage_Shell_Compiler->run(
) #16 {main}

Does anyone have any suggestions on how to debug this problem?

1
Is this on a multiple store installation? Despite the fact that Magento doesn't allow it, do you have two product entries sharing the URLkey "sugar-tablets"? Magento usually assigns the dupe entry a -1 on save (-2 for the next iteration) as URLkeys for product must be unique.Fiasco Labs
hi yes its a multiple store installation. How would I remove or check the url key?user398894

1 Answers

4
votes

Have a look here: Magento Puts -1 in My URLs Can I Remove Programatically? and also here: http://www.magentocommerce.com/boards/viewthread/9342/.

I found that removing all lock files in /path/to/mage/var/locks/index_process*.lock, truncating core_url_rewrite and then reindexing cleared the issue.