When I run my custom import script, and during it's execution starts
reindex, it causes the error :
SQLSTATE: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction, query was:
INSERT INTO catalog_product_entity_datetime... and other
How can I avoid these errors?
I thinking about a few ways:
- Lock indexer
- Lock tables (bad idea)
- Temporary disable cron (even more bad idea)
- Extend and override core indexer and manually write the code that will check some lock files.
I can't find any information about indexer locking in Magento 2.
And another question: It can be a problem with the deadlock not at all in reindex and import?