mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-29 01:46:31 +01:00 
			
		
		
		
	 8981ee238a
			
		
	
	
	8981ee238a
	
	
	
		
			
			Sometimes, in MariaDB Server 10.5 but apparently not in later branches, the test would hang because con1 and con2 would be blocked in debug_sync (for example, lock_wait_suspend_thread_enter and row_ins_sec_index_entry_dup_locks_created) and therefore blocking the purge of transactions from completing. To prevent an occasional DEBUG_SYNC induced hang in the test, we will wait for everything to be purged, except the last 2 transactions. This change should be null-merged to 10.6, because the test is not failing in 10.6 or later major versions.
		
			
				
	
	
		
			110 lines
		
	
	
	
		
			2.4 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			110 lines
		
	
	
	
		
			2.4 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| --echo #
 | |
| --echo # Bug #21025880	DUPLICATE UK VALUES IN READ-COMMITTED(AGAIN)
 | |
| --echo #
 | |
| 
 | |
| --source include/have_innodb.inc
 | |
| --source include/have_debug.inc
 | |
| --source include/have_debug_sync.inc
 | |
| 
 | |
| let $i=0;
 | |
| 
 | |
| while ($i <=1 )
 | |
| {
 | |
| 
 | |
| CREATE TABLE t1 (
 | |
|        a INT NOT NULL,
 | |
|        b INT NOT NULL,
 | |
|        PRIMARY KEY(b),
 | |
|        UNIQUE KEY(a))
 | |
| ENGINE=INNODB;
 | |
| 
 | |
| SET @old_innodb_stats_auto_recalc = @@innodb_stats_auto_recalc;
 | |
| SET GLOBAL innodb_stats_auto_recalc = OFF;
 | |
| 
 | |
| # Block purge
 | |
| connect  purge_control,localhost,root;
 | |
| START TRANSACTION WITH CONSISTENT SNAPSHOT;
 | |
| connection default;
 | |
| 
 | |
| SET @old_tx_isolation = @@tx_isolation;
 | |
| SET GLOBAL tx_isolation = 'READ-COMMITTED';
 | |
| 
 | |
| SET @old_innodb_lock_wait_timeout = @@innodb_lock_wait_timeout;
 | |
| SET GLOBAL innodb_lock_wait_timeout = 1;
 | |
| 
 | |
| --connect(con1,localhost,root,,)
 | |
| 
 | |
| # Create and delete-mark an index record
 | |
| 
 | |
| INSERT INTO t1 VALUES (1,1),(2,2);
 | |
| DELETE FROM t1;
 | |
| 
 | |
| SET debug_sync = 'row_ins_sec_index_entry_dup_locks_created SIGNAL
 | |
| con1_locks_done WAIT_FOR con1_go';
 | |
| SET debug_sync = 'ha_commit_trans_after_acquire_commit_lock SIGNAL
 | |
| con1_insert_done WAIT_FOR con1_finish';
 | |
| --send
 | |
| 
 | |
| if ($i == 0)
 | |
| {
 | |
| REPLACE INTO t1 VALUES (1,2);
 | |
| }
 | |
| 
 | |
| if ( $i == 1)
 | |
| {
 | |
| INSERT INTO t1 values (1,2) ON DUPLICATE KEY UPDATE a=2;
 | |
| }
 | |
| --connect(con2,localhost,root,,)
 | |
| 
 | |
| SET debug_sync = 'now WAIT_FOR con1_locks_done';
 | |
| 
 | |
| SET debug_sync = 'lock_wait_start SIGNAL con2_blocked
 | |
| WAIT_FOR con2_go';
 | |
| SET debug_sync = 'ha_commit_trans_after_acquire_commit_lock
 | |
| WAIT_FOR con2_finish';
 | |
| SET debug_sync = 'ib_after_row_insert SIGNAL con2_insert_done';
 | |
| 
 | |
| --send
 | |
| REPLACE INTO t1 VALUES (1,3);
 | |
| 
 | |
| --connection default
 | |
| SET debug_sync = 'now WAIT_FOR con2_blocked';
 | |
| 
 | |
| connection purge_control;
 | |
| COMMIT;
 | |
| disconnect purge_control;
 | |
| connection default;
 | |
| 
 | |
| # Wait for purge to delete the delete-marked record
 | |
| --source ../../innodb/include/wait_all_purged.inc
 | |
| 
 | |
| SET debug_sync = 'now SIGNAL con2_go WAIT_FOR con2_insert_done';
 | |
| SET debug_sync = 'now SIGNAL con1_go WAIT_FOR con1_insert_done';
 | |
| 
 | |
| SET debug_sync = 'now SIGNAL con1_finish';
 | |
| 
 | |
| --connection con1
 | |
| --reap
 | |
| --disconnect con1
 | |
| --connection default
 | |
| SET debug_sync = 'now SIGNAL con2_finish';
 | |
| 
 | |
| --connection con2
 | |
| --error 0,ER_LOCK_WAIT_TIMEOUT
 | |
| --reap
 | |
| --disconnect con2
 | |
| 
 | |
| --connection default
 | |
| SET DEBUG_SYNC= 'RESET';
 | |
| 
 | |
| SELECT * FROM t1;
 | |
| CHECK TABLE t1;
 | |
| 
 | |
| DROP TABLE t1;
 | |
| 
 | |
| SET GLOBAL innodb_stats_auto_recalc = @old_innodb_stats_auto_recalc;
 | |
| SET GLOBAL tx_isolation = @old_tx_isolation;
 | |
| SET GLOBAL innodb_lock_wait_timeout = @old_innodb_lock_wait_timeout;
 | |
| 
 | |
| --inc $i
 | |
| }
 |