mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-30 18:36:12 +01:00 
			
		
		
		
	 bead24b7f3
			
		
	
	
	bead24b7f3
	
	
	
		
			
			Remove one of the major sources of race condiitons in mariadb-test. Normally, mariadb_close() sends COM_QUIT to the server and immediately disconnects. In mariadb-test it means the test can switch to another connection and sends queries to the server before the server even started parsing the COM_QUIT packet and these queries can see the connection as fully active, as it didn't reach dispatch_command yet. This is a major source of instability in tests and many - but not all, still less than a half - tests employ workarounds. The correct one is a pair count_sessions.inc/wait_until_count_sessions.inc. Also very popular was wait_until_disconnected.inc, which was completely useless, because it verifies that the connection is closed, and after disconnect it always is, it didn't verify whether the server processed COM_QUIT. Sadly the placebo was as widely used as the real thing. Let's fix this by making mariadb-test `disconnect` command _to wait_ for the server to confirm. This makes almost all workarounds redundant. In some cases count_sessions.inc/wait_until_count_sessions.inc is still needed, though, as only `disconnect` command is changed: * after external tools, like `exec $MYSQL` * after failed `connect` command * replication, after `STOP SLAVE` * Federated/CONNECT/SPIDER/etc after `DROP TABLE` and also in some XA tests, because an XA transaction is dissociated from the THD very late, after the server has closed the client connection. Collateral cleanups: fix comments, remove some redundant statements: * DROP IF EXISTS if nothing is known to exist * DROP table/view before DROP DATABASE * REVOKE privileges before DROP USER etc
		
			
				
	
	
		
			177 lines
		
	
	
	
		
			5.6 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			177 lines
		
	
	
	
		
			5.6 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| -- source include/have_debug.inc
 | |
| -- source include/have_innodb.inc
 | |
| -- source include/have_debug_sync.inc
 | |
| # This test is slow on buildbot.
 | |
| --source include/big_test.inc
 | |
| 
 | |
| let $MYSQLD_DATADIR= `select @@datadir`;
 | |
| SET GLOBAL innodb_max_purge_lag_wait=0;
 | |
| connect (stop_purge,localhost,root);
 | |
| START TRANSACTION WITH CONSISTENT SNAPSHOT;
 | |
| connection default;
 | |
| 
 | |
| #
 | |
| # Test for BUG# 12739098, check whether trx->error_status is reset on error.
 | |
| #
 | |
| CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1)) Engine=InnoDB;
 | |
| SHOW CREATE TABLE t1;
 | |
| INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5);
 | |
| 
 | |
| SET @saved_debug_dbug = @@SESSION.debug_dbug;
 | |
| SET DEBUG_DBUG='+d,ib_build_indexes_too_many_concurrent_trxs, ib_rename_indexes_too_many_concurrent_trxs, ib_drop_index_too_many_concurrent_trxs';
 | |
| --error ER_TOO_MANY_CONCURRENT_TRXS
 | |
| ALTER TABLE t1 ADD UNIQUE INDEX(c2);
 | |
| SET DEBUG_DBUG = @saved_debug_dbug;
 | |
| 
 | |
| SHOW CREATE TABLE t1;
 | |
| DROP TABLE t1;
 | |
| 
 | |
| #
 | |
| # Test for Bug#13861218 Records are not fully sorted during index creation
 | |
| #
 | |
| CREATE TABLE bug13861218 (c1 INT NOT NULL, c2 INT NOT NULL, INDEX(c2))
 | |
| ENGINE=InnoDB;
 | |
| INSERT INTO bug13861218 VALUES (8, 0), (4, 0), (0, 0);
 | |
| SET DEBUG_DBUG = '+d,ib_row_merge_buf_add_two';
 | |
| # Force creation of a PRIMARY KEY on c1 to see what happens on the index(c2).
 | |
| # No crash here, because n_uniq for c2 includes the clustered index fields
 | |
