mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Merge mysql.com:/home/bkroot/mysql-5.1-new
into mysql.com:/home/bk/w3171-mysql-5.1-new
This commit is contained in:
69
mysql-test/r/rpl_rbr_to_sbr.result
Normal file
69
mysql-test/r/rpl_rbr_to_sbr.result
Normal file
@@ -0,0 +1,69 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
SET BINLOG_FORMAT=MIXED;
|
||||
SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT;
|
||||
@@GLOBAL.BINLOG_FORMAT @@SESSION.BINLOG_FORMAT
|
||||
STATEMENT MIXED
|
||||
SET GLOBAL BINLOG_FORMAT=MIXED;
|
||||
SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT;
|
||||
@@GLOBAL.BINLOG_FORMAT @@SESSION.BINLOG_FORMAT
|
||||
MIXED MIXED
|
||||
**** On Master ****
|
||||
CREATE TABLE t1 (a INT, b LONG);
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
INSERT INTO t1 VALUES (3,UUID()), (4,UUID());
|
||||
SHOW BINLOG EVENTS;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 102 Server ver: 5.1.8-beta-debug-log, Binlog ver: 4
|
||||
master-bin.000001 102 Query 1 196 use `test`; CREATE TABLE t1 (a INT, b LONG)
|
||||
master-bin.000001 196 Query 1 293 use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
|
||||
master-bin.000001 293 Table_map 1 333 test.t1
|
||||
master-bin.000001 333 Write_rows 1 450
|
||||
**** On Slave ****
|
||||
SHOW SLAVE STATUS;
|
||||
Slave_IO_State #
|
||||
Master_Host 127.0.0.1
|
||||
Master_User root
|
||||
Master_Port MASTER_PORT
|
||||
Connect_Retry 1
|
||||
Master_Log_File master-bin.000001
|
||||
Read_Master_Log_Pos 450
|
||||
Relay_Log_File #
|
||||
Relay_Log_Pos #
|
||||
Relay_Master_Log_File master-bin.000001
|
||||
Slave_IO_Running Yes
|
||||
Slave_SQL_Running Yes
|
||||
Replicate_Do_DB
|
||||
Replicate_Ignore_DB
|
||||
Replicate_Do_Table
|
||||
Replicate_Ignore_Table
|
||||
Replicate_Wild_Do_Table
|
||||
Replicate_Wild_Ignore_Table
|
||||
Last_Errno 0
|
||||
Last_Error
|
||||
Skip_Counter 0
|
||||
Exec_Master_Log_Pos 450
|
||||
Relay_Log_Space #
|
||||
Until_Condition None
|
||||
Until_Log_File
|
||||
Until_Log_Pos 0
|
||||
Master_SSL_Allowed No
|
||||
Master_SSL_CA_File
|
||||
Master_SSL_CA_Path
|
||||
Master_SSL_Cert
|
||||
Master_SSL_Cipher
|
||||
Master_SSL_Key
|
||||
Seconds_Behind_Master #
|
||||
SHOW BINLOG EVENTS;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-bin.000001 4 Format_desc 2 102 Server ver: 5.1.8-beta-debug-log, Binlog ver: 4
|
||||
slave-bin.000001 102 Query 2 212 use `test`; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9
|
||||
slave-bin.000001 212 Query 1 306 use `test`; CREATE TABLE t1 (a INT, b LONG)
|
||||
slave-bin.000001 306 Query 1 403 use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
|
||||
slave-bin.000001 403 Table_map 1 443 test.t1
|
||||
slave-bin.000001 443 Write_rows 1 560
|
||||
DROP TABLE IF EXISTS t1;
|
||||
40
mysql-test/t/rpl_rbr_to_sbr.test
Normal file
40
mysql-test/t/rpl_rbr_to_sbr.test
Normal file
@@ -0,0 +1,40 @@
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
# Test that the slave temporarily switches to ROW when seeing binrow
|
||||
# events when it is in STATEMENT or MIXED mode
|
||||
|
||||
SET BINLOG_FORMAT=MIXED;
|
||||
SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT;
|
||||
SET GLOBAL BINLOG_FORMAT=MIXED;
|
||||
SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT;
|
||||
|
||||
--echo **** On Master ****
|
||||
CREATE TABLE t1 (a INT, b LONG);
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
INSERT INTO t1 VALUES (3,UUID()), (4,UUID());
|
||||
SHOW BINLOG EVENTS;
|
||||
sync_slave_with_master;
|
||||
--echo **** On Slave ****
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 23 # 33 #
|
||||
--query_vertical SHOW SLAVE STATUS
|
||||
SHOW BINLOG EVENTS;
|
||||
|
||||
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql
|
||||
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql
|
||||
|
||||
connection master;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
# Let's compare. Note: If they match test will pass, if they do not match
|
||||
# the test will show that the diff statement failed and not reject file
|
||||
# will be created. You will need to go to the mysql-test dir and diff
|
||||
# the files your self to see what is not matching
|
||||
|
||||
--exec diff $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql;
|
||||
|
||||
# If all is good, we can remove the files
|
||||
|
||||
system rm $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql;
|
||||
system rm $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql;
|
||||
@@ -5452,6 +5452,7 @@ int Rows_log_event::exec_event(st_relay_log_info *rli)
|
||||
For now we code, knowing that error is not skippable and so slave SQL
|
||||
thread is certainly going to stop.
|
||||
*/
|
||||
thd->reset_current_stmt_binlog_row_based();
|
||||
rli->cleanup_context(thd, 1);
|
||||
thd->query_error= 1;
|
||||
DBUG_RETURN(error);
|
||||
@@ -5495,6 +5496,7 @@ int Rows_log_event::exec_event(st_relay_log_info *rli)
|
||||
event flushed.
|
||||
*/
|
||||
|
||||
thd->reset_current_stmt_binlog_row_based();
|
||||
rli->cleanup_context(thd, 0);
|
||||
rli->transaction_end(thd);
|
||||
|
||||
@@ -5856,24 +5858,14 @@ int Table_map_log_event::exec_event(st_relay_log_info *rli)
|
||||
(!rpl_filter->is_on() || rpl_filter->tables_ok("", &table_list)))
|
||||
{
|
||||
/*
|
||||
TODO: Mats will soon change this test below so that a SBR slave always
|
||||
accepts RBR events from the master (and binlogs them RBR).
|
||||
Check if the slave is set to use SBR. If so, it should switch
|
||||
to using RBR until the end of the "statement", i.e., next
|
||||
STMT_END_F or next error.
|
||||
*/
|
||||
/*
|
||||
Check if the slave is set to use SBR. If so, the slave should
|
||||
stop immediately since it is not possible to daisy-chain from
|
||||
RBR to SBR. Once RBR is used, the rest of the chain has to use
|
||||
RBR.
|
||||
*/
|
||||
if (mysql_bin_log.is_open() && (thd->options & OPTION_BIN_LOG) &&
|
||||
!thd->current_stmt_binlog_row_based)
|
||||
if (!thd->current_stmt_binlog_row_based &&
|
||||
mysql_bin_log.is_open() && (thd->options & OPTION_BIN_LOG))
|
||||
{
|
||||
slave_print_msg(ERROR_LEVEL, rli, ER_BINLOG_ROW_RBR_TO_SBR,
|
||||
"It is not possible to use statement-based binlogging "
|
||||
"on a slave that replicates row-based. Please use "
|
||||
"--binrow-format=row on slave if you want to use "
|
||||
"--log-slave-updates and read row-based binlog events.");
|
||||
DBUG_RETURN(ERR_RBR_TO_SBR);
|
||||
thd->set_current_stmt_binlog_row_based();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1387,6 +1387,10 @@ public:
|
||||
if (variables.binlog_format == BINLOG_FORMAT_MIXED)
|
||||
current_stmt_binlog_row_based= 1;
|
||||
}
|
||||
inline void set_current_stmt_binlog_row_based()
|
||||
{
|
||||
current_stmt_binlog_row_based= 1;
|
||||
}
|
||||
inline void reset_current_stmt_binlog_row_based()
|
||||
{
|
||||
current_stmt_binlog_row_based= test(variables.binlog_format == BINLOG_FORMAT_ROW);
|
||||
|
||||
Reference in New Issue
Block a user