mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-31 19:06:14 +01:00 
			
		
		
		
	 5d49a2add7
			
		
	
	
	5d49a2add7
	
	
	
		
			
			- The deadlock counter was moved from Deadlock::find_cycle into Deadlock::report, because the find_cycle method is called multiple times during deadlock detection flow, which means it shouldn't have such side effects. But report() can, which called only once for a victim transaction. - Also the deadlock_detect.test and *.result test case has been extended to handle the fix.
		
			
				
	
	
		
			32 lines
		
	
	
	
		
			826 B
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
	
		
			826 B
		
	
	
	
		
			Text
		
	
	
	
	
	
| connection default;
 | |
| CREATE TABLE t1(
 | |
| id	INT,
 | |
| PRIMARY KEY(id)
 | |
| ) ENGINE=InnoDB;
 | |
| CREATE TABLE dl(
 | |
| id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, 
 | |
| cnt INT UNSIGNED
 | |
| ) ENGINE=InnoDB;
 | |
| INSERT INTO t1 VALUES(1), (2), (3);
 | |
| INSERT INTO dl(cnt) SELECT variable_value FROM information_schema.global_status WHERE variable_name LIKE 'Innodb_deadlocks';
 | |
| BEGIN;
 | |
| SELECT * FROM t1 WHERE id = 1 LOCK IN SHARE MODE;
 | |
| connect  con1,localhost,root,,;
 | |
| BEGIN;
 | |
| SELECT * FROM t1 WHERE id = 2 LOCK IN SHARE MODE;
 | |
| connect  con2,localhost,root,,;
 | |
| BEGIN;
 | |
| SELECT * FROM t1 WHERE id = 2 LOCK IN SHARE MODE;
 | |
| SELECT * FROM t1 WHERE id = 1 FOR UPDATE;
 | |
| connection default;
 | |
| SELECT * FROM t1 WHERE id = 2 FOR UPDATE;
 | |
| connection con2;
 | |
| disconnect con1;
 | |
| ROLLBACK;
 | |
| disconnect con2;
 | |
| connection default;
 | |
| 'Deadlock counter is valid';
 | |
| 1
 | |
| ROLLBACK;
 | |
| DROP TABLE t1;
 | |
| DROP TABLE dl;
 |