1
drop table if exists t1, t2;
2
create table t1 (n1 int, n2 int, n3 int,
6
create table t2 (i int);
7
alter table t1 disable keys;
8
insert into t1 values (RAND()*1000, RAND()*1000, RAND()*1000);
10
set session debug="+d,sleep_alter_enable_indexes";
11
alter table t1 enable keys;;
12
insert into t2 values (1);
13
insert into t1 values (1, 1, 1);
14
set session debug="-d,sleep_alter_enable_indexes";
15
show binlog events in 'master-bin.000001' from 106;
16
Log_name Pos Event_type Server_id End_log_pos Info
17
master-bin.000001 # Query 1 # use `test`; insert into t2 values (1)
18
master-bin.000001 # Query 1 # use `test`; alter table t1 enable keys
19
master-bin.000001 # Query 1 # use `test`; insert into t1 values (1, 1, 1)
22
drop table if exists t1, t2, t3;
23
create table t1 (i int);
25
set session debug="+d,sleep_alter_before_main_binlog";
26
alter table t1 change i c char(10) default 'Test1';;
27
insert into t1 values ();
31
alter table t1 change c vc varchar(100) default 'Test2';;
32
rename table t1 to t2;
34
create table t1 (i int);
35
alter table t1 change i c char(10) default 'Test3', rename to t2;;
36
insert into t2 values ();
40
alter table t2 change c vc varchar(100) default 'Test2', rename to t1;;
41
rename table t1 to t3;
43
set session debug="-d,sleep_alter_before_main_binlog";
44
show binlog events in 'master-bin.000001' from 106;
45
Log_name Pos Event_type Server_id End_log_pos Info
46
master-bin.000001 # Query 1 # use `test`; alter table t1 change i c char(10) default 'Test1'
47
master-bin.000001 # Query 1 # use `test`; insert into t1 values ()
48
master-bin.000001 # Query 1 # use `test`; alter table t1 change c vc varchar(100) default 'Test2'
49
master-bin.000001 # Query 1 # use `test`; rename table t1 to t2
50
master-bin.000001 # Query 1 # use `test`; drop table t2
51
master-bin.000001 # Query 1 # use `test`; create table t1 (i int)
52
master-bin.000001 # Query 1 # use `test`; alter table t1 change i c char(10) default 'Test3', rename to t2
53
master-bin.000001 # Query 1 # use `test`; insert into t2 values ()
54
master-bin.000001 # Query 1 # use `test`; alter table t2 change c vc varchar(100) default 'Test2', rename to t1
55
master-bin.000001 # Query 1 # use `test`; rename table t1 to t3
56
master-bin.000001 # Query 1 # use `test`; drop table t3