2006-11-03 16:31:25 +01:00
|
|
|
#################################################
|
|
|
|
# Author: Jeb
|
|
|
|
# Date: 2006-09-07
|
|
|
|
# Purpose: To test having extra columns on the slave.
|
|
|
|
##################################################
|
|
|
|
|
2007-04-25 21:33:18 +02:00
|
|
|
# Some tests in here requre partitioning
|
|
|
|
-- source include/have_partition.inc
|
|
|
|
|
2006-11-03 16:31:25 +01:00
|
|
|
########### Clean up ################
|
|
|
|
--disable_warnings
|
|
|
|
--disable_query_log
|
2007-07-17 22:49:07 +02:00
|
|
|
DROP TABLE IF EXISTS t1, t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t14a,t15,t16,t17;
|
2006-11-03 16:31:25 +01:00
|
|
|
--enable_query_log
|
|
|
|
--enable_warnings
|
|
|
|
|
|
|
|
#################################################
|
|
|
|
############ Different Table Def Test ###########
|
|
|
|
#################################################
|
|
|
|
# Purpose: To have different table def on the #
|
|
|
|
# master and slave. Most of these tests#
|
|
|
|
# should stop the slave. #
|
|
|
|
#################################################
|
|
|
|
|
|
|
|
--echo **** Diff Table Def Start ****
|
|
|
|
|
|
|
|
##############################################
|
|
|
|
### Try to replicate w/ PK on diff columns ###
|
|
|
|
### Should Stop Slave ###
|
|
|
|
##############################################
|
|
|
|
|
|
|
|
--echo *** On Slave ***
|
|
|
|
sync_slave_with_master;
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
|
|
|
|
eval CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20),
|
|
|
|
d FLOAT DEFAULT '2.00',
|
|
|
|
e CHAR(4) DEFAULT 'TEST')
|
|
|
|
ENGINE=$engine_type;
|
|
|
|
|
|
|
|
--echo *** Create t1 on Master ***
|
|
|
|
connection master;
|
|
|
|
eval CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c CHAR(10)
|
|
|
|
) ENGINE=$engine_type;
|
|
|
|
|
|
|
|
RESET MASTER;
|
|
|
|
|
|
|
|
--echo *** Start Slave ***
|
|
|
|
connection slave;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Master Data Insert ***
|
|
|
|
connection master;
|
|
|
|
|
|
|
|
INSERT INTO t1 () VALUES(1,2,'TEXAS'),(2,1,'AUSTIN'),(3,4,'QA');
|
|
|
|
SELECT * FROM t1 ORDER BY a;
|
|
|
|
|
|
|
|
--echo *** Select from slave ***
|
|
|
|
sync_slave_with_master;
|
|
|
|
SELECT * FROM t1 ORDER BY a;
|
|
|
|
|
|
|
|
--echo *** Drop t1 ***
|
|
|
|
connection master;
|
|
|
|
DROP TABLE t1;
|
|
|
|
sync_slave_with_master;
|
|
|
|
|
|
|
|
############################################
|
|
|
|
### Try to replicate CHAR(10) to CHAR(5) ###
|
|
|
|
### Should Stop Slave or truncate value ###
|
|
|
|
############################################
|
|
|
|
|
|
|
|
## BUG22086
|
2007-08-10 18:48:01 +02:00
|
|
|
--echo *** Create t2 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
eval CREATE TABLE t2 (a INT, b INT PRIMARY KEY, c CHAR(5),
|
|
|
|
d FLOAT DEFAULT '2.00',
|
|
|
|
e CHAR(5) DEFAULT 'TEST2')
|
|
|
|
ENGINE=$engine_type;
|
2006-11-03 16:31:25 +01:00
|
|
|
|
2007-08-10 18:48:01 +02:00
|
|
|
--echo *** Create t2 on Master ***
|
|
|
|
connection master;
|
|
|
|
eval CREATE TABLE t2 (a INT PRIMARY KEY, b INT, c CHAR(10)
|
|
|
|
) ENGINE=$engine_type;
|
|
|
|
RESET MASTER;
|
2006-11-03 16:31:25 +01:00
|
|
|
|
2007-08-10 18:48:01 +02:00
|
|
|
--echo *** Master Data Insert ***
|
|
|
|
connection master;
|
|
|
|
|
|
|
|
INSERT INTO t2 () VALUES(1,2,'Kyle, TEX'),(2,1,'JOE AUSTIN'),(3,4,'QA TESTING');
|
|
|
|
SELECT * FROM t2 ORDER BY a;
|
|
|
|
|
|
|
|
--echo *** Start Slave ***
|
|
|
|
connection slave;
|
|
|
|
START SLAVE;
|
BUG#37975: wait_for_slave_* should increase the timeout
Problem 1: tests often fail in pushbuild with a timeout when waiting
for the slave to start/stop/receive error.
Fix 1: Updated the wait_for_slave_* macros in the following way:
- The timeout is increased by a factor ten
- Refactored the macros so that wait_for_slave_param does the work for
the other macros.
Problem 2: Tests are often incorrectly written, lacking a
source include/wait_for_slave_to_[start|stop].inc.
Fix 2: Improved the chance to get it right by adding
include/start_slave.inc and include/stop_slave.inc, and updated tests
to use these.
Problem 3: The the built-in test language command
wait_for_slave_to_stop is a misnomer (does not wait for the slave io
thread) and does not give as much debug info in case of failure as
the otherwise equivalent macro
source include/wait_for_slave_sql_to_stop.inc
Fix 3: Replaced all calls to the built-in command by a call to the
macro.
Problem 4: Some, but not all, of the wait_for_slave_* macros had an
implicit connection slave. This made some tests confusing to read,
and made it more difficult to use the macro in circular replication
scenarios, where the connection named master needs to wait.
Fix 4: Removed the implicit connection slave from all
wait_for_slave_* macros, and updated tests to use an explicit
connection slave where necessary.
Problem 5: The macros wait_slave_status.inc and wait_show_pattern.inc
were unused. Moreover, using them is difficult and error-prone.
Fix 5: remove these macros.
Problem 6: log_bin_trust_function_creators_basic failed when running
tests because it assumed @@global.log_bin_trust_function_creators=1,
and some tests modified this variable without resetting it to its
original value.
Fix 6: All tests that use this variable have been updated so that
they reset the value at end of test.
mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test:
Replaced wait_for_slave_to_stop by include/wait_for_slave_sql_to_stop.inc
mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test:
Replaced wait_for_slave_to_stop by include/wait_for_slave_sql_to_stop.inc
Added connection slave since includ/wait_for_slave_sql_to_stop.inc
does not do that anymore.
mysql-test/extra/rpl_tests/rpl_log.test:
Replaced start slave+wait_slave_status by start_slave.inc
mysql-test/include/reset_master_and_slave.inc:
replaced start/stop slave by start_slave.inc/stop_slave.inc
mysql-test/include/sync_slave_io_with_master.inc:
Improved comments and error message.
mysql-test/include/wait_for_slave_io_to_stop.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_for_slave_param.inc:
- Improved usage instructions
- Added more debug info in case of timeout
- Added parameters $slave_param_comparison, $slave_timeout,
$slave_keep_connection, $slave_error_message
mysql-test/include/wait_for_slave_sql_error.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_for_slave_sql_to_start.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_for_slave_sql_to_stop.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_for_slave_to_start.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_for_slave_to_stop.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_show_pattern.inc:
Removed unused (and error-prone) file
mysql-test/include/wait_slave_status.inc:
Removed unused (and error-prone) file
mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test:
Renamed $keep_connection to $slave_keep_connection.
mysql-test/suite/rpl/t/rpl_bug26395.test:
Replace stop slave by stop_slave.inc
mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test:
Replace start/stop slave by start_slave.inc/stop_slave.inc.
Replace wait_for_slave_param by wait_for_slave_sql_to_stop.inc.
mysql-test/suite/rpl/t/rpl_dual_pos_advance.test:
Renamed $keep_connection to $slave_keep_connection.
mysql-test/suite/rpl/t/rpl_flushlog_loop.test:
Replace wait_slave_status by start_slave.inc
mysql-test/suite/rpl/t/rpl_idempotency.test:
Added connection slave since wait_for_slave_sql_to_stop.inc does not
do that any more.
mysql-test/suite/rpl/t/rpl_incident.test:
Replaced wait_for_slave_to_stop by wait_for_slave_sql_to_stop.inc
mysql-test/suite/rpl/t/rpl_init_slave.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
Replaced save_master_pos;connection slave;sync_with_master by
sync_slave_with_master.
mysql-test/suite/rpl/t/rpl_log_pos.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
Replaced wait_for_slave_param by other wait_for_slave_* macros.
mysql-test/suite/rpl/t/rpl_packet.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_row_until.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
Replaced save_master_pos;connection slave;sync_with_master by
sync_slave_with_master.
mysql-test/suite/rpl/t/rpl_server_id1.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_slave_grp_exec.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_slave_skip.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_slave_status.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_sp.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/suite/rpl/t/rpl_sp_effects.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/suite/rpl/t/rpl_stm_until.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
Replaced save_master_pos;connection slave;sync_with_master by
sync_slave_with_master.
mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test:
Replaced start slave by start_slave.inc.
Added explicit connection slave since wait_for_slave_sql_to_stop.inc
does not do that anymore.
mysql-test/t/disabled.def:
Disabled failing test.
mysql-test/t/func_time.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/grant.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/grant2.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/innodb_notembedded.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/log_bin_trust_function_creators_func.test:
Restore @@global.log_bin_trust_function_creators at end of test.
Clean up at end of test by dropping the created user.
mysql-test/t/query_cache.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/query_cache_notembedded.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/rpl_init_slave_func.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/t/timezone2.test:
Restore @@global.log_bin_trust_function_creators at end of test.
2008-07-10 18:09:39 +02:00
|
|
|
source include/wait_for_slave_sql_to_stop.inc;
|
2007-08-10 18:48:01 +02:00
|
|
|
--replace_result $MASTER_MYPORT MASTER_PORT
|
|
|
|
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
|
|
|
|
--query_vertical SHOW SLAVE STATUS
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
SELECT * FROM t2 ORDER BY a;
|
|
|
|
|
|
|
|
connection master;
|
|
|
|
RESET MASTER;
|
|
|
|
|
|
|
|
connection slave;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Drop t2 ***
|
|
|
|
connection master;
|
|
|
|
DROP TABLE t2;
|
|
|
|
sync_slave_with_master;
|
2006-11-03 16:31:25 +01:00
|
|
|
|
|
|
|
####################################
|
|
|
|
### Try to replicate BLOB to INT ###
|
|
|
|
### Should Stop Slave ###
|
|
|
|
####################################
|
|
|
|
--echo *** Create t3 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
eval CREATE TABLE t3 (a INT, b INT PRIMARY KEY, c CHAR(20),
|
|
|
|
d FLOAT DEFAULT '2.00',
|
|
|
|
e CHAR(5) DEFAULT 'TEST2')
|
|
|
|
ENGINE=$engine_type;
|
|
|
|
|
|
|
|
--echo *** Create t3 on Master ***
|
|
|
|
connection master;
|
|
|
|
eval CREATE TABLE t3 (a BLOB, b INT PRIMARY KEY, c CHAR(20)
|
|
|
|
) ENGINE=$engine_type;
|
|
|
|
RESET MASTER;
|
|
|
|
|
|
|
|
--echo *** Start Slave ***
|
|
|
|
connection slave;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Master Data Insert ***
|
|
|
|
connection master;
|
|
|
|
|
|
|
|
set @b1 = 'b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
|
|
|
|
INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TESTING');
|
|
|
|
|
|
|
|
--echo ********************************************
|
|
|
|
--echo *** Expect slave to fail with Error 1522 ***
|
|
|
|
--echo ********************************************
|
|
|
|
connection slave;
|
2007-06-13 05:52:43 +02:00
|
|
|
--source include/wait_for_slave_sql_to_stop.inc
|
2006-11-03 16:31:25 +01:00
|
|
|
--replace_result $MASTER_MYPORT MASTER_PORT
|
2007-08-10 18:48:01 +02:00
|
|
|
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
|
2006-11-03 16:31:25 +01:00
|
|
|
--query_vertical SHOW SLAVE STATUS
|
|
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Drop t3 ***
|
|
|
|
connection master;
|
|
|
|
DROP TABLE t3;
|
|
|
|
sync_slave_with_master;
|
|
|
|
|
|
|
|
#####################################################
|
|
|
|
# Columns with different types, more columns at end #
|
|
|
|
# Expect: proper error message (wrong types) #
|
|
|
|
#####################################################
|
|
|
|
|
|
|
|
--echo *** Create t4 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
eval CREATE TABLE t4 (a INT, b INT PRIMARY KEY, c CHAR(20),
|
|
|
|
d FLOAT DEFAULT '2.00',
|
|
|
|
e CHAR(5) DEFAULT 'TEST2')
|
|
|
|
ENGINE=$engine_type;
|
|
|
|
|
|
|
|
--echo *** Create t4 on Master ***
|
|
|
|
connection master;
|
|
|
|
eval CREATE TABLE t4 (a DECIMAL(8,2), b INT PRIMARY KEY, c CHAR(20)
|
|
|
|
) ENGINE=$engine_type;
|
|
|
|
RESET MASTER;
|
|
|
|
|
|
|
|
--echo *** Start Slave ***
|
|
|
|
connection slave;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Master Data Insert ***
|
|
|
|
connection master;
|
|
|
|
|
|
|
|
INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
|
|
|
|
(30000.22,4,'QA TESTING');
|
|
|
|
|
|
|
|
--echo ********************************************
|
|
|
|
--echo *** Expect slave to fail with Error 1522 ***
|
|
|
|
--echo ********************************************
|
|
|
|
connection slave;
|
2007-06-13 05:52:43 +02:00
|
|
|
--source include/wait_for_slave_sql_to_stop.inc
|
2006-11-03 16:31:25 +01:00
|
|
|
--replace_result $MASTER_MYPORT MASTER_PORT
|
2007-08-10 18:48:01 +02:00
|
|
|
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
|
2006-11-03 16:31:25 +01:00
|
|
|
--query_vertical SHOW SLAVE STATUS
|
|
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Drop t4 ***
|
|
|
|
connection master;
|
|
|
|
DROP TABLE t4;
|
|
|
|
sync_slave_with_master;
|
|
|
|
|
|
|
|
#######################################################
|
|
|
|
# Columns with different types, same number of colums #
|
|
|
|
# Expect: Proper error message #
|
|
|
|
#######################################################
|
|
|
|
|
|
|
|
--echo *** Create t5 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
eval CREATE TABLE t5 (a INT PRIMARY KEY, b CHAR(5),
|
|
|
|
c FLOAT, d INT, e DOUBLE,
|
|
|
|
f DECIMAL(8,2))ENGINE=$engine_type;
|
|
|
|
|
|
|
|
--echo *** Create t5 on Master ***
|
|
|
|
connection master;
|
|
|
|
eval CREATE TABLE t5 (a INT PRIMARY KEY, b VARCHAR(6),
|
|
|
|
c DECIMAL(8,2), d BIT, e BLOB,
|
|
|
|
f FLOAT) ENGINE=$engine_type;
|
|
|
|
RESET MASTER;
|
|
|
|
|
|
|
|
--echo *** Start Slave ***
|
|
|
|
connection slave;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Master Data Insert ***
|
|
|
|
connection master;
|
|
|
|
|
|
|
|
INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
|
|
|
|
(2,'JOE',300.01,0,'b2b2',1.0000009);
|
|
|
|
|
|
|
|
--echo ********************************************
|
|
|
|
--echo *** Expect slave to fail with Error 1522 ***
|
|
|
|
--echo ********************************************
|
|
|
|
connection slave;
|
2007-06-13 05:52:43 +02:00
|
|
|
--source include/wait_for_slave_sql_to_stop.inc
|
2006-11-03 16:31:25 +01:00
|
|
|
--replace_result $MASTER_MYPORT MASTER_PORT
|
2007-08-10 18:48:01 +02:00
|
|
|
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
|
2006-11-03 16:31:25 +01:00
|
|
|
--query_vertical SHOW SLAVE STATUS
|
|
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Drop t5 ***
|
|
|
|
connection master;
|
|
|
|
DROP TABLE t5;
|
|
|
|
sync_slave_with_master;
|
|
|
|
|
|
|
|
#######################################################
|
|
|
|
################## Continued ##########################
|
|
|
|
#######################################################
|
|
|
|
# Columns with different types, same number of colums #
|
|
|
|
# Expect: Proper error message #
|
|
|
|
#######################################################
|
|
|
|
|
|
|
|
--echo *** Create t6 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
eval CREATE TABLE t6 (a INT PRIMARY KEY, b CHAR(5),
|
|
|
|
c FLOAT, d INT)ENGINE=$engine_type;
|
|
|
|
|
|
|
|
--echo *** Create t6 on Master ***
|
|
|
|
connection master;
|
|
|
|
eval CREATE TABLE t6 (a INT PRIMARY KEY, b VARCHAR(6),
|
|
|
|
c DECIMAL(8,2), d BIT
|
|
|
|
) ENGINE=$engine_type;
|
|
|
|
RESET MASTER;
|
|
|
|
|
|
|
|
--echo *** Start Slave ***
|
|
|
|
connection slave;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Master Data Insert ***
|
|
|
|
connection master;
|
|
|
|
|
|
|
|
INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
|
|
|
|
(2,'JOE',300.01,0);
|
|
|
|
|
|
|
|
--echo ********************************************
|
|
|
|
--echo *** Expect slave to fail with Error 1522 ***
|
|
|
|
--echo ********************************************
|
|
|
|
connection slave;
|
2007-06-13 05:52:43 +02:00
|
|
|
--source include/wait_for_slave_sql_to_stop.inc
|
2006-11-03 16:31:25 +01:00
|
|
|
--replace_result $MASTER_MYPORT MASTER_PORT
|
2007-08-10 18:48:01 +02:00
|
|
|
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
|
2006-11-03 16:31:25 +01:00
|
|
|
--query_vertical SHOW SLAVE STATUS
|
|
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
|
|
|
|
#START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Drop t6 ***
|
|
|
|
connection master;
|
|
|
|
DROP TABLE t6;
|
|
|
|
connection slave;
|
|
|
|
DROP TABLE t6;
|
|
|
|
START SLAVE;
|
|
|
|
#sync_slave_with_master;
|
|
|
|
|
|
|
|
|
|
|
|
--echo **** Diff Table Def End ****
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
#### Extra Column on Slave Testing ####
|
|
|
|
#######################################
|
|
|
|
# Purpose: To test extra colums on the#
|
|
|
|
# Slave #
|
|
|
|
#######################################
|
|
|
|
|
|
|
|
--echo **** Extra Colums Start ****
|
|
|
|
|
|
|
|
##########################################
|
|
|
|
# More columns in slave at end of table, #
|
|
|
|
# added columns have default values #
|
|
|
|
# Expect: it should work, default values #
|
|
|
|
# should be used #
|
|
|
|
##########################################
|
|
|
|
|
|
|
|
--echo *** Create t7 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
eval CREATE TABLE t7 (a INT KEY, b BLOB, c CHAR(5),
|
|
|
|
d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00',
|
|
|
|
e CHAR(20) DEFAULT 'Extra Column Testing')
|
|
|
|
ENGINE=$engine_type;
|
|
|
|
|
|
|
|
--echo *** Create t7 on Master ***
|
|
|
|
connection master;
|
|
|
|
eval CREATE TABLE t7 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
|
|
|
|
) ENGINE=$engine_type;
|
|
|
|
RESET MASTER;
|
|
|
|
|
|
|
|
--echo *** Start Slave ***
|
|
|
|
connection slave;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Master Data Insert ***
|
|
|
|
connection master;
|
|
|
|
set @b1 = 'b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t7 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
|
|
|
SELECT * FROM t7 ORDER BY a;
|
|
|
|
|
|
|
|
--echo *** Select from slave ***
|
|
|
|
sync_slave_with_master;
|
|
|
|
SELECT * FROM t7 ORDER BY a;
|
|
|
|
|
|
|
|
--echo *** Drop t7 ***
|
|
|
|
connection master;
|
|
|
|
DROP TABLE t7;
|
|
|
|
sync_slave_with_master;
|
|
|
|
|
|
|
|
###########################################
|
|
|
|
# More columns in slave at end of table, #
|
|
|
|
# added columns do not have default values#
|
|
|
|
# Expect: Proper error message #
|
|
|
|
###########################################
|
|
|
|
# NOTE: This should fail but currently #
|
|
|
|
# works. BUG#22101 #
|
|
|
|
###########################################
|
|
|
|
--echo *** Create t8 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
eval CREATE TABLE t8 (a INT KEY, b BLOB, c CHAR(5),
|
|
|
|
d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00',
|
|
|
|
e INT)ENGINE=$engine_type;
|
|
|
|
|
|
|
|
--echo *** Create t8 on Master ***
|
|
|
|
connection master;
|
|
|
|
eval CREATE TABLE t8 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
|
|
|
|
) ENGINE=$engine_type;
|
|
|
|
RESET MASTER;
|
|
|
|
|
|
|
|
--echo *** Start Slave ***
|
|
|
|
connection slave;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Master Data Insert ***
|
|
|
|
connection master;
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t8 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
|
|
|
|
|
|
|
### Uncomment once bug is fixed
|
|
|
|
|
|
|
|
#connection slave;
|
|
|
|
#wait_for_slave_to_stop;
|
|
|
|
#--replace_result $MASTER_MYPORT MASTER_PORT
|
2007-08-10 18:48:01 +02:00
|
|
|
#--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
|
2006-11-03 16:31:25 +01:00
|
|
|
#--query_vertical SHOW SLAVE STATUS
|
|
|
|
#SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
|
|
|
#START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Drop t8 ***
|
|
|
|
connection master;
|
|
|
|
DROP TABLE t8;
|
|
|
|
sync_slave_with_master;
|
|
|
|
|
|
|
|
###########################################
|
|
|
|
############# Continued ###################
|
|
|
|
# More columns in slave at end of table, #
|
|
|
|
# added columns do not have default values#
|
|
|
|
# Expect: Proper error message #
|
|
|
|
###########################################
|
2008-03-06 19:32:47 +01:00
|
|
|
# Bug#22234, Bug#23907 Extra Slave Col is not
|
|
|
|
# erroring on extra col with no default values.
|
2006-11-03 16:31:25 +01:00
|
|
|
########################################################
|
|
|
|
#--echo *** Create t9 on slave ***
|
2008-03-06 19:32:47 +01:00
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
eval CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5),
|
|
|
|
d TIMESTAMP,
|
|
|
|
e INT NOT NULL) ENGINE=$engine_type;
|
2006-11-03 16:31:25 +01:00
|
|
|
|
2008-03-06 19:32:47 +01:00
|
|
|
--echo *** Create t9 on Master ***
|
|
|
|
connection master;
|
|
|
|
eval CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
|
|
|
|
) ENGINE=$engine_type;
|
|
|
|
RESET MASTER;
|
2006-11-03 16:31:25 +01:00
|
|
|
|
2008-03-06 19:32:47 +01:00
|
|
|
--echo *** Start Slave ***
|
|
|
|
connection slave;
|
|
|
|
START SLAVE;
|
2006-11-03 16:31:25 +01:00
|
|
|
|
2008-03-06 19:32:47 +01:00
|
|
|
--echo *** Master Data Insert ***
|
|
|
|
connection master;
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
2006-11-03 16:31:25 +01:00
|
|
|
|
BUG#37975: wait_for_slave_* should increase the timeout
Problem 1: tests often fail in pushbuild with a timeout when waiting
for the slave to start/stop/receive error.
Fix 1: Updated the wait_for_slave_* macros in the following way:
- The timeout is increased by a factor ten
- Refactored the macros so that wait_for_slave_param does the work for
the other macros.
Problem 2: Tests are often incorrectly written, lacking a
source include/wait_for_slave_to_[start|stop].inc.
Fix 2: Improved the chance to get it right by adding
include/start_slave.inc and include/stop_slave.inc, and updated tests
to use these.
Problem 3: The the built-in test language command
wait_for_slave_to_stop is a misnomer (does not wait for the slave io
thread) and does not give as much debug info in case of failure as
the otherwise equivalent macro
source include/wait_for_slave_sql_to_stop.inc
Fix 3: Replaced all calls to the built-in command by a call to the
macro.
Problem 4: Some, but not all, of the wait_for_slave_* macros had an
implicit connection slave. This made some tests confusing to read,
and made it more difficult to use the macro in circular replication
scenarios, where the connection named master needs to wait.
Fix 4: Removed the implicit connection slave from all
wait_for_slave_* macros, and updated tests to use an explicit
connection slave where necessary.
Problem 5: The macros wait_slave_status.inc and wait_show_pattern.inc
were unused. Moreover, using them is difficult and error-prone.
Fix 5: remove these macros.
Problem 6: log_bin_trust_function_creators_basic failed when running
tests because it assumed @@global.log_bin_trust_function_creators=1,
and some tests modified this variable without resetting it to its
original value.
Fix 6: All tests that use this variable have been updated so that
they reset the value at end of test.
mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test:
Replaced wait_for_slave_to_stop by include/wait_for_slave_sql_to_stop.inc
mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test:
Replaced wait_for_slave_to_stop by include/wait_for_slave_sql_to_stop.inc
Added connection slave since includ/wait_for_slave_sql_to_stop.inc
does not do that anymore.
mysql-test/extra/rpl_tests/rpl_log.test:
Replaced start slave+wait_slave_status by start_slave.inc
mysql-test/include/reset_master_and_slave.inc:
replaced start/stop slave by start_slave.inc/stop_slave.inc
mysql-test/include/sync_slave_io_with_master.inc:
Improved comments and error message.
mysql-test/include/wait_for_slave_io_to_stop.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_for_slave_param.inc:
- Improved usage instructions
- Added more debug info in case of timeout
- Added parameters $slave_param_comparison, $slave_timeout,
$slave_keep_connection, $slave_error_message
mysql-test/include/wait_for_slave_sql_error.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_for_slave_sql_to_start.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_for_slave_sql_to_stop.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_for_slave_to_start.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_for_slave_to_stop.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_show_pattern.inc:
Removed unused (and error-prone) file
mysql-test/include/wait_slave_status.inc:
Removed unused (and error-prone) file
mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test:
Renamed $keep_connection to $slave_keep_connection.
mysql-test/suite/rpl/t/rpl_bug26395.test:
Replace stop slave by stop_slave.inc
mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test:
Replace start/stop slave by start_slave.inc/stop_slave.inc.
Replace wait_for_slave_param by wait_for_slave_sql_to_stop.inc.
mysql-test/suite/rpl/t/rpl_dual_pos_advance.test:
Renamed $keep_connection to $slave_keep_connection.
mysql-test/suite/rpl/t/rpl_flushlog_loop.test:
Replace wait_slave_status by start_slave.inc
mysql-test/suite/rpl/t/rpl_idempotency.test:
Added connection slave since wait_for_slave_sql_to_stop.inc does not
do that any more.
mysql-test/suite/rpl/t/rpl_incident.test:
Replaced wait_for_slave_to_stop by wait_for_slave_sql_to_stop.inc
mysql-test/suite/rpl/t/rpl_init_slave.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
Replaced save_master_pos;connection slave;sync_with_master by
sync_slave_with_master.
mysql-test/suite/rpl/t/rpl_log_pos.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
Replaced wait_for_slave_param by other wait_for_slave_* macros.
mysql-test/suite/rpl/t/rpl_packet.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_row_until.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
Replaced save_master_pos;connection slave;sync_with_master by
sync_slave_with_master.
mysql-test/suite/rpl/t/rpl_server_id1.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_slave_grp_exec.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_slave_skip.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_slave_status.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_sp.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/suite/rpl/t/rpl_sp_effects.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/suite/rpl/t/rpl_stm_until.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
Replaced save_master_pos;connection slave;sync_with_master by
sync_slave_with_master.
mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test:
Replaced start slave by start_slave.inc.
Added explicit connection slave since wait_for_slave_sql_to_stop.inc
does not do that anymore.
mysql-test/t/disabled.def:
Disabled failing test.
mysql-test/t/func_time.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/grant.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/grant2.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/innodb_notembedded.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/log_bin_trust_function_creators_func.test:
Restore @@global.log_bin_trust_function_creators at end of test.
Clean up at end of test by dropping the created user.
mysql-test/t/query_cache.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/query_cache_notembedded.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/rpl_init_slave_func.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/t/timezone2.test:
Restore @@global.log_bin_trust_function_creators at end of test.
2008-07-10 18:09:39 +02:00
|
|
|
connection slave;
|
2008-03-06 19:32:47 +01:00
|
|
|
--source include/wait_for_slave_sql_to_stop.inc
|
|
|
|
--replace_result $MASTER_MYPORT MASTER_PORT
|
|
|
|
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
|
|
|
|
--query_vertical SHOW SLAVE STATUS
|
|
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
|
|
|
START SLAVE;
|
2006-11-03 16:31:25 +01:00
|
|
|
|
|
|
|
#--echo *** Drop t9 ***
|
|
|
|
#connection master;
|
|
|
|
#DROP TABLE t9;
|
|
|
|
#sync_slave_with_master;
|
|
|
|
|
|
|
|
############################################
|
|
|
|
# More columns in slave at middle of table #
|
|
|
|
# Expect: Proper error message #
|
|
|
|
############################################
|
|
|
|
--echo *** Create t10 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
eval CREATE TABLE t10 (a INT KEY, b BLOB, f DOUBLE DEFAULT '233',
|
|
|
|
c CHAR(5), e INT DEFAULT '1')ENGINE=$engine_type;
|
|
|
|
|
|
|
|
--echo *** Create t10 on Master ***
|
|
|
|
connection master;
|
|
|
|
eval CREATE TABLE t10 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
|
|
|
|
) ENGINE=$engine_type;
|
|
|
|
RESET MASTER;
|
|
|
|
|
|
|
|
--echo *** Start Slave ***
|
|
|
|
connection slave;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Master Data Insert ***
|
|
|
|
connection master;
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
|
|
|
|
|
|
|
--echo ********************************************
|
|
|
|
--echo *** Expect slave to fail with Error 1522 ***
|
|
|
|
--echo ********************************************
|
|
|
|
connection slave;
|
2007-06-13 05:52:43 +02:00
|
|
|
--source include/wait_for_slave_sql_to_stop.inc
|
2006-11-03 16:31:25 +01:00
|
|
|
--replace_result $MASTER_MYPORT MASTER_PORT
|
2007-08-10 18:48:01 +02:00
|
|
|
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
|
2006-11-03 16:31:25 +01:00
|
|
|
--query_vertical SHOW SLAVE STATUS
|
|
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Drop t10 ***
|
|
|
|
connection master;
|
|
|
|
DROP TABLE t10;
|
|
|
|
sync_slave_with_master;
|
|
|
|
|
|
|
|
############################################
|
|
|
|
############## Continued ###################
|
|
|
|
############################################
|
|
|
|
# More columns in slave at middle of table #
|
|
|
|
# Expect: Proper error message #
|
|
|
|
############################################
|
|
|
|
--echo *** Create t11 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
eval CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
|
|
|
|
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE=$engine_type;
|
|
|
|
|
|
|
|
--echo *** Create t11 on Master ***
|
|
|
|
connection master;
|
|
|
|
eval CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
|
|
|
|
) ENGINE=$engine_type;
|
|
|
|
RESET MASTER;
|
|
|
|
|
|
|
|
--echo *** Start Slave ***
|
|
|
|
connection slave;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Master Data Insert ***
|
|
|
|
connection master;
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
|
|
|
|
|
|
|
--echo ********************************************
|
|
|
|
--echo *** Expect slave to fail with Error 1522 ***
|
|
|
|
--echo ********************************************
|
|
|
|
connection slave;
|
2007-06-13 05:52:43 +02:00
|
|
|
--source include/wait_for_slave_sql_to_stop.inc
|
2006-11-03 16:31:25 +01:00
|
|
|
--replace_result $MASTER_MYPORT MASTER_PORT
|
2007-08-10 18:48:01 +02:00
|
|
|
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
|
2006-11-03 16:31:25 +01:00
|
|
|
--query_vertical SHOW SLAVE STATUS
|
|
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Drop t11 ***
|
|
|
|
connection master;
|
|
|
|
DROP TABLE t11;
|
|
|
|
sync_slave_with_master;
|
|
|
|
|
|
|
|
############################################
|
|
|
|
############## Continued ###################
|
|
|
|
############################################
|
|
|
|
# More columns in slave at middle of table #
|
|
|
|
# Expect: This one should pass blob-text #
|
|
|
|
############################################
|
|
|
|
--echo *** Create t12 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
eval CREATE TABLE t12 (a INT KEY, b BLOB, f TEXT,
|
|
|
|
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE=$engine_type;
|
|
|
|
|
|
|
|
--echo *** Create t12 on Master ***
|
|
|
|
connection master;
|
|
|
|
eval CREATE TABLE t12 (a INT PRIMARY KEY, b BLOB, c BLOB
|
|
|
|
) ENGINE=$engine_type;
|
|
|
|
RESET MASTER;
|
|
|
|
|
|
|
|
--echo *** Start Slave ***
|
|
|
|
connection slave;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Master Data Insert ***
|
|
|
|
connection master;
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t12 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
|
|
|
SELECT * FROM t12 ORDER BY a;
|
|
|
|
|
|
|
|
--echo *** Select on Slave ***
|
|
|
|
sync_slave_with_master;
|
|
|
|
SELECT * FROM t12 ORDER BY a;
|
|
|
|
|
|
|
|
--echo *** Drop t12 ***
|
|
|
|
connection master;
|
|
|
|
DROP TABLE t12;
|
|
|
|
sync_slave_with_master;
|
|
|
|
|
|
|
|
--echo **** Extra Colums End ****
|
|
|
|
|
|
|
|
###############################
|
|
|
|
# BUG#22177 CURRENT_TIMESTAMP #
|
|
|
|
# Sould work with ^ #
|
|
|
|
###############################
|
|
|
|
--echo *** BUG 22177 Start ***
|
|
|
|
--echo *** Create t13 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
eval CREATE TABLE t13 (a INT KEY, b BLOB, c CHAR(5),
|
|
|
|
d INT DEFAULT '1',
|
|
|
|
e TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
|
|
|
|
)ENGINE=$engine_type;
|
|
|
|
|
|
|
|
--echo *** Create t13 on Master ***
|
|
|
|
connection master;
|
|
|
|
eval CREATE TABLE t13 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
|
|
|
|
) ENGINE=$engine_type;
|
|
|
|
RESET MASTER;
|
|
|
|
|
|
|
|
--echo *** Start Slave ***
|
|
|
|
connection slave;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Master Data Insert ***
|
|
|
|
connection master;
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t13 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
|
|
|
SELECT * FROM t13 ORDER BY a;
|
|
|
|
|
|
|
|
--echo *** Select on Slave ****
|
|
|
|
sync_slave_with_master;
|
|
|
|
--replace_column 5 CURRENT_TIMESTAMP
|
|
|
|
SELECT * FROM t13 ORDER BY a;
|
|
|
|
|
|
|
|
--echo *** Drop t13 ***
|
|
|
|
connection master;
|
|
|
|
DROP TABLE t13;
|
|
|
|
sync_slave_with_master;
|
|
|
|
|
|
|
|
--echo *** 22117 END ***
|
|
|
|
|
|
|
|
##############################
|
|
|
|
# ALTER MASTER TABLE TESTING #
|
|
|
|
##############################
|
|
|
|
|
|
|
|
--echo *** Alter Master Table Testing Start ***
|
|
|
|
|
|
|
|
####################################################
|
|
|
|
# - Alter Master adding columns at middle of table #
|
|
|
|
# Expect: columns added #
|
|
|
|
####################################################
|
|
|
|
|
|
|
|
--echo *** Create t14 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
eval CREATE TABLE t14 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
|
|
|
|
c6 INT DEFAULT '1',
|
|
|
|
c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
|
|
|
|
)ENGINE=$engine_type;
|
|
|
|
|
|
|
|
--echo *** Create t14 on Master ***
|
|
|
|
connection master;
|
|
|
|
eval CREATE TABLE t14 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
|
|
|
|
) ENGINE=$engine_type;
|
|
|
|
RESET MASTER;
|
|
|
|
|
|
|
|
--echo *** Start Slave ***
|
|
|
|
connection slave;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Master Data Insert ***
|
|
|
|
connection master;
|
|
|
|
ALTER TABLE t14 ADD COLUMN c2 DECIMAL(8,2) AFTER c1;
|
|
|
|
ALTER TABLE t14 ADD COLUMN c3 TEXT AFTER c2;
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t14 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'),
|
|
|
|
(2,2.00,'This Test Should work',@b1,'JOE'),
|
|
|
|
(3,3.00,'If is does not, I will open a bug',@b1,'QA');
|
|
|
|
SELECT * FROM t14 ORDER BY c1;
|
|
|
|
|
|
|
|
|
|
|
|
--echo *** Select on Slave ****
|
|
|
|
sync_slave_with_master;
|
|
|
|
--replace_column 7 CURRENT_TIMESTAMP
|
|
|
|
SELECT * FROM t14 ORDER BY c1;
|
|
|
|
|
2007-07-17 22:49:07 +02:00
|
|
|
####################################################
|
|
|
|
# - Alter Master drop column at end of table #
|
|
|
|
# Expect: column dropped #
|
|
|
|
####################################################
|
|
|
|
|
|
|
|
--echo *** Create t14a on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
eval CREATE TABLE t14a (c1 INT KEY, c4 BLOB, c5 CHAR(5),
|
|
|
|
c6 INT DEFAULT '1',
|
|
|
|
c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
|
|
|
|
)ENGINE=$engine_type;
|
|
|
|
|
|
|
|
--echo *** Create t14a on Master ***
|
|
|
|
connection master;
|
|
|
|
eval CREATE TABLE t14a (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
|
|
|
|
) ENGINE=$engine_type;
|
|
|
|
RESET MASTER;
|
|
|
|
|
|
|
|
--echo *** Start Slave ***
|
|
|
|
connection slave;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Master Data Insert ***
|
|
|
|
connection master;
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t14a () VALUES(1,@b1,'Kyle'),
|
|
|
|
(2,@b1,'JOE'),
|
|
|
|
(3,@b1,'QA');
|
|
|
|
|
|
|
|
SELECT * FROM t14a ORDER BY c1;
|
|
|
|
--echo *** Select on Slave ****
|
|
|
|
sync_slave_with_master;
|
|
|
|
--replace_column 5 CURRENT_TIMESTAMP
|
|
|
|
SELECT * FROM t14a ORDER BY c1;
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
|
|
|
|
--echo *** Master Drop c5 ***
|
|
|
|
connection master;
|
|
|
|
ALTER TABLE t14a DROP COLUMN c5;
|
|
|
|
RESET MASTER;
|
|
|
|
|
|
|
|
--echo *** Start Slave ***
|
|
|
|
connection slave;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Master Data Insert ***
|
|
|
|
connection master;
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
|
|
|
|
INSERT INTO t14a () VALUES(4,@b1),
|
|
|
|
(5,@b1),
|
|
|
|
(6,@b1);
|
|
|
|
SELECT * FROM t14a ORDER BY c1;
|
|
|
|
|
|
|
|
--echo *** Select on Slave ****
|
|
|
|
sync_slave_with_master;
|
|
|
|
--replace_column 5 CURRENT_TIMESTAMP
|
|
|
|
SELECT * FROM t14a ORDER BY c1;
|
2006-11-03 16:31:25 +01:00
|
|
|
|
|
|
|
####################################################
|
|
|
|
# - Alter Master Dropping columns from the middle. #
|
|
|
|
# Expect: columns dropped #
|
|
|
|
####################################################
|
|
|
|
|
|
|
|
--echo *** connect to master and drop columns ***
|
|
|
|
connection master;
|
|
|
|
ALTER TABLE t14 DROP COLUMN c2;
|
|
|
|
ALTER TABLE t14 DROP COLUMN c4;
|
|
|
|
--echo *** Select from Master ***
|
|
|
|
SELECT * FROM t14 ORDER BY c1;
|
|
|
|
|
|
|
|
--echo *** Select from Slave ***
|
|
|
|
sync_slave_with_master;
|
|
|
|
--replace_column 5 CURRENT_TIMESTAMP
|
|
|
|
SELECT * FROM t14 ORDER BY c1;
|
|
|
|
|
|
|
|
--echo *** Drop t14 ***
|
|
|
|
connection master;
|
|
|
|
DROP TABLE t14;
|
|
|
|
sync_slave_with_master;
|
|
|
|
|
|
|
|
##############################################################
|
|
|
|
# - Alter Master adding columns that already exist on slave. #
|
|
|
|
# Expect: proper error message #
|
|
|
|
##############################################################
|
|
|
|
|
|
|
|
--echo *** Create t15 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
eval CREATE TABLE t15 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT,
|
|
|
|
c4 BLOB, c5 CHAR(5),
|
|
|
|
c6 INT DEFAULT '1',
|
|
|
|
c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
|
|
|
|
)ENGINE=$engine_type;
|
|
|
|
|
|
|
|
--echo *** Create t15 on Master ***
|
|
|
|
connection master;
|
|
|
|
eval CREATE TABLE t15 (c1 INT PRIMARY KEY, c2 DECIMAL(8,2), c3 TEXT,
|
|
|
|
c4 BLOB, c5 CHAR(5)) ENGINE=$engine_type;
|
|
|
|
RESET MASTER;
|
|
|
|
|
|
|
|
--echo *** Start Slave ***
|
|
|
|
connection slave;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Master Data Insert ***
|
|
|
|
connection master;
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t15 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'),
|
|
|
|
(2,2.00,'This Test Should work',@b1,'JOE'),
|
|
|
|
(3,3.00,'If is does not, I will open a bug',@b1,'QA');
|
|
|
|
SELECT * FROM t15 ORDER BY c1;
|
|
|
|
|
|
|
|
|
|
|
|
--echo *** Select on Slave ****
|
|
|
|
sync_slave_with_master;
|
|
|
|
--replace_column 7 CURRENT_TIMESTAMP
|
|
|
|
SELECT * FROM t15 ORDER BY c1;
|
|
|
|
|
|
|
|
--echo *** Add column on master that is a Extra on Slave ***
|
|
|
|
connection master;
|
|
|
|
ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5;
|
|
|
|
|
|
|
|
--echo ********************************************
|
|
|
|
--echo *** Expect slave to fail with Error 1060 ***
|
|
|
|
--echo ********************************************
|
|
|
|
connection slave;
|
2007-06-13 05:52:43 +02:00
|
|
|
--source include/wait_for_slave_sql_to_stop.inc
|
2006-11-03 16:31:25 +01:00
|
|
|
--replace_result $MASTER_MYPORT MASTER_PORT
|
2007-08-10 18:48:01 +02:00
|
|
|
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
|
2006-11-03 16:31:25 +01:00
|
|
|
--query_vertical SHOW SLAVE STATUS
|
BUG#28618 (Skipping into the middle of a group with SQL_SLAVE_SKIP_COUNTER
is possible):
When skipping the beginning of a transaction starting with BEGIN, the OPTION_BEGIN
flag was not set correctly, which caused the slave to not recognize that it was
inside a group. This patch sets the OPTION_BEGIN flag for BEGIN, COMMIT, ROLLBACK,
and XID events. It also adds checks if inside a group before decreasing the
slave skip counter to zero.
Begin_query_log_event was not marked that it could not end a group, which is now
corrected.
mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test:
Correcting slave skip counter to get the correct behaviour.
mysql-test/suite/rpl/r/rpl_slave_skip.result:
Result change.
mysql-test/suite/rpl/t/rpl_slave_skip.test:
Adding tests to check that skipping works for transactions:
- Skipping one group with BEGIN first
- Skipping two groups with BEGIN first
- Skipping one group without BEGIN first but with AUTOCOMMIT=0
- LOAD DATA INFILE under statement-based replication
mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result:
Result change.
sql/log_event.cc:
Adding checks if we're in a group when the slave skip counter is 1.
In that case, we should keep going.
Adding helping member function Log_event::continue_group() denoting
that this event cannot end a group, and if the skip counter indicates
that the group ends after this event, it should not decrease the skip
counter.
Query_log_event will change the OPTION_BEGIN flag for BEGIN, COMMIT, and
ROLLBACK, even when skipping because of a positive skip count, and
Xid_log_event will also affect the OPTION_BEGIN flag, even when being
skipped.
Begin_load_query_log_event cannot end a group, so it is marked to
continue the group.
sql/log_event.h:
Adding helper function Log_event::continue_group().
sql/rpl_rli.h:
Adding Relay_log_info::get_flag() to get the value of a
replication flag.
sql/slave.cc:
Adding debug output and changing debug message.
mysql-test/suite/rpl/data/rpl_bug28618.dat:
New BitKeeper file ``mysql-test/suite/rpl/data/rpl_bug28618.dat''
mysql-test/suite/rpl/t/rpl_slave_skip-slave.opt:
New BitKeeper file ``mysql-test/suite/rpl/t/rpl_slave_skip-slave.opt''
2007-10-19 14:18:41 +02:00
|
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
|
2006-11-03 16:31:25 +01:00
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Try to insert in master ****
|
|
|
|
connection master;
|
|
|
|
INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2);
|
|
|
|
SELECT * FROM t15 ORDER BY c1;
|
|
|
|
|
BUG#28618 (Skipping into the middle of a group with SQL_SLAVE_SKIP_COUNTER
is possible):
When skipping the beginning of a transaction starting with BEGIN, the OPTION_BEGIN
flag was not set correctly, which caused the slave to not recognize that it was
inside a group. This patch sets the OPTION_BEGIN flag for BEGIN, COMMIT, ROLLBACK,
and XID events. It also adds checks if inside a group before decreasing the
slave skip counter to zero.
Begin_query_log_event was not marked that it could not end a group, which is now
corrected.
mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test:
Correcting slave skip counter to get the correct behaviour.
mysql-test/suite/rpl/r/rpl_slave_skip.result:
Result change.
mysql-test/suite/rpl/t/rpl_slave_skip.test:
Adding tests to check that skipping works for transactions:
- Skipping one group with BEGIN first
- Skipping two groups with BEGIN first
- Skipping one group without BEGIN first but with AUTOCOMMIT=0
- LOAD DATA INFILE under statement-based replication
mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result:
Result change.
sql/log_event.cc:
Adding checks if we're in a group when the slave skip counter is 1.
In that case, we should keep going.
Adding helping member function Log_event::continue_group() denoting
that this event cannot end a group, and if the skip counter indicates
that the group ends after this event, it should not decrease the skip
counter.
Query_log_event will change the OPTION_BEGIN flag for BEGIN, COMMIT, and
ROLLBACK, even when skipping because of a positive skip count, and
Xid_log_event will also affect the OPTION_BEGIN flag, even when being
skipped.
Begin_load_query_log_event cannot end a group, so it is marked to
continue the group.
sql/log_event.h:
Adding helper function Log_event::continue_group().
sql/rpl_rli.h:
Adding Relay_log_info::get_flag() to get the value of a
replication flag.
sql/slave.cc:
Adding debug output and changing debug message.
mysql-test/suite/rpl/data/rpl_bug28618.dat:
New BitKeeper file ``mysql-test/suite/rpl/data/rpl_bug28618.dat''
mysql-test/suite/rpl/t/rpl_slave_skip-slave.opt:
New BitKeeper file ``mysql-test/suite/rpl/t/rpl_slave_skip-slave.opt''
2007-10-19 14:18:41 +02:00
|
|
|
#SHOW BINLOG EVENTS;
|
|
|
|
|
2006-11-03 16:31:25 +01:00
|
|
|
--echo *** Try to select from slave ****
|
|
|
|
sync_slave_with_master;
|
|
|
|
--replace_column 7 CURRENT_TIMESTAMP
|
|
|
|
SELECT * FROM t15 ORDER BY c1;
|
|
|
|
|
|
|
|
--echo *** DROP TABLE t15 ***
|
|
|
|
connection master;
|
|
|
|
DROP TABLE t15;
|
|
|
|
sync_slave_with_master;
|
|
|
|
|
|
|
|
####################################
|
|
|
|
# - Alter Master and ADD PARTITION #
|
|
|
|
# Expect:? #
|
|
|
|
####################################
|
|
|
|
|
|
|
|
--echo *** Create t16 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
eval CREATE TABLE t16 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT,
|
|
|
|
c4 BLOB, c5 CHAR(5),
|
|
|
|
c6 INT DEFAULT '1',
|
|
|
|
c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
|
|
|
|
)ENGINE=$engine_type;
|
|
|
|
|
|
|
|
--echo *** Create t16 on Master ***
|
|
|
|
connection master;
|
|
|
|
eval CREATE TABLE t16 (c1 INT PRIMARY KEY, c2 DECIMAL(8,2), c3 TEXT,
|
|
|
|
c4 BLOB, c5 CHAR(5))ENGINE=$engine_type;
|
|
|
|
RESET MASTER;
|
|
|
|
|
|
|
|
--echo *** Start Slave ***
|
|
|
|
connection slave;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Master Data Insert ***
|
|
|
|
connection master;
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t16 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'),
|
|
|
|
(2,2.00,'This Test Should work',@b1,'JOE'),
|
|
|
|
(3,3.00,'If is does not, I will open a bug',@b1,'QA');
|
|
|
|
SELECT * FROM t16 ORDER BY c1;
|
|
|
|
|
|
|
|
--echo *** Select on Slave ****
|
|
|
|
sync_slave_with_master;
|
|
|
|
--replace_column 7 CURRENT_TIMESTAMP
|
|
|
|
SELECT * FROM t16 ORDER BY c1;
|
|
|
|
|
|
|
|
--echo *** Add Partition on master ***
|
|
|
|
connection master;
|
|
|
|
ALTER TABLE t16 PARTITION BY KEY(c1) PARTITIONS 4;
|
|
|
|
INSERT INTO t16 () VALUES(4,1.00,'Replication Rocks',@b1,'Omer');
|
|
|
|
SHOW CREATE TABLE t16;
|
|
|
|
|
|
|
|
--echo *** Show table on Slave ****
|
|
|
|
sync_slave_with_master;
|
|
|
|
SHOW CREATE TABLE t16;
|
|
|
|
|
|
|
|
--echo *** DROP TABLE t16 ***
|
|
|
|
connection master;
|
|
|
|
DROP TABLE t16;
|
|
|
|
sync_slave_with_master;
|
|
|
|
|
|
|
|
--echo *** Alter Master End ***
|
|
|
|
|
|
|
|
############################################
|
|
|
|
### Try to replicate BIGINT to SMALLINT ###
|
|
|
|
### Should Stop Slave ###
|
|
|
|
############################################
|
|
|
|
|
|
|
|
--echo *** Create t17 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
eval CREATE TABLE t17 (a SMALLINT, b INT PRIMARY KEY, c CHAR(5),
|
|
|
|
d FLOAT DEFAULT '2.00',
|
|
|
|
e CHAR(5) DEFAULT 'TEST2')
|
|
|
|
ENGINE=$engine_type;
|
|
|
|
|
|
|
|
--echo *** Create t17 on Master ***
|
|
|
|
connection master;
|
|
|
|
eval CREATE TABLE t17 (a BIGINT PRIMARY KEY, b INT, c CHAR(10)
|
|
|
|
) ENGINE=$engine_type;
|
|
|
|
RESET MASTER;
|
|
|
|
|
|
|
|
--echo *** Start Slave ***
|
|
|
|
connection slave;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo *** Master Data Insert ***
|
|
|
|
connection master;
|
|
|
|
|
|
|
|
INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
|
|
|
|
|
|
|
|
--echo ********************************************
|
|
|
|
--echo *** Expect slave to fail with Error 1522 ***
|
|
|
|
--echo ********************************************
|
|
|
|
connection slave;
|
2007-06-13 05:52:43 +02:00
|
|
|
--source include/wait_for_slave_sql_to_stop.inc
|
2006-11-03 16:31:25 +01:00
|
|
|
--replace_result $MASTER_MYPORT MASTER_PORT
|
2007-08-10 18:48:01 +02:00
|
|
|
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
|
2006-11-03 16:31:25 +01:00
|
|
|
--query_vertical SHOW SLAVE STATUS
|
|
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
|
|
|
START SLAVE;
|
|
|
|
|
|
|
|
--echo ** DROP table t17 ***
|
|
|
|
connection master;
|
|
|
|
DROP TABLE t17;
|
|
|
|
sync_slave_with_master;
|
|
|
|
|
|
|
|
#### Clean Up ####
|
|
|
|
--disable_warnings
|
|
|
|
--disable_query_log
|
2007-10-31 20:01:01 +01:00
|
|
|
connection master;
|
2007-07-17 22:49:07 +02:00
|
|
|
DROP TABLE IF EXISTS t1, t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t14a,t15,t16,t17;
|
2007-10-31 20:01:01 +01:00
|
|
|
sync_slave_with_master;
|
|
|
|
connection master;
|
2006-11-03 16:31:25 +01:00
|
|
|
--enable_query_log
|
|
|
|
--enable_warnings
|
|
|
|
|
|
|
|
# END 5.1 Test Case
|
|
|
|
|
|
|
|
|