summaryrefslogtreecommitdiff
path: root/mysql-test/extra
diff options
context:
space:
mode:
authorSven Sandberg <sven@mysql.com>2008-07-29 19:55:46 +0200
committerSven Sandberg <sven@mysql.com>2008-07-29 19:55:46 +0200
commit5101f124e8179a5746fd6a151db6e3014e98a2d4 (patch)
tree20ad7ff0489bf5aba696eec9d6a527b81c5eef84 /mysql-test/extra
parente113042588f0388e94f16be9c946fb3efd7b592d (diff)
parentc6bf7ead8fb4d42eb02a269ed0b61d7fff60ec90 (diff)
downloadmariadb-git-5101f124e8179a5746fd6a151db6e3014e98a2d4.tar.gz
merge 5.1 main -> 5.1-rpl-testfixes
all changes automerged without conflicts
Diffstat (limited to 'mysql-test/extra')
-rw-r--r--mysql-test/extra/binlog_tests/binlog_insert_delayed.test56
1 files changed, 40 insertions, 16 deletions
diff --git a/mysql-test/extra/binlog_tests/binlog_insert_delayed.test b/mysql-test/extra/binlog_tests/binlog_insert_delayed.test
index d073c8ef227..c99d0b86be3 100644
--- a/mysql-test/extra/binlog_tests/binlog_insert_delayed.test
+++ b/mysql-test/extra/binlog_tests/binlog_insert_delayed.test
@@ -1,17 +1,43 @@
-# Test of binlogging of INSERT_ID with INSERT DELAYED
+# ==== 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
+
+
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
-# First, avoid BUG#20627:
-set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
-# Verify that only one INSERT_ID event is binlogged.
-# Note, that because of WL#3368 mixed mode binlog records RBR events for the delayed
-let $table=t1;
-let $rows_inserted=11; # total number of inserted rows in this test
-insert delayed into t1 values (207);
-let $count=1;
-# use this macro instead of sleeps.
+let $table=t1;
+let $count=0;
+insert delayed into t1 values (207);
+inc $count;
--source include/wait_until_rows_count.inc
+
insert delayed into t1 values (null);
inc $count;
--source include/wait_until_rows_count.inc
@@ -20,9 +46,10 @@ insert delayed into t1 values (300);
inc $count;
--source include/wait_until_rows_count.inc
-# moving binlog check affront of multi-rows queries which work is indeterministic (extra table_maps)
-# todo: better check is to substitute SHOW BINLOG with reading from binlog, probably bug#19459 is in
-# the way
+# 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;
source include/show_binlog_events.inc;
insert delayed into t1 values (null),(null),(null),(null);
@@ -33,8 +60,5 @@ insert delayed into t1 values (null),(null),(400),(null);
inc $count; inc $count; inc $count; inc $count;
--source include/wait_until_rows_count.inc
-#check this assertion about $count calculation
---echo $count == $rows_inserted
-
select * from t1;
drop table t1;