We are noticing the following insert issue:
Mysql2::Error: Deadlock found when trying to get lock; try restarting transaction: INSERT INTO read_marks (reader_id, readable_type, timestamp, reader_type) VALUES (502537, 'Activity', '2019-12-12 16:44:18', 'User')
It appears when a user is being setup as a reader, they are being initialized in the table without a readable_id. Due to the unique index on the read marks table, the MYSQL database falls back to a full table scan, rather than a full index scan which would be slower.
The table scan escalates a full table lock, and then blocks other insertions causing a deadlock.
We are noticing the following insert issue:
Mysql2::Error: Deadlock found when trying to get lock; try restarting transaction: INSERT INTO
read_marks(reader_id,readable_type,timestamp,reader_type) VALUES (502537, 'Activity', '2019-12-12 16:44:18', 'User')It appears when a user is being setup as a reader, they are being initialized in the table without a readable_id. Due to the unique index on the read marks table, the MYSQL database falls back to a full table scan, rather than a full index scan which would be slower.
The table scan escalates a full table lock, and then blocks other insertions causing a deadlock.