Debian Codegraph @

mysql-test/suite/ndb_binlog/t/ndb_binlog_disable.test

raw
1 -- source include/have_multi_ndb.inc
2 -- source include/have_binlog_format_mixed_or_row.inc
3
4 connect(mysqld1,127.0.0.1,root,,test,$MASTER_MYPORT);
5 connect(mysqld2,127.0.0.1,root,,test,$MASTER_MYPORT1);
6
7 connection mysqld1;
8
9 # Wait for each mysqld to startup binlogging
10 --let $source_server=mysqld1
11 --let $dest_server=mysqld2
12 source suite/ndb_rpl/t/wait_schema_logging.inc;
13
14 --disable_query_log
15 connection mysqld1;
16 reset master;
17 connection mysqld2;
18 reset master;
19 --enable_query_log
20
21 # Bug#26333981 BI IS WRITING TABLE_MAP EVEN WHEN USING SQL_LOG_BIN = 0
22
23 --connection mysqld1
24
25 create table test.ndbt1 (a int primary key, b int) engine=ndb;
26 SET sql_log_bin = 0;
27 use test;
28 create table test.ndbt2 (a int primary key, b int) engine=ndb;
29 create table test.ndbt3 (a int primary key, b int) engine=ndb;
30 begin;
31 insert into ndbt1 values (1,1);
32 insert into ndbt2 values (1,1),(2,2);
33 insert into ndbt3 values (1,1);
34 commit;
35 SET sql_log_bin = 1;
36 begin;
37 insert into ndbt1 values (2,2);
38 insert into ndbt3 values (2,2);
39 commit;
40
41 --disable_query_log
42 # Add an event-stream marker
43 create table stream_marker(a int) engine=ndb;
44 drop table stream_marker;
45 --let $wait_binlog_event=stream_marker
46 --enable_query_log
47
48 --echo Show + reset Binlog contents on Mysqld 1
49 --echo We should se tables ndbt1 and ndbt3 added to Table_map,
50 --echo but not table ndbt2
51 --connection mysqld1
52 --source include/wait_for_binlog_event.inc
53 --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
54 let $MYSQLD_DATADIR= `select @@datadir;`;
55
56 create table table_map_binlog_rows (table_map varchar(1000));
57 --disable_warnings
58 --disable_query_log
59 --exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/$binlog_file > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.txt
60 --eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.txt' into table table_map_binlog_rows fields terminated by 'mapped' lines starting by 'Table_map:';
61 --remove_file $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.txt
62 --enable_query_log
63 --enable_warnings
64 select * from table_map_binlog_rows order by table_map;
65 drop table table_map_binlog_rows;
66 reset master;
67
68 --echo Show + reset Binlog contents on Mysqld 2
69 --echo We should se tables ndbt1 and ndbt3 added to Table_map,
70 --echo but not table ndbt2
71 --connection mysqld2
72 --source include/wait_for_binlog_event.inc
73 --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
74 let $MYSQLD_DATADIR= `select @@datadir;`;
75
76 create table table_map_binlog_rows (table_map varchar(1000));
77 --disable_warnings
78 --disable_query_log
79 --exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/$binlog_file > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.txt
80 --eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.txt' into table table_map_binlog_rows fields terminated by 'mapped' lines starting by 'Table_map:';
81 --remove_file $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.txt
82 --enable_query_log
83 --enable_warnings
84 select * from table_map_binlog_rows order by table_map;
85 drop table table_map_binlog_rows;
86 reset master;
87
88 --connection mysqld1
89 drop table ndbt1;
90 drop table ndbt2;
91 drop table ndbt3;
92
93 ## Bug #11779725 MYSQL CLUSTER REPLICATION : ANYVALUE MERGED FOR TABLES WITH BLOBS
94 ## This is a check that the fix for Bug#26333981 doesn't cause inconsistency
95 ## between table map and what rows are binlogged.
96 ## NOTE: this test case is dependent on epoch boundries and is this not totally
97 ## reliable, hence it is commented out
98 #--connection mysqld1
99 ## Check toggle of SQL_LOG_BIN between insert+update
100 ## Check that incomplete transaction for t1 (where update becomes incorrect insert)
101 ## still has t1 i Table_map
102 #CREATE TABLE t1 (a int primary key, b int, c longtext) engine=ndb;
103 #
104 #SET SQL_LOG_BIN=0;
105 #INSERT INTO t1 VALUES (1, 1, "HIDDEN");
106 #SET SQL_LOG_BIN=1;
107 #UPDATE t1 SET b = 5 WHERE a = 1;
108 ## Check oposite toggle of SQL_LOG_BIN between insert+update
109 ## Check that incomplete transaction for t1 (where first insert incorrectly is not logged)
110 ## t2 is not in Table_map
111 #CREATE TABLE t2 (a int primary key, b int, c longtext) engine=ndb;
112 #
113 #SET SQL_LOG_BIN=1;
114 #INSERT INTO t2 VALUES (1, 1, "HIDDEN");
115 #SET SQL_LOG_BIN=0;
116 #UPDATE t2 SET b = 5 WHERE a = 1;
117 ## Check that insert+delete case where nothing is binlogged for t3
118 ## then t3 is not in Table_map
119 #SET SQL_LOG_BIN=1;
120 #CREATE TABLE t3 (a int primary key, b int, c longtext) engine=ndb;
121 #
122 #INSERT INTO t3 VALUES (1, 1, "HIDDEN");
123 #DELETE from t3 WHERE a = 1;
124 #
125 #--disable_query_log
126 ## Add an event-stream marker
127 #create table stream_marker(a int) engine=ndb;
128 #drop table stream_marker;
129 #--let $wait_binlog_event=stream_marker
130 #--enable_query_log
131 #
132 #--connection mysqld2
133 #--source include/wait_for_binlog_event.inc
134 #--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
135 #let $MYSQLD_DATADIR= `select @@datadir;`;
136 #create table table_map_binlog_rows (Table_map varchar(1000));
137 #--disable_warnings
138 #--disable_query_log
139 #--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/$binlog_file > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.txt
140 #--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.txt' into table table_map_binlog_rows fields terminated by 'mapped' lines starting by 'Table_map:';
141 #--remove_file $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.txt
142 #--enable_query_log
143 #--enable_warnings
144 #--echo Check that only t1 is in the Table_map
145 #select * from table_map_binlog_rows;
146 #drop table table_map_binlog_rows;
147 #
148 #--connection mysqld1
149 #drop table t1;
150 #drop table t2;
151 #drop table t3;