MySQL – Managing Indexing and Lock Files

MySQLreindex

This is more of a research question – we have a site which is having some real problems with reindexing (30,000 products). It's now at the point where we're experiencing a lot of timeouts and SQLSTATE errors – Lock wait timeout exceeded – so being able to save changes in the admin panel is sporadic at best.

We are trying to ascertain if the indexes which say they are still running are actually doing so. We reindexed via the command line php indexer.php --reindexall. Hours later, in "Index Management" the Search Index still says Processing. All the other indexes are either finished or pending but not running. The main problem seems to be with the search indexes.

The number of rows in the catalogsearch_fulltext DB table are not changing – is this an indication that the Search Index is not actually still running?

In the var/locks folder, we have the following files:

index_process_1.lock
index_process_2.lock
index_process_3.lock
index_process_4.lock
index_process_5.lock
index_process_6.lock
index_process_7.lock
index_process_9.lock

What does the existence of these files actually mean? What effect would deleting them have?

For what it's worth we are using the Mirasvit Advanced Search Pro module which uses Sphinx. https://mirasvit.com/magento-extensions/magento-sphinx-search.html

Best Answer

I'm not sure how the Sphinx module works but you may want to go into every attribute you have set up and make sure you are not setting any unnecessary attributes to be included in quick search, and/or visible to the frontend, etc.

*.lock files in their simplistic of form is just a way to keep track of existing running processes so any other attempts to run it while one is in process is prevented. If you know no process is running it's safe to wipe these files when reindexing, any fatal exception could leave them lingering but its normal to see the lock files.

If you are using a 3rd party module then I would suspect the cause why the table never grows in size. You may want to reach out to the owners of the module for more insight as it seems the majority of your problems stem from it.