| CREATE UNIQUE INDEX ui ON bug13861218(c1);
 | |
| SET DEBUG_DBUG = @saved_debug_dbug;
 | |
| DROP TABLE bug13861218;
 | |
| 
 | |
| CREATE TABLE bug13861218 (c1 INT NOT NULL, c2 INT UNIQUE) ENGINE=InnoDB;
 | |
| INSERT INTO bug13861218 VALUES (8, NULL), (4, NULL), (0, NULL);
 | |
| SET DEBUG_DBUG = '+d,ib_row_merge_buf_add_two';
 | |
| # Force creation of a PRIMARY KEY on c1 to see what happens on the index(c2).
 | |
| # assertion failure: ut_ad(cmp_dtuple_rec(dtuple, rec, rec_offsets) > 0)
 | |
| CREATE UNIQUE INDEX ui ON bug13861218(c1);
 | |
| SET DEBUG_DBUG = @saved_debug_dbug;
 | |
| DROP TABLE bug13861218;
 | |
| 
 | |
| --echo #
 | |
| --echo # Bug #17657223	EXCESSIVE TEMPORARY FILE USAGE IN ALTER TABLE
 | |
| --echo #
 | |
| 
 | |
| # Error during file creation in alter operation
 | |
| create table t480(a serial)engine=innodb;
 | |
| insert into t480
 | |
| values(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),
 | |
| (),(),(),(),(),(),(),();
 | |
| insert into t480 select 0 from t480;
 | |
| insert into t480 select 0 from t480;
 | |
| insert into t480 select 0 from t480;
 | |
| insert into t480 select 0 from t480;
 | |
| 
 | |
| # Error during file write in alter operation.
 | |
| create table t1(f1 int auto_increment not null,
 | |
| 		f2 char(200) not null, f3 char(200) not null,
 | |
| 		primary key(f1,f2,f3), key(f1))engine=innodb;
 | |
| insert into t1 select NULL,'aaa','bbb' from t480;
 | |
| insert into t1 select NULL,'aaaa','bbbb' from t480;
 | |
| insert into t1 select NULL,'aaaaa','bbbbb' from t480;
 | |
| insert into t1 select NULL,'aaaaaa','bbbbbb' from t480;
 | |
| SET DEBUG_DBUG = '+d,row_merge_write_failure';
 | |
| --error ER_TEMP_FILE_WRITE_FAILURE
 | |
| alter table t1 drop primary key,add primary key(f2,f1);
 | |
| SET DEBUG_DBUG = @saved_debug_dbug;
 | |
| drop table t1;
 | |
| 
 | |
| # Optimize table via inplace algorithm
 | |
| connect (con1,localhost,root);
 | |
| create table t1(k1 int auto_increment primary key,
 | |
| k2 char(200),k3 char(200))engine=innodb;
 | |
| insert into t1 values(NULL,'a','b'), (NULL,'aa','bb');
 | |
| SET DEBUG_SYNC= 'row_merge_after_scan
 | |
| SIGNAL opened WAIT_FOR flushed';
 | |
| send optimize table t1;
 | |
| connection default;
 | |
| SET DEBUG_SYNC= 'now WAIT_FOR opened';
 | |
| INSERT INTO t1 select NULL,'aaa','bbb' from t480;
 | |
| SET DEBUG_SYNC= 'now SIGNAL flushed';
 | |
| connection con1;
 | |
| --enable_info
 | |
| --echo /*con1 reap*/ Optimize table t1;
 | |
| reap;
 | |
| --disable_info
 | |
| SELECT COUNT(k1),k2,k3 FROM t1 GROUP BY k2,k3;
 | |
| drop table t1;
 | |
| 
 | |
| # Log file creation failure.
 | |
| create table t1(k1 int auto_increment primary key,
 | |
| k2 char(200),k3 char(200))engine=innodb;
 | |
| INSERT INTO t1 VALUES(1, "test", "test");
 | |
