Commit 56edc1df authored by unknown's avatar unknown

Manual merge

parents f60106f8 10812c07
...@@ -21,9 +21,18 @@ ...@@ -21,9 +21,18 @@
# and slave are diverging. # and slave are diverging.
# #
######################################################################################## ########################################################################################
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
let $old_max_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_cache_size", Value, 1);
let $old_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "binlog_cache_size", Value, 1);
SET GLOBAL max_binlog_cache_size = 4096;
# Becuase of bug#55377, we have to set binlog_cache_size until the bug is
# fixed.
SET GLOBAL binlog_cache_size = 4096;
disconnect master;
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb; CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam; CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam;
CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb; CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
...@@ -50,13 +59,9 @@ eval INSERT INTO t2 (a, data) VALUES (2, ...@@ -50,13 +59,9 @@ eval INSERT INTO t2 (a, data) VALUES (2,
CONCAT($data, $data, $data, $data, $data, $data)); CONCAT($data, $data, $data, $data, $data, $data));
--enable_query_log --enable_query_log
connection slave; # Incident event
--source include/wait_for_slave_sql_to_stop.inc --let $slave_sql_errno=1590
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; --source include/wait_for_slave_sql_error_and_skip.inc
START SLAVE SQL_THREAD;
--source include/wait_for_slave_sql_to_start.inc
connection master;
--disable_query_log --disable_query_log
eval INSERT INTO t1 (a, data) VALUES (3, $data); eval INSERT INTO t1 (a, data) VALUES (3, $data);
...@@ -74,23 +79,15 @@ eval UPDATE t2, t1 SET t2.data = CONCAT($data, $data, $data, $data), ...@@ -74,23 +79,15 @@ eval UPDATE t2, t1 SET t2.data = CONCAT($data, $data, $data, $data),
t1.data = CONCAT($data, $data, $data, $data); t1.data = CONCAT($data, $data, $data, $data);
--enable_query_log --enable_query_log
connection slave; # Incident event
--source include/wait_for_slave_sql_to_stop.inc --let $slave_skip_counter=1
if (`SELECT @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
{
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
}
if (`SELECT @@binlog_format = 'ROW'`) if (`SELECT @@binlog_format = 'ROW'`)
{ {
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 2; --inc $slave_skip_counter
} }
START SLAVE SQL_THREAD; --let $slave_sql_errno=1590
--source include/wait_for_slave_sql_to_start.inc --source include/wait_for_slave_sql_error_and_skip.inc
connection master; --let $slave_skip_counter=
let $diff_statement= SELECT * FROM t1;
--source include/diff_master_slave.inc
--echo ######################################################################################## --echo ########################################################################################
--echo # 2 - BEGIN - IMPLICIT COMMIT by DDL --echo # 2 - BEGIN - IMPLICIT COMMIT by DDL
...@@ -178,17 +175,6 @@ BEGIN; ...@@ -178,17 +175,6 @@ BEGIN;
CREATE TABLE t5 (a int); CREATE TABLE t5 (a int);
--enable_query_log --enable_query_log
if (`SELECT @@binlog_format = 'ROW'`)
{
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
START SLAVE SQL_THREAD;
--source include/wait_for_slave_sql_to_start.inc
connection master;
}
let $diff_statement= SELECT * FROM t1; let $diff_statement= SELECT * FROM t1;
--source include/diff_master_slave.inc --source include/diff_master_slave.inc
...@@ -373,6 +359,70 @@ COMMIT; ...@@ -373,6 +359,70 @@ COMMIT;
let $diff_statement= SELECT * FROM t1; let $diff_statement= SELECT * FROM t1;
--source include/diff_master_slave.inc --source include/diff_master_slave.inc
--echo ########################################################################
--echo # 8 - Bug#55375(Regression Bug) Transaction bigger than
--echo # max_binlog_cache_size crashes slave
--echo ########################################################################
--echo # [ On Slave ]
SET GLOBAL max_binlog_cache_size = 4096;
SET GLOBAL binlog_cache_size = 4096;
source include/stop_slave.inc;
source include/start_slave.inc;
CALL mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage.*");
CALL mtr.add_suppression("Writing one row to the row-based binary log failed.*");
connection master;
TRUNCATE t1;
sync_slave_with_master;
--let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1)
--let binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
connection master;
--replace_result $old_max_binlog_cache_size ORIGINAL_VALUE
--eval SET GLOBAL max_binlog_cache_size= $old_max_binlog_cache_size
--replace_result $old_binlog_cache_size ORIGINAL_VALUE
--eval SET GLOBAL binlog_cache_size= $old_binlog_cache_size
disconnect master;
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
--let $n=128
BEGIN;
--disable_query_log
--echo Repeat statement 'INSERT INTO t1 VALUES(\$n, repeat("a", 32))' $n times
while ($n)
{
--eval INSERT INTO t1 VALUES ($n, repeat("a", 32))
--dec $n
}
--enable_query_log
COMMIT;
connection slave;
--let $slave_sql_errno= 1197
if (`SELECT @@binlog_format = 'ROW'`)
{
--let $slave_sql_errno= 1534
}
source include/wait_for_slave_sql_error.inc;
SELECT count(*) FROM t1;
source include/show_binlog_events.inc;
--replace_result $old_max_binlog_cache_size ORIGINAL_VALUE
--eval SET GLOBAL max_binlog_cache_size= $old_max_binlog_cache_size
--replace_result $old_binlog_cache_size ORIGINAL_VALUE
--eval SET GLOBAL binlog_cache_size= $old_binlog_cache_size
source include/stop_slave.inc;
source include/start_slave.inc;
connection master;
sync_slave_with_master;
SELECT count(*) FROM t1;
--echo ######################################################################################## --echo ########################################################################################
--echo # CLEAN --echo # CLEAN
--echo ######################################################################################## --echo ########################################################################################
...@@ -385,4 +435,4 @@ DROP TABLE IF EXISTS t4; ...@@ -385,4 +435,4 @@ DROP TABLE IF EXISTS t4;
DROP TABLE IF EXISTS t5; DROP TABLE IF EXISTS t5;
DROP TABLE IF EXISTS t6; DROP TABLE IF EXISTS t6;
DROP PROCEDURE p1; DROP PROCEDURE p1;
sync_slave_with_master; source include/master-slave-end.inc;
...@@ -5,6 +5,8 @@ reset slave; ...@@ -5,6 +5,8 @@ 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;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
SET GLOBAL max_binlog_cache_size = 4096;
SET GLOBAL binlog_cache_size = 4096;
CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb; CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam; CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam;
CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb; CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
...@@ -15,13 +17,14 @@ CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb; ...@@ -15,13 +17,14 @@ CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
Got one of the listed errors Got one of the listed errors
*** Single statement on non-transactional table *** *** Single statement on non-transactional table ***
Got one of the listed errors Got one of the listed errors
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; --source include/wait_for_slave_sql_error_and_skip.inc
START SLAVE SQL_THREAD; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
*** Single statement on both transactional and non-transactional tables. *** *** Single statement on both transactional and non-transactional tables. ***
Got one of the listed errors Got one of the listed errors
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 2; --source include/wait_for_slave_sql_error_and_skip.inc
START SLAVE SQL_THREAD; SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
source include/diff_master_slave.inc; include/start_slave.inc
######################################################################################## ########################################################################################
# 2 - BEGIN - IMPLICIT COMMIT by DDL # 2 - BEGIN - IMPLICIT COMMIT by DDL
######################################################################################## ########################################################################################
...@@ -39,8 +42,6 @@ Got one of the listed errors ...@@ -39,8 +42,6 @@ Got one of the listed errors
BEGIN; BEGIN;
Got one of the listed errors Got one of the listed errors
Got one of the listed errors Got one of the listed errors
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
START SLAVE SQL_THREAD;
source include/diff_master_slave.inc; source include/diff_master_slave.inc;
######################################################################################## ########################################################################################
# 3 - BEGIN - COMMIT # 3 - BEGIN - COMMIT
...@@ -122,6 +123,35 @@ BEGIN; ...@@ -122,6 +123,35 @@ BEGIN;
Got one of the listed errors Got one of the listed errors
COMMIT; COMMIT;
source include/diff_master_slave.inc; source include/diff_master_slave.inc;
########################################################################
# 8 - Bug#55375(Regression Bug) Transaction bigger than
# max_binlog_cache_size crashes slave
########################################################################
# [ On Slave ]
SET GLOBAL max_binlog_cache_size = 4096;
SET GLOBAL binlog_cache_size = 4096;
include/stop_slave.inc
include/start_slave.inc
CALL mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage.*");
CALL mtr.add_suppression("Writing one row to the row-based binary log failed.*");
TRUNCATE t1;
SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
BEGIN;
Repeat statement 'INSERT INTO t1 VALUES($n, repeat("a", 32))' 128 times
COMMIT;
SELECT count(*) FROM t1;
count(*)
0
show binlog events in 'slave-bin.000001' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
include/stop_slave.inc
include/start_slave.inc
SELECT count(*) FROM t1;
count(*)
128
######################################################################################## ########################################################################################
# CLEAN # CLEAN
######################################################################################## ########################################################################################
......
...@@ -5,6 +5,8 @@ reset slave; ...@@ -5,6 +5,8 @@ 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;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
SET GLOBAL max_binlog_cache_size = 4096;
SET GLOBAL binlog_cache_size = 4096;
CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb; CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam; CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam;
CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb; CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
...@@ -15,13 +17,14 @@ CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb; ...@@ -15,13 +17,14 @@ CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
Got one of the listed errors Got one of the listed errors
*** Single statement on non-transactional table *** *** Single statement on non-transactional table ***
Got one of the listed errors Got one of the listed errors
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; --source include/wait_for_slave_sql_error_and_skip.inc
START SLAVE SQL_THREAD; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
*** Single statement on both transactional and non-transactional tables. *** *** Single statement on both transactional and non-transactional tables. ***
Got one of the listed errors Got one of the listed errors
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; --source include/wait_for_slave_sql_error_and_skip.inc
START SLAVE SQL_THREAD; SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 1;
source include/diff_master_slave.inc; include/start_slave.inc
######################################################################################## ########################################################################################
# 2 - BEGIN - IMPLICIT COMMIT by DDL # 2 - BEGIN - IMPLICIT COMMIT by DDL
######################################################################################## ########################################################################################
...@@ -119,6 +122,35 @@ BEGIN; ...@@ -119,6 +122,35 @@ BEGIN;
Got one of the listed errors Got one of the listed errors
COMMIT; COMMIT;
source include/diff_master_slave.inc; source include/diff_master_slave.inc;
########################################################################
# 8 - Bug#55375(Regression Bug) Transaction bigger than
# max_binlog_cache_size crashes slave
########################################################################
# [ On Slave ]
SET GLOBAL max_binlog_cache_size = 4096;
SET GLOBAL binlog_cache_size = 4096;
include/stop_slave.inc
include/start_slave.inc
CALL mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage.*");
CALL mtr.add_suppression("Writing one row to the row-based binary log failed.*");
TRUNCATE t1;
SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
BEGIN;
Repeat statement 'INSERT INTO t1 VALUES($n, repeat("a", 32))' 128 times
COMMIT;
SELECT count(*) FROM t1;
count(*)
0
show binlog events in 'slave-bin.000001' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
include/stop_slave.inc
include/start_slave.inc
SELECT count(*) FROM t1;
count(*)
128
######################################################################################## ########################################################################################
# CLEAN # CLEAN
######################################################################################## ########################################################################################
......
--binlog_cache_size=4096 --max_binlog_cache_size=7680 --default-storage-engine=MyISAM
--binlog_cache_size=4096 --max_binlog_cache_size=7680
...@@ -158,16 +158,21 @@ static void inline slave_rows_error_report(enum loglevel level, int ha_error, ...@@ -158,16 +158,21 @@ static void inline slave_rows_error_report(enum loglevel level, int ha_error,
" %s, Error_code: %d;", err->get_message_text(), " %s, Error_code: %d;", err->get_message_text(),
err->get_sql_errno()); err->get_sql_errno());
} }
rli->report(level, thd->is_error()? thd->stmt_da->sql_errno() : 0, if (ha_error != 0)
"Could not execute %s event on table %s.%s;" rli->report(level, thd->is_error() ? thd->stmt_da->sql_errno() : 0,
"%s handler error %s; " "Could not execute %s event on table %s.%s;"
"the event's master log %s, end_log_pos %lu", "%s handler error %s; "
type, table->s->db.str, "the event's master log %s, end_log_pos %lu",
table->s->table_name.str, type, table->s->db.str, table->s->table_name.str,
buff, buff, handler_error == NULL ? "<unknown>" : handler_error,
handler_error == NULL? "<unknown>" : handler_error, log_name, pos);
log_name, pos); else
rli->report(level, thd->is_error() ? thd->stmt_da->sql_errno() : 0,
"Could not execute %s event on table %s.%s;"
"%s the event's master log %s, end_log_pos %lu",
type, table->s->db.str, table->s->table_name.str,
buff, log_name, pos);
} }
#endif #endif
...@@ -7811,19 +7816,16 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli) ...@@ -7811,19 +7816,16 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
/Sven /Sven
*/ */
thd->reset_current_stmt_binlog_format_row(); thd->reset_current_stmt_binlog_format_row();
const_cast<Relay_log_info*>(rli)->cleanup_context(thd, error);
thd->is_slave_error= 1; thd->is_slave_error= 1;
DBUG_RETURN(error); DBUG_RETURN(error);
} }
if (get_flags(STMT_END_F)) if (get_flags(STMT_END_F) && (error= rows_event_stmt_cleanup(rli, thd)))
if ((error= rows_event_stmt_cleanup(rli, thd))) slave_rows_error_report(ERROR_LEVEL,
rli->report(ERROR_LEVEL, error, thd->is_error() ? 0 : error,
"Error in %s event: commit of row events failed, " rli, thd, table,
"table `%s`.`%s`", get_type_str(),
get_type_str(), m_table->s->db.str, RPL_LOG_NAME, (ulong) log_pos);
m_table->s->table_name.str);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
......
...@@ -2534,9 +2534,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli) ...@@ -2534,9 +2534,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli)
else else
{ {
exec_res= 0; exec_res= 0;
trans_rollback(thd); rli->cleanup_context(thd, 1);
close_thread_tables(thd);
thd->mdl_context.release_transactional_locks();
/* chance for concurrent connection to get more locks */ /* chance for concurrent connection to get more locks */
safe_sleep(thd, min(rli->trans_retries, MAX_SLAVE_RETRY_PAUSE), safe_sleep(thd, min(rli->trans_retries, MAX_SLAVE_RETRY_PAUSE),
(CHECK_KILLED_FUNC)sql_slave_killed, (void*)rli); (CHECK_KILLED_FUNC)sql_slave_killed, (void*)rli);
...@@ -3385,6 +3383,7 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \ ...@@ -3385,6 +3383,7 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
request is detected only by the present function, not by events), so we request is detected only by the present function, not by events), so we
must "proactively" clear playgrounds: must "proactively" clear playgrounds:
*/ */
thd->clear_error();
rli->cleanup_context(thd, 1); rli->cleanup_context(thd, 1);
/* /*
Some extra safety, which should not been needed (normally, event deletion Some extra safety, which should not been needed (normally, event deletion
......
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