4
votes

When i am reindexing Catalog Search Index from backend and at the same time if my front end users are searching something with search in mysite then i getting errors such as

Error: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction

please can anyone tell me how to overcome this issue.

3
Yes , I checked all those posts . But this is more related to magento . Just a logic through which I can stop this conflict . I cannot disable search and reindexing in magento .Just need a better solution .yantrakaar

3 Answers

4
votes

This is a Magento bug, which has been around since Magento 1.7.

When reindexing the catalogsearch_fulltext index, a transaction is started which does the following, for each store in succession:

  1. Rebuild the catalogsearch_fulltext table
  2. Reset search results: update the catalogsearch_query table (set is_processed to 0) and clear the catalogsearch_result table

From the moment when the catalogsearch_query query is executed, all searches in the frontend should wait until the complete indexing process has finished (they also cause writes to the catalogsearch_query and catalogsearch_result tables). For a large catalog with multiple store views, this can take quite a while, resulting in a "lock wait timeout exceeded" error.

I have reported this to Magento via the Bug tracker: http://www.magentocommerce.com/bug-tracking/issue/index/id/933

I think it shouldn't be necessary to store search results in the database; instead, they should be stored in the registry, such that they can be referenced multiple times during a single request. Then it isn't necessary anymore to reset search results during reindexing. Also, the need for a transaction disappears.

I did not implement this solution, as we mostly use ElasticSearch nowadays.

0
votes

Yes.. this is happen because 1 row of InnonDB DB tables are updated at the same time..

0
votes

Try to Reindex your Catalog Search Index using shell (SSH).

Try to navigate shell folder from Magento root directory. then execute the below command.

// To check the indexer status.
php -f indexer.php status 

// To reindex the indexer data.
php -f indexer.php reindex

// To check the any help in this indexer process.
php -f indexer.php help

Try this using SSH, it will help you to reindex all the data.