]> git.sesse.net Git - pr0n/commit - sql/pr0n.sql
When inserting multiple images at the same time, we could deadlock -- inserting
authorSteinar H. Gunderson <sesse@debian.org>
Sun, 30 Jul 2006 13:52:33 +0000 (15:52 +0200)
committerSteinar H. Gunderson <sesse@debian.org>
Sun, 30 Jul 2006 13:52:33 +0000 (15:52 +0200)
commitd1b49fa6c2fd1b3d449dc938f0731c0426636c02
tree9d6d6957c2dfc2be16fbb8cc87bb81f548aafc80
parentbc5325d47cbf017a7c4cebe9695edbd484fd18b2
When inserting multiple images at the same time, we could deadlock -- inserting
new rows into images would (due to the foreign key constraint) lock the corresponding
row in event using a shared lock, then the update (due to last_picture) would
upgrade the lock to exclusive, causing a deadlock later. To fix this, we move
last_picture into its own table; we could also lock it explicitly earlier, but
that would stall other transactions (and they can run for 10-15 seconds or so,
or perhaps even longer) so it is not desirable.
perl/Sesse/pr0n/Common.pm
perl/Sesse/pr0n/Listing.pm
sql/pr0n.sql