1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321
|
reset master;
reset master;
create database mysqltest;
use mysqltest;
create table t1 (a int primary key) engine=ndb;
create table t2 (a int primary key) engine=ndb;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
binlog.000001 # Query # # create database mysqltest
binlog.000001 # Query # # use `mysqltest`; create table t1 (a int primary key) engine=ndb
binlog.000001 # Query # # use `test`; create table t2 (a int primary key) engine=ndb
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
binlog.000001 # Query # # create database mysqltest
binlog.000001 # Query # # use `mysqltest`; create table t1 (a int primary key) engine=ndb
binlog.000001 # Query # # use `test`; create table t2 (a int primary key) engine=ndb
reset master;
reset master;
alter table t2 add column (b int);
Warnings:
Warning 1478 Converted FIXED field 'b' to DYNAMIC to enable online ADD COLUMN
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
binlog.000001 # Query # # use `test`; alter table t2 add column (b int)
reset master;
reset master;
ALTER DATABASE mysqltest CHARACTER SET latin1;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
binlog.000001 # Query # # ALTER DATABASE mysqltest CHARACTER SET latin1
drop table mysqltest.t1;
reset master;
reset master;
use test;
insert into t2 values (1,2);
drop database mysqltest;
create table t1 (a int primary key) engine=ndb;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
binlog.000001 # Query # # BEGIN
binlog.000001 # Table_map # # table_id: # (test.t2)
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
binlog.000001 # Write_rows # # table_id: #
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F
binlog.000001 # Query # # COMMIT
binlog.000001 # Query # # drop database mysqltest
binlog.000001 # Query # # use `test`; create table t1 (a int primary key) engine=ndb
drop table t2;
reset master;
reset master;
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE = 4M
ENGINE=NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile02.dat'
INITIAL_SIZE = 4M;
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile.dat';
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile02.dat';
DROP TABLESPACE ts1;
DROP LOGFILE GROUP lg1
ENGINE =NDB;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
binlog.000001 # Query # # CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB
binlog.000001 # Query # # ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE = 4M
ENGINE=NDB
binlog.000001 # Query # # CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB
binlog.000001 # Query # # ALTER TABLESPACE ts1
ADD DATAFILE 'datafile02.dat'
INITIAL_SIZE = 4M
binlog.000001 # Query # # ALTER TABLESPACE ts1
DROP DATAFILE 'datafile.dat'
binlog.000001 # Query # # ALTER TABLESPACE ts1
DROP DATAFILE 'datafile02.dat'
binlog.000001 # Query # # DROP TABLESPACE ts1
binlog.000001 # Query # # DROP LOGFILE GROUP lg1
ENGINE =NDB
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;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
binlog.000001 # Query # # use `test`; create table t1 (a int key) engine=ndb
binlog.000001 # Query # # use `test`; create table t2 (a int key) engine=ndb
binlog.000001 # Query # # use `test`; create table t3 (a int key) engine=ndb
binlog.000001 # Query # # use `test`; rename table `test`.`t3` to `test`.`t4`
binlog.000001 # Query # # use `test`; rename table `test`.`t2` to `test`.`t3`
binlog.000001 # Query # # use `test`; rename table `test`.`t1` to `test`.`t2`
binlog.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);
drop table t2;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
binlog.000001 # Query # # use `test`; create table t1 (a int key) engine=ndb
binlog.000001 # Query # # BEGIN
binlog.000001 # Table_map # # table_id: # (test.t1)
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
binlog.000001 # Write_rows # # table_id: #
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F
binlog.000001 # Query # # COMMIT
binlog.000001 # Query # # use `test`; rename table `test`.`t1` to `test`.`t2`
binlog.000001 # Query # # BEGIN
binlog.000001 # Table_map # # table_id: # (test.t2)
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
binlog.000001 # Write_rows # # table_id: #
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F
binlog.000001 # Query # # COMMIT
binlog.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */
reset master;
reset master;
use test;
The relative order between DML and DDL statements below are
expected to follow the same order in binlog as shown below.
create database mysqltest;
create table t1 (a int primary key) engine=ndb;
insert into t1 values (1);
drop database mysqltest;
drop table t1;
create database mysqltest;
create table t1 (a int primary key) engine=ndb;
insert into t1 values (1);
drop database mysqltest;
drop table t1;
create database mysqltest;
create table t1 (a int primary key) engine=ndb;
insert into t1 values (1);
drop database mysqltest;
drop table t1;
create database mysqltest;
create table t1 (a int primary key) engine=ndb;
insert into t1 values (1);
drop database mysqltest;
drop table t1;
create database mysqltest;
create table t1 (a int primary key) engine=ndb;
insert into t1 values (1);
drop database mysqltest;
drop table t1;
create table dummy (dummyk int primary key) engine = ndb;
drop table dummy;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
binlog.000001 # Query # # create database mysqltest
binlog.000001 # Query # # use `test`; create table t1 (a int primary key) engine=ndb
binlog.000001 # Query # # BEGIN
binlog.000001 # Table_map # # table_id: # (test.t1)
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
binlog.000001 # Write_rows # # table_id: #
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F
binlog.000001 # Query # # COMMIT
binlog.000001 # Query # # drop database mysqltest
binlog.000001 # Query # # use `test`; drop table `test`.`t1`
binlog.000001 # Query # # create database mysqltest
binlog.000001 # Query # # use `test`; create table t1 (a int primary key) engine=ndb
binlog.000001 # Query # # BEGIN
binlog.000001 # Table_map # # table_id: # (test.t1)
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
binlog.000001 # Write_rows # # table_id: #
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F
binlog.000001 # Query # # COMMIT
binlog.000001 # Query # # drop database mysqltest
binlog.000001 # Query # # use `test`; drop table `test`.`t1`
binlog.000001 # Query # # create database mysqltest
binlog.000001 # Query # # use `test`; create table t1 (a int primary key) engine=ndb
binlog.000001 # Query # # BEGIN
binlog.000001 # Table_map # # table_id: # (test.t1)
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
binlog.000001 # Write_rows # # table_id: #
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F
binlog.000001 # Query # # COMMIT
binlog.000001 # Query # # drop database mysqltest
binlog.000001 # Query # # use `test`; drop table `test`.`t1`
binlog.000001 # Query # # create database mysqltest
binlog.000001 # Query # # use `test`; create table t1 (a int primary key) engine=ndb
binlog.000001 # Query # # BEGIN
binlog.000001 # Table_map # # table_id: # (test.t1)
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
binlog.000001 # Write_rows # # table_id: #
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F
binlog.000001 # Query # # COMMIT
binlog.000001 # Query # # drop database mysqltest
binlog.000001 # Query # # use `test`; drop table `test`.`t1`
binlog.000001 # Query # # create database mysqltest
binlog.000001 # Query # # use `test`; create table t1 (a int primary key) engine=ndb
binlog.000001 # Query # # BEGIN
binlog.000001 # Table_map # # table_id: # (test.t1)
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
binlog.000001 # Write_rows # # table_id: #
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F
binlog.000001 # Query # # COMMIT
binlog.000001 # Query # # drop database mysqltest
binlog.000001 # Query # # use `test`; drop table `test`.`t1`
binlog.000001 # Query # # use `test`; create table dummy (dummyk int primary key) engine = ndb
binlog.000001 # Query # # use `test`; DROP TABLE `dummy` /* generated by server */
CREATE TABLE progress(
cnt int, stop_flag int
) ENGINE NDB;
insert into progress value(0,0);
Start background load distributing schema changes.
call p1();
Restart mysqld 'server2'
# restart
Checking for schema ops. still making progress
Restart mysqld 'server2'
# restart
Checking for schema ops. still making progress
Restart mysqld 'server2'
# restart
Checking for schema ops. still making progress
Restart mysqld 'server2'
# restart
Checking for schema ops. still making progress
Stopping background load distributing schema changes.
update progress set stop_flag=1;
Wait for background schema distribution load to complete.
Cleanup
drop procedure p1;
drop table progress;
#
# WL#12936 : Implement DDL transaction context logger in ndbcluster
#
reset master;
show tables;
Tables_in_test
reset master;
show tables;
Tables_in_test
# Setup
CREATE TABLE t1 (
a int,
b int
) ENGINE NDB;
INSERT INTO t1 VALUES (1, NULL);
CREATE TABLE t2 (
a int,
b int not null
) ENGINE NDB
AS SELECT * FROM t1;
ERROR 23000: Column 'b' cannot be null
# Verify that table does not exist
SELECT * FROM t2;
ERROR 42S02: Table 'test.t2' doesn't exist
# Verify that the CREATE TABLE t2 query is not present in binlog
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
binlog.000001 # Query # # use `test`; CREATE TABLE t1 (
a int,
b int
) ENGINE NDB
binlog.000001 # Query # # BEGIN
binlog.000001 # Table_map # # table_id: # (test.t1)
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
binlog.000001 # Write_rows # # table_id: #
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F
binlog.000001 # Query # # COMMIT
# Table should not exist in participant also
SELECT * FROM t2;
ERROR 42S02: Table 'test.t2' doesn't exist
# Verify that the CREATE TABLE t2 query is present in binlog
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
binlog.000001 # Query # # use `test`; CREATE TABLE t1 (
a int,
b int
) ENGINE NDB
binlog.000001 # Query # # BEGIN
binlog.000001 # Table_map # # table_id: # (test.t1)
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
binlog.000001 # Write_rows # # table_id: #
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F
binlog.000001 # Query # # COMMIT
binlog.000001 # Query # # use `test`; CREATE TABLE t2 (
a int,
b int not null
) ENGINE NDB
AS SELECT * FROM t1
#Cleanup
DROP TABLE t1;
|