Also seeing this error with CatalogSearch in 1.3.1. This is intermittent, but appears to be related to changing products, whether updating attributes, stock information or deleting products.
Digging into things a bit more, the error is arises from the search handling. Running
SHOW INNODB STATUS
from mysql gives you a bunch of info, including information on the last deadlock detected. The output is baroque, but the query that is causing the problems is this:
UPDATE `catalogsearch_query` SET `is_processed` = ‘0’
On our site this query had been running for 51 seconds before the deadlock was detected. Marking every query as not processed seems extreme. The other query involved in the deadlock doesn’t seem too much more intelligent:
REPLACE INTO `catalogsearch_result` (SELECT ‘107854’, `product_id`, MATCH (`data_index`) AGAINST (’tnpa 3758’ IN BOOLEAN MODE) FROM `catalogsearch_fulltext` WHERE ((`data_index` LIKE ‘&#xtn;pa%’ AND `data_index` LIKE ‘758%’)) AND `store_id`=’1’)
More debugging to do but I suspect changing even one product causes all search queries to be invalidated. Adding products individually doesn’t seem to pose a problem, but imports are horrible: the catalop_product_import_after event observers completely rebuild every catalog index for every product, not just those touched during the import. Bad, Magento, bad!
More debugging ahead…