database-deadlocks

Magento deadlocks

心不动则不痛 提交于 2019-11-27 12:31:36
问题 I am using Magento 1.7.0.2 Community Edition and I have encountered a big problem - deadlocks and "Lock wait timeout exceeded" errors. Problem exists while specific CRON tasks are executed Importing/updating products(sizes, colors, manufacturers as well). There are around 5000 products but in 90% script gets "Lock wait timeout exceeded" errors or a deadlock error. Script is developed using Magento guidelines and it works fine if no other processes are running. For example if reindex is

Implementing retry logic for deadlock exceptions

拥有回忆 提交于 2019-11-27 01:29:13
问题 I've implemented a generic repository and was wondering if there is a smart way to implement a retry logic in case of a deadlock exception? The approach should be the same for all repository methods. So is there anyway I can avoid writing 'try/catch - call method again with retry-count', in every single method? Any suggetsion are welcome. A bit of my Repository code: public class GenericRepository : IRepository { private ObjectContext _context; public List<TEntity> ExecuteStoreQuery<TEntity>

How is Hibernate deciding order of update/insert/delete

廉价感情. 提交于 2019-11-26 19:50:06
问题 Let's first forget about Hibernate. Assume that I have two tables, A & B. Two transactions are updating same records in these two tables, but txn 1 update B and then A, while txn 2 update A then B. This is a typical deadlock example. The most common way to avoid this is by pre-defining the order of acquiring resources. For example, we should update table A then B. Go back to Hibernate. When we are updating lots of entities in one session, once I am flushing the session, changes of different

Working around MySQL error “Deadlock found when trying to get lock; try restarting transaction”

三世轮回 提交于 2019-11-26 17:32:09
I have a MySQL table with about 5,000,000 rows that are being constantly updated in small ways by parallel Perl processes connecting via DBI. The table has about 10 columns and several indexes. One fairly common operation gives rise to the following error sometimes: DBD::mysql::st execute failed: Deadlock found when trying to get lock; try restarting transaction at Db.pm line 276. The SQL statement that triggers the error is something like this: UPDATE file_table SET a_lock = 'process-1234' WHERE param1 = 'X' AND param2 = 'Y' AND param3 = 'Z' LIMIT 47 The error is triggered only sometimes. I'd