Commit a9150f00 authored by Sneha Modi's avatar Sneha Modi

Bug#11748731 - 37248: SOME 'BIG' TESTS FAILING ON 6.0:

alter_treable-big.test was failing due to the use of RAND() function which is no more 
replication safe.
This has been modified using static values.

Also, 'sleep' has been replaced using 'debug_sync' and the execution time of the 
test has been reduced significantly.

This test is now taken out of the disabled.def file and is being enabled.
parent 1f746cb0
drop table if exists t1, t2; drop table if exists t1, t2;
set debug_sync='RESET';
create table t1 (n1 int, n2 int, n3 int, create table t1 (n1 int, n2 int, n3 int,
key (n1, n2, n3), key (n1, n2, n3),
key (n2, n3, n1), key (n2, n3, n1),
key (n3, n1, n2)); key (n3, n1, n2));
create table t2 (i int); create table t2 (i int);
alter table t1 disable keys; alter table t1 disable keys;
insert into t1 values (RAND()*1000, RAND()*1000, RAND()*1000); insert into t1 values (1, 2, 3);
reset master; reset master;
set session debug="+d,sleep_alter_enable_indexes"; set debug_sync='alter_table_enable_indexes SIGNAL parked WAIT_FOR go';
alter table t1 enable keys;; alter table t1 enable keys;;
set debug_sync='now WAIT_FOR parked';
insert into t2 values (1); insert into t2 values (1);
insert into t1 values (1, 1, 1); insert into t1 values (1, 1, 1);;
set session debug="-d,sleep_alter_enable_indexes"; set debug_sync='now SIGNAL go';
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t2 values (1) master-bin.000001 # Query # # use `test`; insert into t2 values (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; alter table t1 enable keys master-bin.000001 # Query # # use `test`; alter table t1 enable keys
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values (1, 1, 1) master-bin.000001 # Query # # use `test`; insert into t1 values (1, 1, 1)
master-bin.000001 # Query # # COMMIT
drop tables t1, t2; drop tables t1, t2;
set debug_sync='RESET';
End of 5.0 tests End of 5.0 tests
drop table if exists t1, t2, t3; drop table if exists t1, t2, t3;
create table t1 (i int); create table t1 (i int);
reset master; reset master;
set session debug="+d,sleep_alter_before_main_binlog"; set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
alter table t1 change i c char(10) default 'Test1';; alter table t1 change i c char(10) default 'Test1';;
insert into t1 values (); set debug_sync='now WAIT_FOR parked';
insert into t1 values ();;
set debug_sync='now SIGNAL go';
select * from t1; select * from t1;
c c
Test1 Test1
set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
alter table t1 change c vc varchar(100) default 'Test2';; alter table t1 change c vc varchar(100) default 'Test2';;
rename table t1 to t2; set debug_sync='now WAIT_FOR parked';
rename table t1 to t2;;
set debug_sync='now SIGNAL go';
drop table t2; drop table t2;
create table t1 (i int); create table t1 (i int);
set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
alter table t1 change i c char(10) default 'Test3', rename to t2;; alter table t1 change i c char(10) default 'Test3', rename to t2;;
insert into t2 values (); set debug_sync='now WAIT_FOR parked';
insert into t2 values();;
set debug_sync='now SIGNAL go';
select * from t2; select * from t2;
c c
Test3 Test3
alter table t2 change c vc varchar(100) default 'Test2', rename to t1;; alter table t2 change c vc varchar(100) default 'Test2', rename to t1;;
rename table t1 to t3; rename table t1 to t3;
drop table t3; drop table t3;
set session debug="-d,sleep_alter_before_main_binlog"; set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
set debug_sync='RESET';
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; alter table t1 change i c char(10) default 'Test1' master-bin.000001 # Query # # use `test`; alter table t1 change i c char(10) default 'Test1'
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values () master-bin.000001 # Query # # use `test`; insert into t1 values ()
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; alter table t1 change c vc varchar(100) default 'Test2' master-bin.000001 # Query # # use `test`; alter table t1 change c vc varchar(100) default 'Test2'
master-bin.000001 # Query # # use `test`; rename table t1 to t2 master-bin.000001 # Query # # use `test`; rename table t1 to t2
master-bin.000001 # Query # # use `test`; drop table t2 master-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */
master-bin.000001 # Query # # use `test`; create table t1 (i int) master-bin.000001 # Query # # use `test`; create table t1 (i int)
master-bin.000001 # Query # # use `test`; alter table t1 change i c char(10) default 'Test3', rename to t2 master-bin.000001 # Query # # use `test`; alter table t1 change i c char(10) default 'Test3', rename to t2
master-bin.000001 # Query # # use `test`; insert into t2 values () master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t2 values()
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; alter table t2 change c vc varchar(100) default 'Test2', rename to t1 master-bin.000001 # Query # # use `test`; alter table t2 change c vc varchar(100) default 'Test2', rename to t1
master-bin.000001 # Query # # use `test`; rename table t1 to t3 master-bin.000001 # Query # # use `test`; rename table t1 to t3
master-bin.000001 # Query # # use `test`; drop table t3 master-bin.000001 # Query # # use `test`; DROP TABLE `t3` /* generated by server */
End of 5.1 tests End of 5.1 tests
...@@ -18,7 +18,10 @@ ...@@ -18,7 +18,10 @@
--disable_warnings --disable_warnings
drop table if exists t1, t2; drop table if exists t1, t2;
--enable_warnings --enable_warnings
set debug_sync='RESET';
connect (addconroot, localhost, root,,); connect (addconroot, localhost, root,,);
connect (addconroot2, localhost, root,,);
connection default; connection default;
create table t1 (n1 int, n2 int, n3 int, create table t1 (n1 int, n2 int, n3 int,
key (n1, n2, n3), key (n1, n2, n3),
...@@ -26,38 +29,45 @@ create table t1 (n1 int, n2 int, n3 int, ...@@ -26,38 +29,45 @@ create table t1 (n1 int, n2 int, n3 int,
key (n3, n1, n2)); key (n3, n1, n2));
create table t2 (i int); create table t2 (i int);
# Starting from 5.1 we have runtime settable @@debug variable,
# which can be used for introducing delays at certain points of
# statement execution, so we don't need many rows in 't1' to make
# this test repeatable.
alter table t1 disable keys; alter table t1 disable keys;
--disable_warnings insert into t1 values (1, 2, 3);
insert into t1 values (RAND()*1000, RAND()*1000, RAND()*1000);
--enable_warnings
# Later we use binlog to check the order in which statements are # Later we use binlog to check the order in which statements are
# executed so let us reset it first. # executed so let us reset it first.
reset master; reset master;
set session debug="+d,sleep_alter_enable_indexes"; set debug_sync='alter_table_enable_indexes SIGNAL parked WAIT_FOR go';
--send alter table t1 enable keys; --send alter table t1 enable keys;
connection addconroot; connection addconroot;
--sleep 2 # Wait until ALTER TABLE acquires metadata lock.
set debug_sync='now WAIT_FOR parked';
# This statement should not be blocked by in-flight ALTER and therefore # This statement should not be blocked by in-flight ALTER and therefore
# should be executed and written to binlog before ALTER TABLE ... ENABLE KEYS # should be executed and written to binlog before ALTER TABLE ... ENABLE KEYS
# finishes. # finishes.
insert into t2 values (1); insert into t2 values (1);
# And this should wait until the end of ALTER TABLE ... ENABLE KEYS. # And this should wait until the end of ALTER TABLE ... ENABLE KEYS.
insert into t1 values (1, 1, 1); --send insert into t1 values (1, 1, 1);
connection addconroot2;
# Wait until the above INSERT INTO t1 is blocked due to ALTER
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table metadata lock" and
info = "insert into t1 values (1, 1, 1)";
--source include/wait_condition.inc
# Resume ALTER execution.
set debug_sync='now SIGNAL go';
connection default; connection default;
--reap --reap
set session debug="-d,sleep_alter_enable_indexes"; connection addconroot;
--reap
connection default;
# Check that statements were executed/binlogged in correct order. # Check that statements were executed/binlogged in correct order.
source include/show_binlog_events.inc; source include/show_binlog_events.inc;
# Clean up # Clean up
drop tables t1, t2; drop tables t1, t2;
disconnect addconroot; disconnect addconroot;
disconnect addconroot2;
set debug_sync='RESET';
--echo End of 5.0 tests --echo End of 5.0 tests
...@@ -72,48 +82,92 @@ disconnect addconroot; ...@@ -72,48 +82,92 @@ disconnect addconroot;
--disable_warnings --disable_warnings
drop table if exists t1, t2, t3; drop table if exists t1, t2, t3;
--enable_warnings --enable_warnings
connect (addconroot, localhost, root,,);
connect (addconroot2, localhost, root,,);
connection default;
create table t1 (i int); create table t1 (i int);
# We are going to check that statements are logged in correct order # We are going to check that statements are logged in correct order
reset master; reset master;
set session debug="+d,sleep_alter_before_main_binlog"; set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
--send alter table t1 change i c char(10) default 'Test1'; --send alter table t1 change i c char(10) default 'Test1';
connect (addconroot, localhost, root,,);
connection addconroot; connection addconroot;
--sleep 2 # Wait until ALTER TABLE acquires metadata lock.
insert into t1 values (); set debug_sync='now WAIT_FOR parked';
select * from t1; --send insert into t1 values ();
connection addconroot2;
# Wait until the above INSERT INTO t1 is blocked due to ALTER
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table metadata lock" and
info = "insert into t1 values ()";
--source include/wait_condition.inc
# Resume ALTER execution.
set debug_sync='now SIGNAL go';
connection default; connection default;
--reap --reap
connection addconroot;
--reap
connection default;
select * from t1;
set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
--send alter table t1 change c vc varchar(100) default 'Test2'; --send alter table t1 change c vc varchar(100) default 'Test2';
connection addconroot; connection addconroot;
--sleep 2 # Wait until ALTER TABLE acquires metadata lock.
rename table t1 to t2; set debug_sync='now WAIT_FOR parked';
--send rename table t1 to t2;
connection addconroot2;
# Wait until the above RENAME TABLE is blocked due to ALTER
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
# Resume ALTER execution.
set debug_sync='now SIGNAL go';
connection default; connection default;
--reap --reap
connection addconroot;
--reap
connection default;
drop table t2; drop table t2;
# And now tests for ALTER TABLE with RENAME clause. In this # And now tests for ALTER TABLE with RENAME clause. In this
# case target table name should be properly locked as well. # case target table name should be properly locked as well.
create table t1 (i int); create table t1 (i int);
set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
--send alter table t1 change i c char(10) default 'Test3', rename to t2; --send alter table t1 change i c char(10) default 'Test3', rename to t2;
connection addconroot; connection addconroot;
--sleep 2 # Wait until ALTER TABLE acquires metadata lock.
insert into t2 values (); set debug_sync='now WAIT_FOR parked';
select * from t2; --send insert into t2 values();
connection addconroot2;
# Wait until the above INSERT INTO t2 is blocked due to ALTER
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table metadata lock" and
info = "insert into t2 values()";
--source include/wait_condition.inc
# Resume ALTER execution.
set debug_sync='now SIGNAL go';
connection default; connection default;
--reap --reap
connection addconroot;
--reap
connection default;
select * from t2;
--send alter table t2 change c vc varchar(100) default 'Test2', rename to t1; --send alter table t2 change c vc varchar(100) default 'Test2', rename to t1;
connection addconroot; connection addconroot;
--sleep 2
rename table t1 to t3;
connection default; connection default;
--reap --reap
rename table t1 to t3;
disconnect addconroot; disconnect addconroot;
disconnect addconroot2;
drop table t3; drop table t3;
set session debug="-d,sleep_alter_before_main_binlog"; set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
set debug_sync='RESET';
# Check that all statements were logged in correct order # Check that all statements were logged in correct order
source include/show_binlog_events.inc; source include/show_binlog_events.inc;
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
lowercase_table3 : Bug#11762269 2010-06-30 alik main.lowercase_table3 on Mac OSX lowercase_table3 : Bug#11762269 2010-06-30 alik main.lowercase_table3 on Mac OSX
read_many_rows_innodb : Bug#11748886 2010-11-15 mattiasj report already exists read_many_rows_innodb : Bug#11748886 2010-11-15 mattiasj report already exists
sum_distinct-big : Bug#11764126 2010-11-15 mattiasj was not tested sum_distinct-big : Bug#11764126 2010-11-15 mattiasj was not tested
alter_table-big : Bug#11748731 2010-11-15 mattiasj was not tested
create-big : Bug#11748731 2010-11-15 mattiasj was not tested create-big : Bug#11748731 2010-11-15 mattiasj was not tested
archive-big : Bug#11817185 2011-03-10 Anitha Disabled since this leads to timeout on Solaris Sparc archive-big : Bug#11817185 2011-03-10 Anitha Disabled since this leads to timeout on Solaris Sparc
log_tables-big : Bug#11756699 2010-11-15 mattiasj report already exists log_tables-big : Bug#11756699 2010-11-15 mattiasj report already exists
......
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