Magento – Index Management Problem

ce-1.7.0.2reindex

I am running magento 1.7.0.2 and I have 2 sites that both have this error message, there was a problem with this index processing.

I am not sure what effect it has on the site but I would like it fixed to be sure. When I refresh the entire group in index management the Product flat data function is the only one that will not reindex. I have tried flushing all the cache choices but I do not know what to do to fix this, can anybody please help? I am not a computer programmer so I need help in simple terms if that is possible.

Thank you for your help, however, I did what you suggested and deleted the files in the var/locks/ folder.

However, it did not help with the error message. I get this one now Can not initialize the indexer process

This is just for the "Product Flat Data" line. What else can I try to fix this?
Also, is this problem causing any trouble with my website, does it matter?

Thanks again.

Steven

Fatal error: Uncaught exception 'PDOException' with message
'SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or
update a child row: a foreign key constraint fails
(db524651933.,
CONSTRAINT FK_CAT_PRD_FLAT_1_ENTT_ID_CAT_PRD_ENTT_ENTT_ID FOREIGN
KEY (entity_id) REFERENCES catalog_product_entity )' in
/homepages/16/d479755148/htdocs/ssjewels.com/lib/Zend/Db/Statement/Pdo.php:228

Stack trace: #0
/homepages/16/d479755148/htdocs/ssjewels.com/lib/Zend/Db/Statement/Pdo.php(228):

PDOStatement->execute(Array) #1
/homepages/16/d479755148/htdocs/ssjewels.com/lib/Varien/Db/Statement/Pdo/Mysql.php(110):

Zend_Db_Statement_Pdo->_execute(Array) #2
/homepages/16/d479755148/htdocs/ssjewels.com/app/code/core/Zend/Db/Statement.php(291):

Varien_Db_Statement_Pdo_Mysql->_execute(Array) #3
/homepages/16/d479755148/htdocs/ssjewels.com/lib/Zend/Db/Adapter/Abstract.php(479):

Zend_Db_Statement->execute(Array) #4
/homepages/16/d479755148/htdocs/ssjewels.com/lib/Zend/Db/Adap in
/homepages/16/d479755148/htdocs/ssjewels.com/lib/Zend/Db/Statement/Pdo.php
on line 228

Here is the result of the runindex.php file I created. I do know what it means, and I am sorry I do not know how to create a Cron job.

Thank you for your help.

Best Answer

your problem is the "a foreign key constraint fails" message. It means your database is damaged and you have references to entries, which dont exist anymore.

This can happen by misconfigured databases or usage of phpmyadmin for database export.

Caution, to solve this problem some knowledge is needed. Because if you make an error, you can damage your database very strong.

  1. Make a complete Backup of the database
  2. use a database tool of your choice
  3. do a truncate on the catalog_product_flat_1 table
  4. Try the reindex again