Commit 1f3825b2 authored by unknown's avatar unknown

Bug #17838 binlog not setup on seconday master after rename

-added setting up of binlogging after receiving rename table
+cleanup


mysql-test/r/ndb_binlog_ddl_multi.result:
  Bug #17838 binlog not setup on seconday master after rename
mysql-test/t/ndb_binlog_ddl_multi.test:
  Bug #17838 binlog not setup on seconday master after rename
mysql-test/include/show_binlog_events.inc:
  New BitKeeper file ``mysql-test/include/show_binlog_events.inc''
parent 56df7223
--let $binlog_start=102
--replace_result $binlog_start <binlog_start>
--replace_column 2 # 4 # 5 #
--eval show binlog events from $binlog_start
drop database if exists mysqltest; drop database if exists mysqltest;
drop table if exists t1,t2; drop table if exists t1,t2,t3;
drop database if exists mysqltest; drop database if exists mysqltest;
drop table if exists t1,t2; drop table if exists t1,t2,t3;
reset master; reset master;
reset master; reset master;
create database mysqltest; create database mysqltest;
...@@ -123,3 +123,68 @@ master-bin1.000001 # Table_map # # cluster.apply_status ...@@ -123,3 +123,68 @@ master-bin1.000001 # Table_map # # cluster.apply_status
master-bin1.000001 # Write_rows # # master-bin1.000001 # Write_rows # #
master-bin1.000001 # Query # # COMMIT master-bin1.000001 # Query # # COMMIT
master-bin1.000001 # Query # # use `test`; drop table `t1` master-bin1.000001 # Query # # use `test`; drop table `t1`
reset master;
show tables;
Tables_in_test
reset master;
show tables;
Tables_in_test
create table t1 (a int key) engine=ndb;
create table t2 (a int key) engine=ndb;
create table t3 (a int key) engine=ndb;
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin1.000001 # Query # # use `test`; create table t1 (a int key) engine=ndb
master-bin1.000001 # Query # # use `test`; create table t2 (a int key) engine=ndb
master-bin1.000001 # Query # # use `test`; create table t3 (a int key) engine=ndb
master-bin1.000001 # Query # # BEGIN
master-bin1.000001 # Table_map # # cluster.apply_status
master-bin1.000001 # Write_rows # #
master-bin1.000001 # Query # # COMMIT
master-bin1.000001 # Query # # use `test`; rename table `test.t3` to `test.t4`
master-bin1.000001 # Query # # BEGIN
master-bin1.000001 # Table_map # # cluster.apply_status
master-bin1.000001 # Write_rows # #
master-bin1.000001 # Query # # COMMIT
master-bin1.000001 # Query # # use `test`; rename table `test.t2` to `test.t3`
master-bin1.000001 # Query # # BEGIN
master-bin1.000001 # Table_map # # cluster.apply_status
master-bin1.000001 # Write_rows # #
master-bin1.000001 # Query # # COMMIT
master-bin1.000001 # Query # # use `test`; rename table `test.t1` to `test.t2`
master-bin1.000001 # Query # # BEGIN
master-bin1.000001 # Table_map # # cluster.apply_status
master-bin1.000001 # Write_rows # #
master-bin1.000001 # Query # # COMMIT
master-bin1.000001 # Query # # use `test`; rename table `test.t4` to `test.t1`
drop table t1;
drop table t2;
drop table t3;
reset master;
show tables;
Tables_in_test
reset master;
show tables;
Tables_in_test
create table t1 (a int key) engine=ndb;
insert into t1 values(1);
rename table t1 to t2;
insert into t2 values(2);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin1.000001 # Query # # use `test`; create table t1 (a int key) engine=ndb
master-bin1.000001 # Query # # BEGIN
master-bin1.000001 # Table_map # # cluster.apply_status
master-bin1.000001 # Write_rows # #
master-bin1.000001 # Table_map # # test.t1
master-bin1.000001 # Write_rows # #
master-bin1.000001 # Query # # COMMIT
master-bin1.000001 # Query # # use `test`; rename table `test.t1` to `test.t2`
master-bin1.000001 # Query # # BEGIN
master-bin1.000001 # Table_map # # cluster.apply_status
master-bin1.000001 # Write_rows # #
master-bin1.000001 # Table_map # # test.t2
master-bin1.000001 # Write_rows # #
master-bin1.000001 # Query # # COMMIT
drop table t2;
...@@ -5,18 +5,16 @@ ...@@ -5,18 +5,16 @@
--disable_warnings --disable_warnings
connection server2; connection server2;
drop database if exists mysqltest; drop database if exists mysqltest;
drop table if exists t1,t2; drop table if exists t1,t2,t3;
connection server1; connection server1;
drop database if exists mysqltest; drop database if exists mysqltest;
drop table if exists t1,t2; drop table if exists t1,t2,t3;
--connection server1 --connection server1
reset master; reset master;
--connection server2 --connection server2
reset master; reset master;
--enable_warnings --enable_warnings
--let $binlog_start=102
# #
# basic test to see if ddl distribution works across # basic test to see if ddl distribution works across
# multiple binlogs # multiple binlogs
...@@ -33,15 +31,10 @@ create table t1 (a int primary key) engine=ndb; ...@@ -33,15 +31,10 @@ create table t1 (a int primary key) engine=ndb;
--connection server2 --connection server2
create table t2 (a int primary key) engine=ndb; create table t2 (a int primary key) engine=ndb;
--replace_result $binlog_start <binlog_start> --source include/show_binlog_events.inc
--replace_column 2 # 4 # 5 #
--eval show binlog events from $binlog_start
--connection server1 --connection server1
--replace_result $binlog_start <binlog_start> -- source include/show_binlog_events.inc
--replace_column 2 # 4 # 5 #
--eval show binlog events from $binlog_start
# alter table # alter table
--connection server1 --connection server1
...@@ -53,9 +46,7 @@ reset master; ...@@ -53,9 +46,7 @@ reset master;
alter table t2 add column (b int); alter table t2 add column (b int);
--connections server1 --connections server1
--replace_result $binlog_start <binlog_start> --source include/show_binlog_events.inc
--replace_column 2 # 4 # 5 #
--eval show binlog events from $binlog_start
# alter database # alter database
...@@ -91,9 +82,7 @@ drop database mysqltest; ...@@ -91,9 +82,7 @@ drop database mysqltest;
create table t1 (a int primary key) engine=ndb; create table t1 (a int primary key) engine=ndb;
--connection server2 --connection server2
--replace_result $binlog_start <binlog_start> --source include/show_binlog_events.inc
--replace_column 2 # 4 # 5 #
--eval show binlog events from $binlog_start
--connection server2 --connection server2
drop table t2; drop table t2;
...@@ -144,6 +133,51 @@ ENGINE =NDB; ...@@ -144,6 +133,51 @@ ENGINE =NDB;
drop table t1; drop table t1;
--connection server2 --connection server2
--replace_result $binlog_start <binlog_start> --source include/show_binlog_events.inc
--replace_column 2 # 4 # 5 #
--eval show binlog events from $binlog_start #
# Bug #17827 cluster: rename of several tables in one statement,
# gets multiply logged
#
--connection server1
reset master;
show tables;
--connection server2
reset master;
show tables;
--connection server1
create table t1 (a int key) engine=ndb;
create table t2 (a int key) engine=ndb;
create table t3 (a int key) engine=ndb;
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
--connection server2
--source include/show_binlog_events.inc
drop table t1;
drop table t2;
drop table t3;
#
# Bug #17838 binlog not setup on seconday master after rename
#
#
--connection server1
reset master;
show tables;
--connection server2
reset master;
show tables;
--connection server1
create table t1 (a int key) engine=ndb;
insert into t1 values(1);
rename table t1 to t2;
insert into t2 values(2);
# now we should see data in table t1 _and_ t2
# prior to bug fix, data was missing for t2
--connection server2
--source include/show_binlog_events.inc
drop table t2;
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment