2008-07-23 18:56:39 +02:00
|
|
|
# ==== Purpose ====
|
|
|
|
#
|
|
|
|
# Verify that INSERT DELAYED in mixed or row mode writes events to the
|
|
|
|
# binlog, and that AUTO_INCREMENT works correctly.
|
|
|
|
#
|
|
|
|
# ==== Method ====
|
|
|
|
#
|
|
|
|
# Insert both single and multiple rows into an autoincrement column,
|
|
|
|
# both with specified value and with NULL.
|
|
|
|
#
|
|
|
|
# With INSERT DELAYED, the rows do not show up in the table
|
|
|
|
# immediately, so we must do source include/wait_until_rows_count.inc
|
|
|
|
# between any two INSERT DELAYED statements. Moreover, if mixed or
|
|
|
|
# row-based logging is used, there is also a delay between when rows
|
|
|
|
# show up in the table and when they show up in the binlog. To ensure
|
|
|
|
# that the rows show up in the binlog, we call FLUSH TABLES, which
|
|
|
|
# waits until the delayed_insert thread has finished.
|
|
|
|
#
|
|
|
|
# We cannot read the binlog after executing INSERT DELAYED statements
|
|
|
|
# that insert multiple rows, because that is nondeterministic. More
|
|
|
|
# precisely, rows may be written in batches to the binlog, where each
|
|
|
|
# batch has one Table_map_log_event and one or more
|
|
|
|
# Write_rows_log_event. The number of rows included in each batch is
|
|
|
|
# nondeterministic.
|
|
|
|
#
|
|
|
|
# ==== Related bugs ====
|
|
|
|
#
|
|
|
|
# BUG#20627: INSERT DELAYED does not honour auto_increment_* variables
|
|
|
|
# Bug in this test: BUG#38068: binlog_stm_binlog fails sporadically in pushbuild
|
|
|
|
|
|
|
|
|
2006-08-30 09:22:43 +02:00
|
|
|
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
|
|
|
|
|
2008-07-23 18:56:39 +02:00
|
|
|
let $table=t1;
|
|
|
|
let $count=0;
|
2006-09-23 14:24:45 +02:00
|
|
|
|
2008-07-23 18:56:39 +02:00
|
|
|
insert delayed into t1 values (207);
|
|
|
|
inc $count;
|
2006-09-23 14:24:45 +02:00
|
|
|
--source include/wait_until_rows_count.inc
|
2008-07-23 18:56:39 +02:00
|
|
|
|
2006-08-30 09:22:43 +02:00
|
|
|
insert delayed into t1 values (null);
|
2006-09-23 14:24:45 +02:00
|
|
|
inc $count;
|
|
|
|
--source include/wait_until_rows_count.inc
|
|
|
|
|
2006-08-30 09:22:43 +02:00
|
|
|
insert delayed into t1 values (300);
|
2006-09-23 14:24:45 +02:00
|
|
|
inc $count;
|
|
|
|
--source include/wait_until_rows_count.inc
|
|
|
|
|
2008-07-23 18:56:39 +02:00
|
|
|
# It is not enough to wait until all rows have been inserted into the
|
|
|
|
# table. FLUSH TABLES ensures that they are in the binlog too. See
|
|
|
|
# comment above.
|
|
|
|
FLUSH TABLES;
|
2007-03-29 21:38:03 +02:00
|
|
|
source include/show_binlog_events.inc;
|
2006-09-27 12:05:29 +02:00
|
|
|
|
2006-09-12 15:42:13 +02:00
|
|
|
insert delayed into t1 values (null),(null),(null),(null);
|
2006-09-23 14:24:45 +02:00
|
|
|
inc $count; inc $count; inc $count; inc $count;
|
|
|
|
--source include/wait_until_rows_count.inc
|
|
|
|
|
2006-09-12 15:42:13 +02:00
|
|
|
insert delayed into t1 values (null),(null),(400),(null);
|
2006-09-23 14:24:45 +02:00
|
|
|
inc $count; inc $count; inc $count; inc $count;
|
|
|
|
--source include/wait_until_rows_count.inc
|
|
|
|
|
2006-08-30 09:22:43 +02:00
|
|
|
select * from t1;
|
|
|
|
drop table t1;
|