June 20, 2013

Post: Is Synchronous Replication right for your app?

… users_groups, but also updates groups with some metadata: BEGIN; INSERT INTO users_groups (user_id, group_id) VALUES (100, 1…. retry deadlocks Now we start to get into (*gasp*) territory where your application needs to be modified.  Generally if you use Innodb, you should be able to handle deadlock errors in your application.  Raise your hands…

Post: SHOW INNODB STATUS walk through

… ROLL BACK TRANSACTION (2) For last deadlock Innodb shows transactions which caused deadlocks, their state during deadlock, what locks they were holding and what… if there are any records is insert buffer. Next it shows how many inserts were done in insert buffer, how many recs were…

Post: Percona XtraDB Cluster: Multi-node writing and Unexpected deadlocks

…, `j` varchar(32) DEFAULT NULL, PRIMARY KEY (`i`) node2 mysql> insert into autoinc (j) values (‘node2′ ); Query OK, 1 row affected… sec) Whoops!  We got a deadlock error on commit, that doesn’t happen in normal Innodb. Galera is allowing the first transaction… application DB library to handle sudden deadlocks– If you end up with one of these deadlock errors, simply retry the transaction.  Any…

Post: Edge-case behavior of INSERT...ODKU

…(id), UNIQUE KEY(username) ) ENGINE=InnoDB; Now consider the following sequence of events. (root@localhost) [test]> INSERT INTO update_test (username, host… update the same row is not going to end well; deadlocks, rollbacks, contention, and all sorts of related unpleasantness. There is…

Post: Test Drive of Solid

… as we can see Solid does not have instant deadlock detection as Innodb and have to rely on timeouts instead. This may… proceed modifying them without causing deadlocks. For comparion here are InnoDB sessions: Test 1: Deadlock detection (deadlock is correctly detected): insert into test2 values (1…

Post: SELECT LOCK IN SHARE MODE and FOR UPDATE

… taken on Innodb level before MySQL performs like matching, and row is not unlocked if it does not match. Smarter deadlock victum scheduling At this point transaction which made least updates is killed to resolve deadlock. Which means if…. The best example would be INSERT INTO MyISAMTable SELECT * FROM INNODBTable; – A lot of shared locks on Innodb table but no updates…

Comment: INSERT ON DUPLICATE KEY UPDATE and REPLACE INTO

… using a trigger on an innodb table that “dumps” any updates to the table to… something simmilar) while checking for key value existence, as inserts in myisam are concurrent with reads, and then …when performing the update. This would lead to a deadlock when trying to upgrade two read locks to write…

Post: Differences between READ-COMMITTED and REPEATABLE-READ transaction isolation levels

…is modifying. It must do this to prevent deadlocks and maintain the isolation level. If you …row versioning and UNDO information. In REPEATABLE READ InnoDB also creates gap locks for range scans. select …example SELECT .. FOR UPDATE above will not prevent insertions of new rows into the table by other…

Comment: Percona XtraDB Cluster reference architecture with HaProxy

… –iterations=50 –concurrency=5 –engine=innodb –auto-generate-sqlBuilding Create Statements…Cannot run query INSERT INTO t1 VALUES (100669,’qnMdipW5KkXdTjGCh2PNzLoeR0527frpQDQ8uw67Ydk1K06uuNHtkxYBxT5w8plb2BbpzhwYBgPNYX9RmICWGkZD6fAESvhMzH3yqzMtXoH4BQNylbK1CmEIPGYlC6′) ERROR : Deadlock found when …

Comment: READ-COMMITED vs REPETABLE-READ in tpcc-like load

… then inserting new records with same secondary key values. By switching to read-committed we were able to avoid deadlocks because InnoDB would lock a gap after the delete in repeatable-read. In RC InnoDB almost never uses a gap locking which is a common reason for deadlocks in RR.