Commit 12ca4150 authored by mleich@four.local.lan's avatar mleich@four.local.lan

Merge four.local.lan:/WORK/mysql-5.1-rpl/src-rpl-ddl

into  four.local.lan:/WORK/mysql-5.1-rpl/src-rpl-ddlx
parents 121f29a5 2511bedd
This diff is collapsed.
This diff is collapsed.
# include/rpl_stmt_seq.inc
#
# Please be very careful when editing this routine, because the handling of
# the $variables is extreme sensitive.
#
################### include/rpl_stmt_seq.inc ###########################
# #
# Check if a given SQL statement (->$my_stmt) / AUTOCOMMIT mode / #
# storage engine somehow involved causes COMMIT or ROLLBACK. #
# #
# #
# The typical test sequence #
# ------------------------- #
# 1. master connection: INSERT without commit #
# check table content of master and slave #
# 2. master connection: EXECUTE the statement #
# check table content of master and slave #
# 3. master connection: ROLLBACK #
# check table content of master and slave #
# 4. flush the logs #
# #
# The variables #
# $show_binlog -- print binlog entries #
# 0 - default + fits to the file with #
# results #
# 1 - useful for debugging #
# This variable is used within #
# include/rpl_stmt_seq.inc. #
# $manipulate -- Manipulation of the binary logs #
# 0 - do nothing #
# 1 - so that the output of SHOW BINLOG #
# EVENTS IN <current log> contains only #
# commands of the current test sequence #
# This is especially useful, if the #
# $show_binlog is set to 1 and many #
# subtest are executed. #
# This variable is used within #
# include/rpl_stmt_seq.inc. #
# have to be set before sourcing this script. #
# #
# Please be very careful when editing this routine, because the #
# handling of the $variables is extreme sensitive. #
# #
########################################################################
###############################################################
# Debug options : To debug this test script
###############################################################
let $show_binlog= 0;
let $manipulate= 1;
######## The typical test sequence
# 1. INSERT without commit
# check table content of master and slave
# 2. EXECUTE the statement
# check table content of master and slave
# 3. ROLLBACK
# check table content of master and slave
# 4. flush the logs
# Last update:
# 2007-02-12 ML Replace comments via SQL by "--echo ..."
#
let $VERSION=`select version()`;
--disable_query_log
# SELECT '######## new test sequence ########' as "";
eval SELECT CONCAT('######## ','$my_stmt',' ########') as "";
--enable_query_log
--echo
--echo ######## $my_stmt ########
###############################################################
......@@ -49,11 +70,10 @@ let $_log_num_s= `select @aux`;
###############################################################
# INSERT
###############################################################
--echo
--echo -------- switch to master -------
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
# Maybe it would be smarter to use a table with autoincrement column.
# Maybe it would be smarter to use a table with an autoincrement column.
let $MAX= `SELECT MAX(f1) FROM t1` ;
eval INSERT INTO t1 SET f1= $MAX + 1;
# results before DDL(to be tested)
......@@ -66,10 +86,9 @@ eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
}
sync_slave_with_master;
--echo
--echo -------- switch to slave --------
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
# results before DDL(to be tested)
SELECT MAX(f1) FROM t1;
if ($show_binlog)
......@@ -82,10 +101,9 @@ eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
###############################################################
# command to be tested
###############################################################
--echo
--echo -------- switch to master -------
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
eval $my_stmt;
# Devaluate $my_stmt, to detect script bugs
let $my_stmt= ERROR: YOU FORGOT TO FILL IN THE STATEMENT;
......@@ -99,10 +117,9 @@ eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
}
sync_slave_with_master;
--echo
--echo -------- switch to slave --------
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
# results after DDL(to be tested)
SELECT MAX(f1) FROM t1;
if ($show_binlog)
......@@ -115,10 +132,9 @@ eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
###############################################################
# ROLLBACK
###############################################################
--echo
--echo -------- switch to master -------
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
ROLLBACK;
# results after final ROLLBACK
SELECT MAX(f1) FROM t1;
......@@ -140,10 +156,9 @@ eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
}
sync_slave_with_master;
--echo
--echo -------- switch to slave --------
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
# results after final ROLLBACK
SELECT MAX(f1) FROM t1;
--disable_query_log
......@@ -172,19 +187,17 @@ if ($manipulate)
# - flush the master and the slave log
# ---> both start to write into new logs with incremented number
# - increment $_log_num_n
--echo
--echo -------- switch to master -------
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
flush logs;
# sleep 1;
# eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
sync_slave_with_master;
--echo
--echo -------- switch to slave --------
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
# the final content of the binary log
flush logs;
# The next sleep is urgent needed.
......@@ -195,7 +208,6 @@ flush logs;
inc $_log_num_n;
}
--echo
--echo -------- switch to master -------
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
# include/rpl_stmt_seq.inc
#
# Please be very careful when editing this routine, because the handling of
# the $variables is extreme sensitive.
#
###############################################################
# Debug options : To debug this test script
###############################################################
let $show_binlog= 0;
let $manipulate= 1;
######## The typical test sequence
# 1. INSERT without commit
# check table content of master and slave
# 2. EXECUTE the statement
# check table content of master and slave
# 3. ROLLBACK
# check table content of master and slave
# 4. flush the logs
let $VERSION=`select version()`;
--disable_query_log
# SELECT '######## new test sequence ########' as "";
eval SELECT CONCAT('######## ','$my_stmt',' $engine_type',' ########') as "";
--enable_query_log
###############################################################
# Predict the number of the current log
###############################################################
# Disable the logging of the log number computation.
--disable_query_log
# $_log_num_n should contain the number of the current binlog in numeric style.
# If this routine is called for the first time, $_log_num will not initialized
# and contain the value '' instead of '1'. So we will correct it here.
#
eval set @aux= IF('$_log_num_n' = '', '1', '$_log_num_n');
let $_log_num_n= `SELECT @aux`;
eval set @aux= LPAD('$_log_num_n',6,'0');
# SELECT @aux AS "@aux is";
#
# $_log_num_s should contain the number of the current binlog in string style.
let $_log_num_s= `select @aux`;
# eval SELECT '$log_num' ;
--enable_query_log
###############################################################
# INSERT
###############################################################
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
# Maybe it would be smarter to use a table with autoincrement column.
let $MAX= `SELECT MAX(f1) FROM t1` ;
eval INSERT INTO t1 SET f1= $MAX + 1;
# results before DDL(to be tested)
SELECT MAX(f1) FROM t1;
if ($show_binlog)
{
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
}
sync_slave_with_master;
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
# results before DDL(to be tested)
SELECT MAX(f1) FROM t1;
if ($show_binlog)
{
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
}
###############################################################
# command to be tested
###############################################################
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
eval $my_stmt $engine_type;
# Devaluate $my_stmt, to detect script bugs
let $my_stmt= ERROR: YOU FORGOT TO FILL IN THE STATEMENT;
# results after DDL(to be tested)
SELECT MAX(f1) FROM t1;
if ($show_binlog)
{
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
}
sync_slave_with_master;
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
# results after DDL(to be tested)
SELECT MAX(f1) FROM t1;
if ($show_binlog)
{
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
}
###############################################################
# ROLLBACK
###############################################################
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
ROLLBACK;
# results after final ROLLBACK
SELECT MAX(f1) FROM t1;
# Try to detect if the DDL command caused that the INSERT is committed
# $MAX holds the highest/last value just before the insert of MAX + 1
--disable_query_log
eval SELECT CONCAT(CONCAT('TEST-INFO: MASTER: The INSERT is ',
IF(MAX(f1) = $MAX + 1, 'committed', 'not committed')),
IF((MAX(f1) = $MAX + 1) XOR NOT $my_master_commit,
' (Succeeded)',
' (Failed)')) AS ""
FROM mysqltest1.t1;
--enable_query_log
if ($show_binlog)
{
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
}
sync_slave_with_master;
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
# results after final ROLLBACK
SELECT MAX(f1) FROM t1;
--disable_query_log
eval SELECT CONCAT(CONCAT('TEST-INFO: SLAVE: The INSERT is ',
IF(MAX(f1) = $MAX + 1, 'committed', 'not committed')),
IF((MAX(f1) = $MAX + 1) XOR NOT $my_slave_commit,
' (Succeeded)',
' (Failed)')) AS ""
FROM mysqltest1.t1;
--enable_query_log
if ($show_binlog)
{
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
}
###############################################################
# Manipulate binlog
###############################################################
if ($manipulate)
{
#### Manipulate the binary logs,
# so that the output of SHOW BINLOG EVENTS IN <current log>
# contains only commands of the current test sequence.
# - flush the master and the slave log
# ---> both start to write into new logs with incremented number
# - increment $_log_num_n
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
flush logs;
# sleep 1;
# eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
sync_slave_with_master;
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
# the final content of the binary log
flush logs;
# The next sleep is urgent needed.
# Without this sleep the slaves crashes often, when the SHOW BINLOG
# is executed. :-(
# sleep 1;
# eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
inc $_log_num_n;
}
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
This diff is collapsed.
This diff is collapsed.
......@@ -21,7 +21,7 @@ partition_03ndb : BUG#16385 2006-03-24 mikael Partitions: crash when up
rpl_ndb_2innodb : BUG#19227 2006-04-20 pekka pk delete apparently not replicated
rpl_ndb_2myisam : BUG#19227 Seems to pass currently
rpl_ndb_dd_partitions : BUG#19259 2006-04-21 rpl_ndb_dd_partitions fails on s/AMD
rpl_ndb_ddl : BUG#18946 result file needs update + test needs to checked
rpl_ddl : BUG#26418 2007-03-01 mleich Slave out of sync after CREATE/DROP TEMPORARY TABLE + ROLLBACK on master
rpl_ndb_innodb2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement
rpl_ndb_myisam2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement
rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly
......
......@@ -22,13 +22,11 @@
# effects like failing 'sync_slave_with_master', crashes of the slave or
# abort of the test case etc..
#
# 3. The assignment of the DDL command to be tested to $my_stmt can
# be a bit difficult. "'" must be avoided, because the test
# routine "include/rpl_stmt_seq.inc" performs a
# eval SELECT CONCAT('######## ','$my_stmt',' ########') as "";
#
--source include/not_ndb_default.inc
--source include/have_innodb.inc
--source include/master-slave.inc
let $engine_type= "InnoDB";
--source include/have_innodb.inc
let $engine_type= InnoDB;
let $temp_engine_type= MEMORY;
let $show_binlog = 0;
let $manipulate = 0;
-- source extra/rpl_tests/rpl_ddl.test
######################## rpl_ddl.test ########################
#################### rpl_ndb_ddl.test ########################
# #
# DDL statements (sometimes with implicit COMMIT) executed #
# by the master and it's propagation into the slave #
......@@ -22,14 +22,11 @@
# effects like failing 'sync_slave_with_master', crashes of the slave or
# abort of the test case etc..
#
# 3. The assignment of the DDL command to be tested to $my_stmt can
# be a bit difficult. "'" must be avoided, because the test
# routine "include/rpl_stmt_seq.inc" performs a
# eval SELECT CONCAT('######## ','$my_stmt',' ########') as "";
#
--source include/have_ndb.inc
--source include/master-slave.inc
let $engine_type= "NDB";
-- source extra/rpl_tests/rpl_ndb_ddl.test
--source include/have_ndb.inc
let $engine_type= NDB;
let $temp_engine_type= MEMORY;
let $show_binlog = 0;
let $manipulate = 0;
-- source extra/rpl_tests/rpl_ddl.test
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