drop table if exists t1, t2;
create table t1 (n1 int, n2 int, n3 int,
key (n1, n2, n3),
key (n2, n3, n1),
key (n3, n1, n2));
create table t2 (i int);
alter table t1 disable keys;
insert into t1 values (RAND()*1000, RAND()*1000, RAND()*1000);
reset master;
set session debug="+d,sleep_alter_enable_indexes";
alter table t1 enable keys;;
insert into t2 values (1);
insert into t1 values (1, 1, 1);
set session debug="-d,sleep_alter_enable_indexes";
show binlog events in 'master-bin.000001' from 106;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000001	#	Query	1	#	use `test`; insert into t2 values (1)
master-bin.000001	#	Query	1	#	use `test`; alter table t1 enable keys
master-bin.000001	#	Query	1	#	use `test`; insert into t1 values (1, 1, 1)
drop tables t1, t2;
End of 5.0 tests
drop table if exists t1, t2, t3;
create table t1 (i int);
reset master;
set session debug="+d,sleep_alter_before_main_binlog";
alter table t1 change i c char(10) default 'Test1';;
insert into t1 values ();
select * from t1;
c
Test1
alter table t1 change c vc varchar(100) default 'Test2';;
rename table t1 to t2;
drop table t2;
create table t1 (i int);
alter table t1 change i c char(10) default 'Test3', rename to t2;;
insert into t2 values ();
select * from t2;
c
Test3
alter table t2 change c vc varchar(100) default 'Test2', rename to t1;;
rename table t1 to t3;
drop table t3;
set session debug="-d,sleep_alter_before_main_binlog";
show binlog events in 'master-bin.000001' from 106;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000001	#	Query	1	#	use `test`; alter table t1 change i c char(10) default 'Test1'
master-bin.000001	#	Query	1	#	use `test`; insert into t1 values ()
master-bin.000001	#	Query	1	#	use `test`; alter table t1 change c vc varchar(100) default 'Test2'
master-bin.000001	#	Query	1	#	use `test`; rename table t1 to t2
master-bin.000001	#	Query	1	#	use `test`; drop table t2
master-bin.000001	#	Query	1	#	use `test`; create table t1 (i int)
master-bin.000001	#	Query	1	#	use `test`; alter table t1 change i c char(10) default 'Test3', rename to t2
master-bin.000001	#	Query	1	#	use `test`; insert into t2 values ()
master-bin.000001	#	Query	1	#	use `test`; alter table t2 change c vc varchar(100) default 'Test2', rename to t1
master-bin.000001	#	Query	1	#	use `test`; rename table t1 to t3
master-bin.000001	#	Query	1	#	use `test`; drop table t3
End of 5.1 tests
