rpush: Database deadlock
Hi , I encounter a problem about rpush, and try to fix it. But I can’t find the root cause of
- Rpush version: 2.4.0
- rpush run in two host.
*** (1) TRANSACTION:
mysql tables in use 1, locked 1
LOCK WAIT 22 lock struct(s), heap size 3112, 240 row lock(s)
query id 2154897537 rpushhost1 Creating sort index
SELECT `rpush_notifications`.* FROM `rpush_notifications` WHERE (processing = 0 AND delivered = 0 AND failed = 0 AND (deliver_after IS NULL OR deliver_after < '2015-09-08 06:23:19')) ORDER BY created_at ASC LIMIT 100 FOR UPDATE
*** (2) TRANSACTION:
mysql tables in use 1, locked 1
3 lock struct(s), heap size 1248, 2 row lock(s), undo log entries 1
query id 2154897539 rpushhost2 updating
UPDATE `rpush_notifications` SET processing = 0, delivered = 1, delivered_at = '2015-09-08 06:23:19' WHERE `rpush_notifications`.`id` IN (47324, 47325, 47326)
*** WE ROLL BACK TRANSACTION (2)
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 17 (4 by maintainers)
Commits related to this issue
- rpush_notifications active_record performance improvements 1. Change the index on rpush_notifications to minimized number of locked records and pre-sort the records 2. Minimize the locking duration b... — committed to loadhigh/rpush by loadhigh 6 years ago
- rpush_notifications active_record performance improvements 1. Change the index on rpush_notifications to minimized number of locked records and pre-sort the records 2. Minimize the locking duration b... — committed to rpush/rpush by loadhigh 6 years ago
- Merge tag 'v3.1.1' into dev_support_toast_and_image_template_v_3_3_1 v3.1.1 Fixed - Database deadlock [#200](https://github.com/rpush/rpush/issues/200) (by [@loadhigh](https://github.com/loadhigh) ... — committed to cardinalblue/rpush by masolin 5 years ago
- rpush_notifications active_record performance improvements 1. Change the index on rpush_notifications to minimized number of locked records and pre-sort the records 2. Minimize the locking duration b... — committed to ormus2002/rpush by loadhigh 6 years ago
- rpush_notifications active_record performance improvements 1. Change the index on rpush_notifications to minimized number of locked records and pre-sort the records 2. Minimize the locking duration b... — committed to ormus2002/rpush by loadhigh 6 years ago
@shawzt looks like it works better, we have less records in ‘processing’ state but anyway we still have it for some reason…