Commit 07299ab6 authored by unknown's avatar unknown

Merge mkindahl@bk-internal.mysql.com:/home/bk/mysql-5.1-new-rpl

into  romeo.(none):/home/bkroot/mysql-5.1-new-rpl
parents 6e129143 003de988
...@@ -118,7 +118,7 @@ test-unit: ...@@ -118,7 +118,7 @@ test-unit:
test-ps: test-ps:
cd mysql-test ; \ cd mysql-test ; \
./mysql-test-run.pl $(force) --ps-protocol --mysqld=--binlog-format=statement ./mysql-test-run.pl $(force) --ps-protocol --mysqld=--binlog-format=mixed
test-nr: test-nr:
cd mysql-test ; \ cd mysql-test ; \
...@@ -129,6 +129,10 @@ test-pr: ...@@ -129,6 +129,10 @@ test-pr:
./mysql-test-run.pl $(force) --ps-protocol --mysqld=--binlog-format=row ./mysql-test-run.pl $(force) --ps-protocol --mysqld=--binlog-format=row
test-ns: test-ns:
cd mysql-test ; \
./mysql-test-run.pl $(force) --mysqld=--binlog-format=mixed
test-binlog-statement:
cd mysql-test ; \ cd mysql-test ; \
./mysql-test-run.pl $(force) --mysqld=--binlog-format=statement ./mysql-test-run.pl $(force) --mysqld=--binlog-format=statement
......
...@@ -60,24 +60,4 @@ insert into t1 values(null); ...@@ -60,24 +60,4 @@ insert into t1 values(null);
select * from t1; select * from t1;
drop table t1; drop table t1;
# Test of binlogging of INSERT_ID with INSERT DELAYED -- source extra/binlog_tests/binlog_insert_delayed.test
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
# First, avoid BUG#20627:
set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
# Verify that only one INSERT_ID event is binlogged.
insert delayed into t1 values (207);
# We use sleeps between statements, that's the only way to get a
# repeatable binlog in a normal test run and under Valgrind.
# It may be that the "binlog missing rows" of BUG#20821 shows up
# here.
sleep 2;
insert delayed into t1 values (null);
sleep 2;
insert delayed into t1 values (300);
sleep 2; # time for the delayed queries to reach disk
select * from t1;
--replace_column 2 # 5 #
--replace_regex /table_id: [0-9]+/table_id: #/
show binlog events from 102;
drop table t1;
# Test of binlogging of INSERT_ID with INSERT DELAYED
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
# First, avoid BUG#20627:
set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
# Verify that only one INSERT_ID event is binlogged.
# Note, that because of WL#3368 mixed mode binlog records RBR events for the delayed
insert delayed into t1 values (207);
# We use sleeps between statements, that's the only way to get a
# repeatable binlog in a normal test run and under Valgrind.
# It may be that the "binlog missing rows" of BUG#20821 shows up
# here.
sleep 2;
insert delayed into t1 values (null);
sleep 2;
insert delayed into t1 values (300);
sleep 2; # time for the delayed queries to reach disk
select * from t1;
--replace_column 2 # 5 #
--replace_regex /table_id: [0-9]+/table_id: #/
show binlog events from 102;
drop table t1;
# Requires statement logging # Requires statement logging
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
# See if replication of a "LOAD DATA in an autoincrement column" # See if replication of a "LOAD DATA in an autoincrement column"
# Honours autoincrement values # Honours autoincrement values
......
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source include/master-slave.inc -- source include/master-slave.inc
create table t1 (word char(20) not null); create table t1 (word char(20) not null);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# This test will fail if the server/client does not support enough charsets. # This test will fail if the server/client does not support enough charsets.
# Requires statement logging # Requires statement logging
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
source include/master-slave.inc; source include/master-slave.inc;
--disable_warnings --disable_warnings
......
-- require r/have_binlog_format_mixed.require
disable_query_log;
show variables like "binlog_format";
enable_query_log;
--require r/have_binlog_format_statement.require
--disable_query_log
--replace_result MIXED STATEMENT
show variables like "binlog_format";
--enable_query_log
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
insert delayed into t1 values (207);
insert delayed into t1 values (null);
insert delayed into t1 values (300);
select * from t1;
a
207
208
300
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (207)
master-bin.000001 # Intvar 1 # INSERT_ID=208
master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (null)
master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (300)
drop table t1;
...@@ -172,8 +172,10 @@ master-bin.000001 # Intvar 1 # INSERT_ID=127 ...@@ -172,8 +172,10 @@ master-bin.000001 # Intvar 1 # INSERT_ID=127
master-bin.000001 # Query 1 # use `test`; insert into t1 values(null) master-bin.000001 # Query 1 # use `test`; insert into t1 values(null)
master-bin.000001 # Query 1 # use `test`; drop table t1 master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (207) master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Intvar 1 # INSERT_ID=208 master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (null) master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (300) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
drop table t1; drop table t1;
Variable_name Value
binlog_format MIXED
...@@ -5,9 +5,6 @@ reset slave; ...@@ -5,9 +5,6 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
SET BINLOG_FORMAT=MIXED; SET BINLOG_FORMAT=MIXED;
SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT;
@@GLOBAL.BINLOG_FORMAT @@SESSION.BINLOG_FORMAT
STATEMENT MIXED
SET GLOBAL BINLOG_FORMAT=MIXED; SET GLOBAL BINLOG_FORMAT=MIXED;
SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT; SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT;
@@GLOBAL.BINLOG_FORMAT @@SESSION.BINLOG_FORMAT @@GLOBAL.BINLOG_FORMAT @@SESSION.BINLOG_FORMAT
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# Taken FROM the select test # Taken FROM the select test
# #
-- source include/have_archive.inc -- source include/have_archive.inc
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
--disable_warnings --disable_warnings
drop table if exists t1,t2,t3; drop table if exists t1,t2,t3;
......
# This test is to verify replication with INSERT DELAY through
# unrecommended STATEMENT binlog format
-- source include/not_embedded.inc
-- source include/have_binlog_format_statement.inc
-- disable_query_log
reset master; # get rid of previous tests binlog
-- enable_query_log
-- source extra/binlog_tests/binlog_insert_delayed.test
...@@ -13,6 +13,6 @@ drop table t1; ...@@ -13,6 +13,6 @@ drop table t1;
# For both statement and row based bin logs 9/19/2005 [jbm] # For both statement and row based bin logs 9/19/2005 [jbm]
-- source include/not_embedded.inc -- source include/not_embedded.inc
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed.inc
-- source extra/binlog_tests/binlog.test -- source extra/binlog_tests/binlog.test
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
# For both statement and row based bin logs 9/19/2005 [jbm] # For both statement and row based bin logs 9/19/2005 [jbm]
-- source include/not_embedded.inc -- source include/not_embedded.inc
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/binlog_tests/blackhole.test -- source extra/binlog_tests/blackhole.test
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
# For both statement and row based bin logs 9/19/2005 [jbm] # For both statement and row based bin logs 9/19/2005 [jbm]
-- source include/not_embedded.inc -- source include/not_embedded.inc
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/binlog_tests/ctype_cp932.test -- source extra/binlog_tests/ctype_cp932.test
# This is a wrapper for binlog.test so that the same test case can be used # This is a wrapper for binlog.test so that the same test case can be used
# For both statement and row based bin logs 9/19/2005 [jbm] # For both statement and row based bin logs 9/19/2005 [jbm]
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/binlog_tests/ctype_ucs_binlog.test -- source extra/binlog_tests/ctype_ucs_binlog.test
# This is a wrapper for binlog.test so that the same test case can be used # This is a wrapper for binlog.test so that the same test case can be used
# For both statement and row based bin logs 9/19/2005 [jbm] # For both statement and row based bin logs 9/19/2005 [jbm]
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/binlog_tests/drop_temp_table.test -- source extra/binlog_tests/drop_temp_table.test
# This is a wrapper for binlog.test so that the same test case can be used # This is a wrapper for binlog.test so that the same test case can be used
# For both statement and row based bin logs 9/19/2005 [jbm] # For both statement and row based bin logs 9/19/2005 [jbm]
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/binlog_tests/innodb_stat.test -- source extra/binlog_tests/innodb_stat.test
# This is a wrapper for binlog.test so that the same test case can be used # This is a wrapper for binlog.test so that the same test case can be used
# For both statement and row based bin logs 9/19/2005 [jbm] # For both statement and row based bin logs 9/19/2005 [jbm]
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/binlog_tests/insert_select-binlog.test -- source extra/binlog_tests/insert_select-binlog.test
# This is a wrapper for binlog.test so that the same test case can be used # This is a wrapper for binlog.test so that the same test case can be used
# For both statement and row based bin logs 9/19/2005 [jbm] # For both statement and row based bin logs 9/19/2005 [jbm]
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/binlog_tests/mix_innodb_myisam_binlog.test -- source extra/binlog_tests/mix_innodb_myisam_binlog.test
# This piece below cannot be put into # This piece below cannot be put into
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# inconsistency between binlog and the internal list of temp tables. # inconsistency between binlog and the internal list of temp tables.
# This does not work for RBR yet. # This does not work for RBR yet.
--source include/have_binlog_format_statement.inc --source include/have_binlog_format_mixed_or_statement.inc
-- source include/have_innodb.inc -- source include/have_innodb.inc
--disable_warnings --disable_warnings
......
# This is a wrapper for binlog.test so that the same test case can be used # This is a wrapper for binlog.test so that the same test case can be used
# For both statement and row based bin logs 11/07/2005 [jbm] # For both statement and row based bin logs 11/07/2005 [jbm]
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/binlog_tests/ctype_cp932_binlog.test -- source extra/binlog_tests/ctype_cp932_binlog.test
# #
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
drop table if exists t1; drop table if exists t1;
--enable_warnings --enable_warnings
--replace_result ROW <format> STATEMENT <format> --replace_result ROW <format> STATEMENT <format> MIXED <format>
SHOW GLOBAL VARIABLES LIKE "%_format%"; SHOW GLOBAL VARIABLES LIKE "%_format%";
--replace_result ROW <format> STATEMENT <format> --replace_result ROW <format> STATEMENT <format> MIXED <format>
SHOW SESSION VARIABLES LIKE "%_format%"; SHOW SESSION VARIABLES LIKE "%_format%";
# #
...@@ -36,7 +36,7 @@ set datetime_format= '%H:%i:%s.%f %m-%d-%Y'; ...@@ -36,7 +36,7 @@ set datetime_format= '%H:%i:%s.%f %m-%d-%Y';
set datetime_format= '%h:%i:%s %p %Y-%m-%d'; set datetime_format= '%h:%i:%s %p %Y-%m-%d';
set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d'; set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
--replace_result ROW <format> STATEMENT <format> --replace_result ROW <format> STATEMENT <format> MIXED <format>
SHOW SESSION VARIABLES LIKE "%format"; SHOW SESSION VARIABLES LIKE "%format";
--error 1231 --error 1231
......
# We are using .opt file since we need small binlog size # We are using .opt file since we need small binlog size
# TODO: Need to look at making a row based version once the new row based client is completed. [jbm] # TODO: Need to look at making a row based version once the new row based client is completed. [jbm]
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
# Embedded server doesn't support binlogging # Embedded server doesn't support binlogging
-- source include/not_embedded.inc -- source include/not_embedded.inc
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# and a few others. # and a few others.
# TODO: Need to look at making row based version once new binlog client is complete. # TODO: Need to look at making row based version once new binlog client is complete.
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
# Embedded server doesn't support binlogging # Embedded server doesn't support binlogging
-- source include/not_embedded.inc -- source include/not_embedded.inc
......
-- source include/have_ndb.inc -- source include/have_ndb.inc
-- source include/have_multi_ndb.inc -- source include/have_multi_ndb.inc
-- source include/not_embedded.inc -- source include/not_embedded.inc
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
--disable_warnings --disable_warnings
connection server2; connection server2;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# in row-based, it hangs waiting for an offset which is never # in row-based, it hangs waiting for an offset which is never
# reached (the "sync_with_master 1"), logically. # reached (the "sync_with_master 1"), logically.
--source include/have_binlog_format_statement.inc --source include/have_binlog_format_mixed_or_statement.inc
source include/master-slave.inc; source include/master-slave.inc;
save_master_pos; save_master_pos;
connection slave; connection slave;
......
# Requires statement logging # Requires statement logging
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
# You must run this test with --manager. # You must run this test with --manager.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# replicated LOAD DATA INFILE correctly when it has binlog_*_db rules. # replicated LOAD DATA INFILE correctly when it has binlog_*_db rules.
# This is for BUG#1100 (LOAD DATA INFILE was half-logged). # This is for BUG#1100 (LOAD DATA INFILE was half-logged).
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source include/master-slave.inc -- source include/master-slave.inc
connection slave; connection slave;
......
# Mixed DDL-DML (CREATE ... SELECT ...) statements can only be # Mixed DDL-DML (CREATE ... SELECT ...) statements can only be
# replicated properly in statement-based replication. # replicated properly in statement-based replication.
# Currently statement based due to bug 12345 # Currently statement based due to bug 12345
--source include/have_binlog_format_statement.inc --source include/have_binlog_format_mixed_or_statement.inc
source include/master-slave.inc; source include/master-slave.inc;
......
-- source include/have_row_based.inc -- source include/have_row_based.inc
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source include/master-slave.inc -- source include/master-slave.inc
# Test that the slave temporarily switches to ROW when seeing binrow # Test that the slave temporarily switches to ROW when seeing binrow
# events when it is in STATEMENT or MIXED mode # events when it is in STATEMENT or MIXED mode
SET BINLOG_FORMAT=MIXED; SET BINLOG_FORMAT=MIXED;
SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT;
SET GLOBAL BINLOG_FORMAT=MIXED; SET GLOBAL BINLOG_FORMAT=MIXED;
SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT; SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT;
......
# TBF - difference in row level logging # TBF - difference in row level logging
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source include/master-slave.inc -- source include/master-slave.inc
--disable_warnings --disable_warnings
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# - Test creating a duplicate key error and recover from it # - Test creating a duplicate key error and recover from it
# Requires statement logging # Requires statement logging
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
--disable_warnings --disable_warnings
......
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
# Date: 2006-01-11 # Date: 2006-01-11
# Purpose: Engine Wrapper for rpl_stm_EE_err2.test # Purpose: Engine Wrapper for rpl_stm_EE_err2.test
############################## ##############################
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
let $engine_type=myisam; let $engine_type=myisam;
-- source extra/rpl_tests/rpl_stm_EE_err2.test -- source extra/rpl_tests/rpl_stm_EE_err2.test
# depends on the binlog output # depends on the binlog output
--source include/have_binlog_format_statement.inc --source include/have_binlog_format_mixed_or_statement.inc
let $rename_event_pos= 652; let $rename_event_pos= 652;
-- source extra/rpl_tests/rpl_flsh_tbls.test -- source extra/rpl_tests/rpl_flsh_tbls.test
......
# Requires statement logging # Requires statement logging
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
let $engine_type=MyISAM; let $engine_type=MyISAM;
-- source extra/rpl_tests/rpl_log.test -- source extra/rpl_tests/rpl_log.test
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# Test of manual relay log rotation with FLUSH LOGS. # Test of manual relay log rotation with FLUSH LOGS.
# Requires statement logging # Requires statement logging
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/rpl_tests/rpl_max_relay_size.test -- source extra/rpl_tests/rpl_max_relay_size.test
# End of 4.1 tests # End of 4.1 tests
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# one binlog event containing all queries) # one binlog event containing all queries)
# Requires statement logging # Requires statement logging
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/rpl_tests/rpl_multi_query.test -- source extra/rpl_tests/rpl_multi_query.test
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#should proceed in a correct way. #should proceed in a correct way.
################################# #################################
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source include/master-slave.inc -- source include/master-slave.inc
# first, cause a duplicate key problem on the slave # first, cause a duplicate key problem on the slave
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# case. So this test is meaningul only in statement-based (and if it was # case. So this test is meaningul only in statement-based (and if it was
# enabled in row-based, it would fail as expected). # enabled in row-based, it would fail as expected).
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
source include/master-slave.inc; source include/master-slave.inc;
......
# TBF - difference in row level logging # TBF - difference in row level logging
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/rpl_tests/rpl_reset_slave.test -- source extra/rpl_tests/rpl_reset_slave.test
# End of 4.1 tests # End of 4.1 tests
......
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source include/master-slave.inc -- source include/master-slave.inc
# Test is dependent on binlog positions # Test is dependent on binlog positions
......
# drop table t1 t2 t3 are included int master-slave.inc # drop table t1 t2 t3 are included int master-slave.inc
# meaningful only in statement-based: # meaningful only in statement-based:
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
-- source include/master-slave.inc -- source include/master-slave.inc
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Test of triggers with replication # Test of triggers with replication
# Adding statement include due to Bug 12574 # Adding statement include due to Bug 12574
# TODO: Remove statement include once 12574 is patched # TODO: Remove statement include once 12574 is patched
--source include/have_binlog_format_statement.inc --source include/have_binlog_format_mixed_or_statement.inc
--source include/master-slave.inc --source include/master-slave.inc
--disable_warnings --disable_warnings
......
# Requires statement logging # Requires statement logging
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
source include/master-slave.inc; source include/master-slave.inc;
......
# Requires statement logging # Requires statement logging
-- source include/have_binlog_format_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
# TODO: Create row based version once $MYSQL_BINLOG has new RB version # TODO: Create row based version once $MYSQL_BINLOG has new RB version
# Embedded server does not support binlogging # Embedded server does not support binlogging
--source include/not_embedded.inc --source include/not_embedded.inc
......
...@@ -7387,7 +7387,9 @@ innobase_xa_prepare( ...@@ -7387,7 +7387,9 @@ innobase_xa_prepare(
int error = 0; int error = 0;
trx_t* trx = check_trx_exists(thd); trx_t* trx = check_trx_exists(thd);
if (thd->lex->sql_command != SQLCOM_XA_PREPARE) { if (thd->lex->sql_command != SQLCOM_XA_PREPARE &&
(all || !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))))
{
/* For ibbackup to work the order of transactions in binlog /* For ibbackup to work the order of transactions in binlog
and InnoDB must be the same. Consider the situation and InnoDB must be the same. Consider the situation
......
...@@ -3135,7 +3135,11 @@ with --log-bin instead."); ...@@ -3135,7 +3135,11 @@ with --log-bin instead.");
global_system_variables.binlog_format= BINLOG_FORMAT_ROW; global_system_variables.binlog_format= BINLOG_FORMAT_ROW;
else else
#endif #endif
#if defined(HAVE_ROW_BASED_REPLICATION)
global_system_variables.binlog_format= BINLOG_FORMAT_MIXED;
#else
global_system_variables.binlog_format= BINLOG_FORMAT_STMT; global_system_variables.binlog_format= BINLOG_FORMAT_STMT;
#endif
} }
/* Check that we have not let the format to unspecified at this point */ /* Check that we have not let the format to unspecified at this point */
...@@ -4936,7 +4940,13 @@ Disable with --skip-bdb (will save memory).", ...@@ -4936,7 +4940,13 @@ Disable with --skip-bdb (will save memory).",
"supports only statement-based binary logging, so only 'statement' is " "supports only statement-based binary logging, so only 'statement' is "
"a legal value." "a legal value."
#endif #endif
, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, , 0, 0, 0, GET_STR, REQUIRED_ARG,
#ifdef HAVE_ROW_BASED_REPLICATION
BINLOG_FORMAT_MIXED
#else
BINLOG_FORMAT_STMT
#endif
, 0, 0, 0, 0, 0 },
{"binlog-do-db", OPT_BINLOG_DO_DB, {"binlog-do-db", OPT_BINLOG_DO_DB,
"Tells the master it should log updates for the specified database, and exclude all others not explicitly mentioned.", "Tells the master it should log updates for the specified database, and exclude all others not explicitly mentioned.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
......
SUBDIRS = mytap . mysys examples SUBDIRS = mytap . mysys examples
noinst_SCRIPTS = unit
EXTRA_DIST = unit.pl EXTRA_DIST = unit.pl
CLEANFILES = unit CLEANFILES = unit
unittests = mytap mysys unittests = mytap mysys
test: unit test:
./unit run $(unittests) perl unit.pl run $(unittests)
unit: $(srcdir)/unit.pl
cp $(srcdir)/unit.pl $@
chmod 700 $@
test-verbose:
HARNESS_VERBOSE=1 perl unit.pl run $(unittests)
...@@ -9,7 +9,9 @@ mytap Source for the MyTAP library ...@@ -9,7 +9,9 @@ mytap Source for the MyTAP library
mysys Tests for mysys components mysys Tests for mysys components
bitmap-t.c Unit test for MY_BITMAP bitmap-t.c Unit test for MY_BITMAP
base64-t.c Unit test for base64 encoding functions base64-t.c Unit test for base64 encoding functions
examples Example unit tests examples Example unit tests.
core-t.c Example of raising a signal in the middle of the test
THIS TEST WILL STOP ALL FURTHER TESTING!
simple-t.c Example of a standard TAP unit test simple-t.c Example of a standard TAP unit test
skip-t.c Example where some test points are skipped skip-t.c Example where some test points are skipped
skip_all-t.c Example of a test where the entire test is skipped skip_all-t.c Example of a test where the entire test is skipped
...@@ -24,6 +26,9 @@ To make and execute all unit tests in the directory: ...@@ -24,6 +26,9 @@ To make and execute all unit tests in the directory:
make test make test
Observe that the tests in the examples/ directory are just various
examples of tests and are not expected to pass.
Adding unit tests Adding unit tests
----------------- -----------------
......
...@@ -5,5 +5,5 @@ AM_LDFLAGS = -L$(top_builddir)/unittest/mytap ...@@ -5,5 +5,5 @@ AM_LDFLAGS = -L$(top_builddir)/unittest/mytap
LDADD = -lmytap LDADD = -lmytap
noinst_PROGRAMS = simple-t skip-t todo-t skip_all-t no_plan-t noinst_PROGRAMS = simple-t skip-t todo-t skip_all-t no_plan-t core-t
#include "my_config.h"
#include <stdlib.h>
#include <tap.h>
/*
This is a simple test to demonstrate what happens if a signal that
generates a core is raised.
Note that this test will stop all further testing!
*/
int main() {
plan(3);
ok(1, "First test");
abort();
return exit_status();
}
...@@ -20,10 +20,13 @@ ...@@ -20,10 +20,13 @@
#include "tap.h" #include "tap.h"
#include "my_config.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <signal.h>
/** /**
Test data structure. Test data structure.
...@@ -70,7 +73,7 @@ emit_tap(int pass, char const *fmt, va_list ap) ...@@ -70,7 +73,7 @@ emit_tap(int pass, char const *fmt, va_list ap)
/** /**
Emit a TAP directive. Emit a TAP directive.
TAP directives are comments after a have the form TAP directives are comments after that have the form:
@code @code
ok 1 # skip reason for skipping ok 1 # skip reason for skipping
...@@ -96,6 +99,25 @@ emit_endl() ...@@ -96,6 +99,25 @@ emit_endl()
fprintf(tapout, "\n"); fprintf(tapout, "\n");
} }
static void
handle_core_signal(int signo)
{
BAIL_OUT("Signal %d thrown", signo);
}
void
BAIL_OUT(char const *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
fprintf(tapout, "Bail out! ");
vfprintf(tapout, fmt, ap);
emit_endl();
va_end(ap);
exit(255);
}
void void
diag(char const *fmt, ...) diag(char const *fmt, ...)
{ {
...@@ -103,14 +125,38 @@ diag(char const *fmt, ...) ...@@ -103,14 +125,38 @@ diag(char const *fmt, ...)
va_start(ap, fmt); va_start(ap, fmt);
fprintf(tapout, "# "); fprintf(tapout, "# ");
vfprintf(tapout, fmt, ap); vfprintf(tapout, fmt, ap);
fprintf(tapout, "\n"); emit_endl();
va_end(ap); va_end(ap);
} }
typedef struct signal_entry {
int signo;
void (*handler)(int);
} signal_entry;
static signal_entry install_signal[]= {
{ SIGQUIT, handle_core_signal },
{ SIGILL, handle_core_signal },
{ SIGABRT, handle_core_signal },
{ SIGFPE, handle_core_signal },
{ SIGSEGV, handle_core_signal },
{ SIGBUS, handle_core_signal },
{ SIGXCPU, handle_core_signal },
{ SIGXFSZ, handle_core_signal },
{ SIGSYS, handle_core_signal },
{ SIGTRAP, handle_core_signal }
};
void void
plan(int const count) plan(int const count)
{ {
/*
Install signal handler
*/
size_t i;
for (i= 0; i < sizeof(install_signal)/sizeof(*install_signal); ++i)
signal(install_signal[i].signo, install_signal[i].handler);
g_test.plan= count; g_test.plan= count;
switch (count) switch (count)
{ {
......
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
#include "my_global.h" #include "my_global.h"
/* /*
@defgroup MyTAP MySQL support for performing unit tests according to TAP. @defgroup MyTAP MySQL support for performing unit tests according to
the Test Anything Protocol (TAP).
*/ */
#define NO_PLAN (0) #define NO_PLAN (0)
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
@internal We are using the "typedef struct X { ... } X" idiom to @internal We are using the "typedef struct X { ... } X" idiom to
create class/struct X both in C and C++. create class/struct X both in C and C++.
*/ */
typedef struct TEST_DATA { typedef struct TEST_DATA {
/** /**
Number of tests that is planned to execute. Number of tests that is planned to execute.
...@@ -67,8 +68,13 @@ extern "C" { ...@@ -67,8 +68,13 @@ extern "C" {
it was called with <code>NO_PLAN</code>, i.e., the test plan will it was called with <code>NO_PLAN</code>, i.e., the test plan will
be printed after all the test lines. be printed after all the test lines.
The plan() function will install signal handlers for all signals
that generate a core, so if you want to override these signals, do
it <em>after</em> you have called the plan() function.
@param count The planned number of tests to run. @param count The planned number of tests to run.
*/ */
void plan(int count); void plan(int count);
...@@ -87,9 +93,11 @@ void plan(int count); ...@@ -87,9 +93,11 @@ void plan(int count);
@param fmt Format string in printf() format. NULL is allowed, in @param fmt Format string in printf() format. NULL is allowed, in
which case nothing is printed. which case nothing is printed.
*/ */
void ok(int pass, char const *fmt, ...) void ok(int pass, char const *fmt, ...)
__attribute__((format(printf,2,3))); __attribute__((format(printf,2,3)));
/** /**
Skip a determined number of tests. Skip a determined number of tests.
...@@ -114,6 +122,7 @@ void ok(int pass, char const *fmt, ...) ...@@ -114,6 +122,7 @@ void ok(int pass, char const *fmt, ...)
@param how_many Number of tests that are to be skipped. @param how_many Number of tests that are to be skipped.
@param reason A reason for skipping the tests @param reason A reason for skipping the tests
*/ */
void skip(int how_many, char const *reason, ...) void skip(int how_many, char const *reason, ...)
__attribute__((format(printf,2,3))); __attribute__((format(printf,2,3)));
...@@ -130,22 +139,47 @@ void skip(int how_many, char const *reason, ...) ...@@ -130,22 +139,47 @@ void skip(int how_many, char const *reason, ...)
for (i = 0 ; i < 2 ; ++i) for (i = 0 ; i < 2 ; ++i)
ok(duck[i] == paddling, "is duck %d paddling?", i); ok(duck[i] == paddling, "is duck %d paddling?", i);
} }
@endcode
@see skip @see skip
@endcode
*/ */
#define SKIP_BLOCK_IF(SKIP_IF_TRUE, COUNT, REASON) \ #define SKIP_BLOCK_IF(SKIP_IF_TRUE, COUNT, REASON) \
if (SKIP_IF_TRUE) skip((COUNT),(REASON)); else if (SKIP_IF_TRUE) skip((COUNT),(REASON)); else
/** /**
Print a diagnostics message. Print a diagnostics message.
@param fmt Diagnostics message in printf() format. @param fmt Diagnostics message in printf() format.
*/ */
void diag(char const *fmt, ...) void diag(char const *fmt, ...)
__attribute__((format(printf,1,2))); __attribute__((format(printf,1,2)));
/**
Print a bail out message.
A bail out message can be issued when no further testing can be
done, e.g., when there are missing dependencies.
The test will exit with status 255. This function does not return.
@code
BAIL_OUT("Lost connection to server %s", server_name);
@endcode
@note A bail out message is printed if a signal that generates a
core is raised.
@param fmt Bail out message in printf() format.
*/
void BAIL_OUT(char const *fmt, ...)
__attribute__((noreturn, format(printf,1,2)));
/** /**
Print summary report and return exit status. Print summary report and return exit status.
...@@ -161,6 +195,7 @@ void diag(char const *fmt, ...) ...@@ -161,6 +195,7 @@ void diag(char const *fmt, ...)
@returns EXIT_SUCCESS if all tests passed, EXIT_FAILURE if one or @returns EXIT_SUCCESS if all tests passed, EXIT_FAILURE if one or
more tests failed. more tests failed.
*/ */
int exit_status(void); int exit_status(void);
...@@ -171,9 +206,11 @@ int exit_status(void); ...@@ -171,9 +206,11 @@ int exit_status(void);
automatically call exit(), so there is no need to have checks automatically call exit(), so there is no need to have checks
around it. around it.
*/ */
void skip_all(char const *reason, ...) void skip_all(char const *reason, ...)
__attribute__((noreturn, format(printf, 1, 2))); __attribute__((noreturn, format(printf, 1, 2)));
/** /**
Start section of tests that are not yet ready. Start section of tests that are not yet ready.
...@@ -194,14 +231,18 @@ void skip_all(char const *reason, ...) ...@@ -194,14 +231,18 @@ void skip_all(char const *reason, ...)
@param message Message that will be printed before the todo tests. @param message Message that will be printed before the todo tests.
*/ */
void todo_start(char const *message, ...) void todo_start(char const *message, ...)
__attribute__((format (printf, 1, 2))); __attribute__((format(printf, 1, 2)));
/** /**
End a section of tests that are not yet ready. End a section of tests that are not yet ready.
*/ */
void todo_end(); void todo_end();
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
#!/usr/bin/perl #!/usr/bin/perl
# Override _command_line in the standard Perl test harness to prevent
# it from using "perl" to run the test scripts.
package MySQL::Straps;
use base qw(Test::Harness::Straps);
use strict;
sub _command_line {
return $_[1]
}
package main;
use Test::Harness qw(&runtests $verbose); use Test::Harness qw(&runtests $verbose);
use File::Find; use File::Find;
...@@ -37,9 +23,6 @@ unit - Run unit tests in directory ...@@ -37,9 +23,6 @@ unit - Run unit tests in directory
my $cmd = shift; my $cmd = shift;
# $Test::Harness::Verbose = 1;
# $Test::Harness::Debug = 1;
if (defined $cmd && exists $dispatch{$cmd}) { if (defined $cmd && exists $dispatch{$cmd}) {
$dispatch{$cmd}->(@ARGV); $dispatch{$cmd}->(@ARGV);
} else { } else {
...@@ -95,14 +78,7 @@ sub run_cmd (@) { ...@@ -95,14 +78,7 @@ sub run_cmd (@) {
if (@files > 0) { if (@files > 0) {
# Removing the first './' from the file names # Removing the first './' from the file names
foreach (@files) { s!^\./!! } foreach (@files) { s!^\./!! }
$ENV{'HARNESS_PERL_SWITCHES'} .= q" -e 'exec @ARGV'";
# Install the strap above instead of the default strap. Since
# we are replacing the straps under the feet of Test::Harness,
# we need to do some basic initializations in the new straps.
$Test::Harness::Strap = MySQL::Straps->new;
$Test::Harness::Strap->{callback} = \&Test::Harness::strap_callback
if defined &Test::Harness::strap_callback;
runtests @files; runtests @files;
} }
} }
......
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