summaryrefslogtreecommitdiff
path: root/mysql-test/t/binlog.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/binlog.test')
-rw-r--r--mysql-test/t/binlog.test125
1 files changed, 122 insertions, 3 deletions
diff --git a/mysql-test/t/binlog.test b/mysql-test/t/binlog.test
index accfa6a577f..b9996a2b380 100644
--- a/mysql-test/t/binlog.test
+++ b/mysql-test/t/binlog.test
@@ -3,16 +3,14 @@
#
-- source include/have_log_bin.inc
-- source include/not_embedded.inc
--- source include/have_bdb.inc
-- source include/have_innodb.inc
--- source include/have_log_bin.inc
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
reset master;
-create table t1 (a int) engine=bdb;
+create table t1 (a int) engine=innodb;
create table t2 (a int) engine=innodb;
begin;
insert t1 values (5);
@@ -49,3 +47,124 @@ show binlog events in 'master-bin.000001' from 98;
--replace_column 2 # 5 #
show binlog events in 'master-bin.000002' from 98;
+#
+# Bug#22540 - Incorrect value in column End_log_pos of
+# SHOW BINLOG EVENTS using InnoDB
+#
+
+# the following tests will show that certain queries now return
+# absolute offsets (from binlog start, rather than relative to
+# the beginning of the current transaction). under what
+# conditions it should be allowed / is sensible to put the
+# slider into the middle of a transaction is not our concern
+# here; we just guarantee that if and when it's done, the
+# user has valid offsets to use. if the setter function still
+# wants to throw a "positioning into middle of transaction"
+# warning, that's its prerogative and handled elsewhere.
+
+set @ac = @@autocommit;
+
+# first show this to work for SHOW BINLOG EVENTS
+
+set autocommit= 0;
+reset master;
+create table t1(n int) engine=innodb;
+begin;
+insert into t1 values (1);
+insert into t1 values (2);
+insert into t1 values (3);
+commit;
+drop table t1;
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
+show binlog events from 0;
+
+set autocommit= 1;
+reset master;
+create table t1(n int) engine=innodb;
+insert into t1 values (1);
+insert into t1 values (2);
+insert into t1 values (3);
+commit;
+drop table t1;
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
+show binlog events from 0;
+
+reset master;
+create table t1(n int) engine=myisam;
+begin;
+insert into t1 values (4);
+insert into t1 values (5);
+insert into t1 values (6);
+commit;
+drop table t1;
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
+show binlog events from 0;
+
+# now show this also works for SHOW MASTER STATUS
+# as this is what "mysqldump --master-data=1" uses.
+
+set autocommit= 1;
+reset master;
+create table t1(n int) engine=innodb;
+show master status;
+insert into t1 values (1);
+show master status;
+insert into t1 values (2);
+insert into t1 values (3);
+show master status;
+commit;
+show master status;
+drop table t1;
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
+show binlog events from 0;
+
+set autocommit= 0;
+reset master;
+create table t1(n int) engine=myisam;
+show master status;
+insert into t1 values (4);
+show master status;
+insert into t1 values (5);
+insert into t1 values (6);
+
+show master status;
+commit;
+show master status;
+drop table t1;
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
+show binlog events from 0;
+
+set session autocommit = @ac;
+
+# now show that nothing breaks if we need to read from the cache more
+# than once, resulting in split event-headers
+
+set @bcs = @@binlog_cache_size;
+set @ac = @@autocommit;
+
+set global binlog_cache_size=4096;
+set autocommit= 0;
+reset master;
+
+create table t1 (a int) engine=innodb;
+
+let $1=400;
+disable_query_log;
+begin;
+while ($1)
+{
+ eval insert into t1 values( $1 );
+ dec $1;
+}
+commit;
+enable_query_log;
+
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
+show binlog events from 0;
+
+drop table t1;
+
+set global binlog_cache_size=@bcs;
+set session autocommit = @ac;
+
+--echo End of 5.0 tests