| SET DEBUG_SYNC= 'row_merge_after_scan
 | |
| SIGNAL opened WAIT_FOR flushed';
 | |
| send ALTER TABLE t1 FORCE, ADD COLUMN k4 int;
 | |
| connection default;
 | |
| SET DEBUG_SYNC= 'now WAIT_FOR opened';
 | |
| SET debug_dbug = '+d,row_log_tmpfile_fail';
 | |
| INSERT INTO t1 select NULL,'aaa','bbb' from t480;
 | |
| INSERT INTO t1 select NULL,'aaaa','bbbb' from t480;
 | |
| SET DEBUG_SYNC= 'now SIGNAL flushed';
 | |
| SET DEBUG_DBUG = @saved_debug_dbug;
 | |
| connection con1;
 | |
| --echo /*con1 reap*/ ALTER TABLE t1 ADD COLUMN k4 int;
 | |
| --error ER_OUT_OF_RESOURCES
 | |
| reap;
 | |
| SELECT COUNT(k1),k2,k3 FROM t1 GROUP BY k2,k3;
 | |
| disconnect con1;
 | |
| connection default;
 | |
| show create table t1;
 | |
| drop table t1;
 | |
| drop table t480;
 | |
| --echo #
 | |
| --echo # MDEV-12827 Assertion failure when reporting duplicate key error
 | |
| --echo # in online table rebuild
 | |
| --echo #
 | |
| 
 | |
| CREATE TABLE t1 (j INT UNIQUE, i INT) ENGINE=InnoDB;
 | |
| INSERT INTO t1 VALUES(2, 2);
 | |
| --connect (con1,localhost,root,,test)
 | |
| SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built WAIT_FOR log';
 | |
| --send
 | |
| ALTER TABLE t1 DROP j, ADD UNIQUE INDEX(i), FORCE;
 | |
| 
 | |
| --connection default
 | |
| SET DEBUG_SYNC='now WAIT_FOR built';
 | |
| SET DEBUG_DBUG='+d,row_ins_row_level';
 | |
| INSERT INTO t1 (i) VALUES (0),(0);
 | |
| SET DEBUG_SYNC='now SIGNAL log';
 | |
| SET DEBUG_DBUG=@saved_debug_dbug;
 | |
| 
 | |
| --connection con1
 | |
| --error ER_DUP_ENTRY
 | |
| reap;
 | |
| DELETE FROM t1;
 | |
| ALTER TABLE t1 ADD UNIQUE INDEX(i);
 | |
| SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built2 WAIT_FOR log2';
 | |
| --send
 | |
| ALTER TABLE t1 DROP j, FORCE;
 | |
| 
 | |
| --connection default
 | |
| SET DEBUG_SYNC='now WAIT_FOR built2';
 | |
| INSERT INTO t1 (i) VALUES (0),(1);
 | |
| --error ER_DUP_ENTRY
 | |
| UPDATE t1 SET i=0;
 | |
| SET DEBUG_SYNC='now SIGNAL log2';
 | |
| 
 | |
| --connection con1
 | |
| reap;
 | |
| --disconnect con1
 | |
| --disconnect stop_purge
 | |
| --connection default
 | |
| SET DEBUG_SYNC='RESET';
 | |
| DROP TABLE t1;
 | |
| 
 | |
| SET DEBUG_SYNC='RESET';
 | |
| 
 | |
| --echo #
 | |
| --echo #  BUG#21612714 ALTER TABLE SORTING SKIPPED WHEN CHANGE PK AND DROP
 | |
| --echo #                LAST COLUMN OF OLD PK
 | |
| --echo #
 | |
| 
 | |
| SET DEBUG_DBUG = '+d,innodb_alter_table_pk_assert_no_sort';
 | |
| 
 | |
| --source suite/innodb/include/alter_table_pk_no_sort.inc
 | |
| 
 | |
| SET DEBUG_DBUG = @saved_debug_dbug;
 |