mirror of
				https://github.com/MariaDB/server.git
				synced 2025-11-03 14:33:32 +03:00 
			
		
		
		
	The INSERT DELAYED should not maintain its own private auto-increment counter, because this is assuming that other threads cannot insert into the table while the INSERT DELAYED thread is inserting, which is a wrong assumption. So the start of processing of a batch of INSERT rows in the INSERT DELAYED thread must be treated as a start of a new statement and cached next_insert_id must be cleared. mysql-test/r/delayed.result: test suite for the bug mysql-test/t/delayed.test: test suite for the bug sql/sql_insert.cc: Reset auto-increment cacheing before processing the next batch of inserts in the handler thread
		
			
				
	
	
		
			72 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			72 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
drop table if exists t1;
 | 
						|
create table t1 (a char(10), tmsp timestamp);
 | 
						|
insert into t1 set a = 1;
 | 
						|
insert delayed into t1 set a = 2;
 | 
						|
insert into t1 set a = 3, tmsp=NULL;
 | 
						|
insert delayed into t1 set a = 4;
 | 
						|
insert delayed into t1 set a = 5, tmsp = 19711006010203;
 | 
						|
insert delayed into t1 (a, tmsp) values (6, 19711006010203);
 | 
						|
insert delayed into t1 (a, tmsp) values (7, NULL);
 | 
						|
insert into t1 set a = 8,tmsp=19711006010203;
 | 
						|
select * from t1 where tmsp=0;
 | 
						|
a	tmsp
 | 
						|
select * from t1 where tmsp=19711006010203;
 | 
						|
a	tmsp
 | 
						|
5	1971-10-06 01:02:03
 | 
						|
6	1971-10-06 01:02:03
 | 
						|
8	1971-10-06 01:02:03
 | 
						|
drop table t1;
 | 
						|
create table t1 (a int not null auto_increment primary key, b char(10));
 | 
						|
insert delayed into t1 values (1,"b");
 | 
						|
insert delayed into t1 values (null,"c");
 | 
						|
insert delayed into t1 values (3,"d"),(null,"e");
 | 
						|
insert delayed into t1 values (3,"this will give an","error");
 | 
						|
ERROR 21S01: Column count doesn't match value count at row 1
 | 
						|
show status like 'not_flushed_delayed_rows';
 | 
						|
Variable_name	Value
 | 
						|
Not_flushed_delayed_rows	0
 | 
						|
select * from t1;
 | 
						|
a	b
 | 
						|
1	b
 | 
						|
2	c
 | 
						|
3	d
 | 
						|
4	e
 | 
						|
drop table t1;
 | 
						|
create table t1 (a int not null primary key);
 | 
						|
insert into t1 values (1);
 | 
						|
insert delayed into t1 values (1);
 | 
						|
select * from t1;
 | 
						|
a
 | 
						|
1
 | 
						|
drop table t1;
 | 
						|
CREATE TABLE t1 ( a int(10) NOT NULL auto_increment, PRIMARY KEY (a));
 | 
						|
insert delayed into t1 values(null);
 | 
						|
insert into t1 values(null);
 | 
						|
insert into t1 values(null);
 | 
						|
insert delayed into t1 values(null);
 | 
						|
insert delayed into t1 values(null);
 | 
						|
insert delayed into t1 values(null);
 | 
						|
insert into t1 values(null);
 | 
						|
insert into t1 values(null);
 | 
						|
insert into t1 values(null);
 | 
						|
delete from t1 where a=6;
 | 
						|
insert delayed into t1 values(null);
 | 
						|
insert delayed into t1 values(null);
 | 
						|
insert delayed into t1 values(null);
 | 
						|
insert delayed into t1 values(null);
 | 
						|
select * from t1 order by a;
 | 
						|
a
 | 
						|
1
 | 
						|
2
 | 
						|
3
 | 
						|
4
 | 
						|
5
 | 
						|
7
 | 
						|
8
 | 
						|
9
 | 
						|
10
 | 
						|
11
 | 
						|
12
 | 
						|
13
 | 
						|
DROP TABLE t1;
 |