You are viewing an old revision of this post, from August 4, 2015 @ 16:51:19. See below for differences between this version and the current revision.

How to fix magento reindexing with PDOException error?

I got an error when I reindex data. I have been working for about 3 days with this problem still can't find the solution. here is the log error I have received:

Default Values (MANAdev) index process unknown error: exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (glasseso_magento.m_filter2_value, CONSTRAINT FK_m_filter2_value_mana_db?edit_session FOREIGN KEY (edit_session_id) REFERENCES m_edit_session (id) ON DELETE CASCADE ON UPDATE CASCAD)' in /Applications/MAMP/htdocs/magestore/lib/Zend/Db/Statement/Pdo.php:228 Stack trace:

0 /Applications/MAMP/htdocs/magestore/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)

1 /Applications/MAMP/htdocs/magestore/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)

2 /Applications/MAMP/htdocs/magestore/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)

3 /Applications/MAMP/htdocs/magestore/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)

4 /Applications/MAMP/htdocs/magestore/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `m_...', Array)

5 /Applications/MAMP/htdocs/magestore/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `m_...', Array)

6 /Applications/MAMP/htdocs/magestore/lib/Zend/Db/Adapter/Abstract.php(574): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `m_...', Array)

7 /Applications/MAMP/htdocs/magestore/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(453): Zend_Db_Adapter_Abstract->insert('m_filter2_value', Array)

8 /Applications/MAMP/htdocs/magestore/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mana_Filters_Model_Filter2_Value))

9 /Applications/MAMP/htdocs/magestore/app/code/local/Mana/Db/Helper/Data.php(217): Mage_Core_Model_Abstract->save()

10 /Applications/MAMP/htdocs/magestore/app/code/local/Mana/Db/Model/Indexer.php(36): Mana_Db_Helper_Data->replicate()

11 /Applications/MAMP/htdocs/magestore/app/code/core/Mage/Index/Model/Process.php(209): Mana_Db_Model_Indexer->reindexAll()

12 /Applications/MAMP/htdocs/magestore/app/code/core/Mage/Index/Model/Process.php(255): Mage_Index_Model_Process->reindexAll()

13 /Applications/MAMP/htdocs/magestore/shell/indexer.php(158): Mage_Index_Model_Process->reindexEverything()

14 /Applications/MAMP/htdocs/magestore/shell/indexer.php(198): Mage_Shell_Compiler->run()

15 {main}

Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (glasseso_magento.m_filter2_value, CONSTRAINT FK_m_filter2_value_mana_db?edit_sessionFOREIGN KEY (edit_session_id) REFERENCES m_edit_session (id) ON DELETE CASCADE ON UPDATE CASCAD)' in /Applications/MAMP/htdocs/magestore/lib/Zend/Db/Statement/Pdo.php:234 Stack trace:

0 /Applications/MAMP/htdocs/magestore/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)

1 /Applications/MAMP/htdocs/magestore/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)

2 /Applications/MAMP/htdocs/magestore/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)

3 /Applications/MAMP/htdocs/magestore/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `m_...', Array)

4 /Applications/MAMP/htdocs/magestore/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `m_...', Array)

5 /Applications/MAMP/htdocs/magestore/lib/Zend/Db/Adapter/Abstract.php(574): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `m_...', Array)

6 /Applications/MAMP/htdocs/magestore/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(453): Zend_Db_Adapter_Abstract->insert('m_filter2_value', Array)

7 /Applications/MAMP/htdocs/magestore/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mana_Filters_Model_Filter2_Value))

8 /Applications/MAMP/htdocs/magestore/app/code/local/Mana/Db/Helper/Data.php(217): Mage_Core_Model_Abstract->save()

9 /Applications/MAMP/htdocs/magestore/app/code/local/Mana/Db/Model/Indexer.php(36): Mana_Db_Helper_Data->replicate()

10 /Applications/MAMP/htdocs/magestore/app/code/core/Mage/Index/Model/Process.php(209): Mana_Db_Model_Indexer->reindexAll()

11 /Applications/MAMP/htdocs/magestore/app/code/core/Mage/Index/Model/Process.php(255): Mage_Index_Model_Process->reindexAll()

12 /Applications/MAMP/htdocs/magestore/shell/indexer.php(158): Mage_Index_Model_Process->reindexEverything()

13 /Applications/MAMP/htdocs/magestore/shell/indexer.php(198): Mage_Shell_Compiler->run()

14 {main}

 

--------------------------------------------------------------

 

Here is the solution:

I took at a look of the contents of m_edit_session, and there was just one line with an ID of 1, and a timestamp under created_at.

I changed the ID of that one and only row to 0 (instead of 1) and this error went away.

 

Revisions

Revision Differences

There are no differences between the August 4, 2015 @ 16:51:19 revision and the current revision. (Maybe only post meta information was changed.)

No comments yet.

Leave a Reply