mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-07 03:22:21 +03:00
03d4843628
no issue - we have seen random test failures recently - the cause: deadlocks - @NOTE: Deadlocks can and will happen naturally in innodb when multiple transactions are running and they operate on the same table. The challenge is just how to minimize, handle or avoid them. --- Why did the deadlock occur? The tests insert posts in parallel. As soon you insert two posts, we will attach the relations. The relations are basically: tags & authors. Both tables use foreign keys: post_id -> posts.id author_id -> users.id tag_id -> tags.id Attaching relations runs through two stages: - inserting or deleting the row (Bookshelf-Relations) - updating the row because of sort order (Ghost) 2 or more transactions can create a deadlock on the target relation table because of X and S locks for the foreign key, which get automatically set. Refs: https://bugs.mysql.com/bug.php?id=48652 https://www.chriscalender.com/advanced-innodb-deadlock-troubleshooting-what-show-innodb-status-doesnt-tell-you-and-what-diagnostics-you-should-be-looking-at/ Long-Term? - investigate further - retry deadlocks if we know it's fine? - drop foreign key and handle in Bookshelf? |
||
---|---|---|
.. | ||
fixtures | ||
mocks | ||
api.js | ||
assertions.js | ||
configUtils.js | ||
index.js |