Commit 306b1ff2 authored by Brandon Nesterenko's avatar Brandon Nesterenko

MDEV-21469 WIP Rebasing

parent e83a8a89
......@@ -24,6 +24,8 @@ connection master;
connection default;
connection server_1;
connection master;
include/assert_grep.inc [Binlog XA COMMIT event should be successfully recovered]
include/assert_grep.inc [Binlog XA crash recovery should successfully finish]
connection slave;
include/start_slave.inc
connection master;
......
......@@ -3,7 +3,7 @@ include/master-slave.inc
connect master2,localhost,root,,;
connection master;
CALL mtr.add_suppression("Found 1 prepared XA transactions");
CALL mtr.add_suppression("Failed to execute binlog query event");
CALL mtr.add_suppression("Failed to execute recovered binlog query event");
CALL mtr.add_suppression("Recovery: Error .Out of memory..");
CALL mtr.add_suppression("Crash recovery failed.");
CALL mtr.add_suppression("Can.t init tc log");
......@@ -28,6 +28,7 @@ connection master1;
connection master;
connection default;
connection default;
include/assert_grep.inc [Binlog event recovery should fail]
connection master;
*** must be no 'xa2' commit seen, as it's still prepared:
SELECT * FROM t;
......
......@@ -23,6 +23,8 @@ connection master;
connection default;
connection server_1;
connection master;
include/assert_grep.inc [Binlog XA PREPARE event should be successfully recovered]
include/assert_grep.inc [Binlog XA crash recovery should successfully finish]
connection slave;
include/start_slave.inc
connection master;
......
......@@ -32,6 +32,8 @@ connection master;
connection default;
connection server_1;
connection master;
include/assert_grep.inc [Binlog XA PREPARE event should be successfully recovered]
include/assert_grep.inc [Binlog XA crash recovery should successfully finish]
connection slave;
include/start_slave.inc
connection master;
......
......@@ -24,6 +24,8 @@ connection master;
connection default;
connection server_1;
connection master;
include/assert_grep.inc [Binlog XA ROLLBACK event should be successfully recovered]
include/assert_grep.inc [Binlog XA crash recovery should successfully finish]
connection slave;
include/start_slave.inc
connection master;
......
......@@ -78,6 +78,27 @@ connection server_1;
--enable_reconnect
--source include/wait_until_connected_again.inc
let $log_error_= `SELECT @@GLOBAL.log_error`;
if(!$log_error_)
{
# MySQL Server on windows is started with --console and thus
# does not know the location of its .err log, use default location
let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
}
--let $assert_file= $log_error_
--let $assert_only_after = CURRENT_TEST: rpl.rpl_xa_commit_crash_safe
--let $assert_text= Binlog XA COMMIT event should be successfully recovered
--let $assert_select=Recovered binlog event XA COMMIT.*successfully applied\$
--let $assert_count= 1
--source include/assert_grep.inc
--let $assert_text= Binlog XA crash recovery should successfully finish
--let $assert_select=Binlog XA crash recovery finished
--let $assert_count= 1
--source include/assert_grep.inc
--connection slave
--source include/start_slave.inc
--sync_with_master
......
......@@ -29,7 +29,7 @@
connect (master2,localhost,root,,);
--connection master
CALL mtr.add_suppression("Found 1 prepared XA transactions");
CALL mtr.add_suppression("Failed to execute binlog query event");
CALL mtr.add_suppression("Failed to execute recovered binlog query event");
CALL mtr.add_suppression("Recovery: Error .Out of memory..");
CALL mtr.add_suppression("Crash recovery failed.");
CALL mtr.add_suppression("Can.t init tc log");
......@@ -79,6 +79,22 @@ connection default;
--enable_reconnect
--source include/wait_until_connected_again.inc
let $log_error_= `SELECT @@GLOBAL.log_error`;
if(!$log_error_)
{
# MySQL Server on windows is started with --console and thus
# does not know the location of its .err log, use default location
let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
}
--let $assert_file= $log_error_
--let $assert_only_after = CURRENT_TEST: rpl.rpl_xa_event_apply_failure
--let $assert_text= Binlog event recovery should fail
--let $assert_select= Failed to execute recovered binlog query
--let $assert_count= 1
--source include/assert_grep.inc
--connection master
--enable_reconnect
--echo *** must be no 'xa2' commit seen, as it's still prepared:
......
......@@ -75,6 +75,25 @@ connection server_1;
--connection master
--enable_reconnect
--source include/wait_until_connected_again.inc
let $log_error_= `SELECT @@GLOBAL.log_error`;
if(!$log_error_)
{
# MySQL Server on windows is started with --console and thus
# does not know the location of its .err log, use default location
let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
}
--let $assert_file= $log_error_
--let $assert_only_after = CURRENT_TEST: rpl.rpl_xa_prepare_commit_prepare
--let $assert_text= Binlog XA PREPARE event should be successfully recovered
--let $assert_select=Recovered binlog event XA PREPARE.*successfully applied\$
--let $assert_count= 1
--source include/assert_grep.inc
--let $assert_text= Binlog XA crash recovery should successfully finish
--let $assert_select=Binlog XA crash recovery finished
--let $assert_count= 1
--source include/assert_grep.inc
--connection slave
--source include/start_slave.inc
......
......@@ -6,6 +6,7 @@
#
# Steps:
# 0 - Generate 3 explicit XA transactions. 'xa1', 'xa2' and 'xa3'.
# 'xa1' is prepared.
# Using debug simulation hold the execution of second XA PREPARE
# statement after the XA PREPARE is written to the binary log.
# With this the prepare will not be done in engine.
......@@ -95,6 +96,25 @@ connection server_1;
--enable_reconnect
--source include/wait_until_connected_again.inc
let $log_error_= `SELECT @@GLOBAL.log_error`;
if(!$log_error_)
{
# MySQL Server on windows is started with --console and thus
# does not know the location of its .err log, use default location
let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
}
--let $assert_file= $log_error_
--let $assert_only_after = CURRENT_TEST: rpl.rpl_xa_prepare_crash_safe
--let $assert_text= Binlog XA PREPARE event should be successfully recovered
--let $assert_select=Recovered binlog event XA PREPARE.*successfully applied\$
--let $assert_count= 2
--source include/assert_grep.inc
--let $assert_text= Binlog XA crash recovery should successfully finish
--let $assert_select=Binlog XA crash recovery finished
--let $assert_count= 1
--source include/assert_grep.inc
--connection slave
--source include/start_slave.inc
......
# ==== Purpose ====
#
# Test verifies that XA COMMIT statements are crash safe.
# Test verifies that XA ROLLBACK statements are crash safe.
#
# ==== Implementation ====
#
......@@ -77,6 +77,26 @@ connection server_1;
--enable_reconnect
--source include/wait_until_connected_again.inc
let $log_error_= `SELECT @@GLOBAL.log_error`;
if(!$log_error_)
{
# MySQL Server on windows is started with --console and thus
# does not know the location of its .err log, use default location
let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
}
--let $assert_file= $log_error_
--let $assert_only_after = CURRENT_TEST: rpl.rpl_xa_rollback_commit_crash_safe
--let $assert_text= Binlog XA ROLLBACK event should be successfully recovered
--let $assert_select=Recovered binlog event XA ROLLBACK.*successfully applied\$
--let $assert_count= 1
--source include/assert_grep.inc
--let $assert_text= Binlog XA crash recovery should successfully finish
--let $assert_select=Binlog XA crash recovery finished
--let $assert_count= 1
--source include/assert_grep.inc
--connection slave
--source include/start_slave.inc
--sync_with_master
......
......@@ -10983,7 +10983,7 @@ bool MYSQL_BIN_LOG::recover_explicit_xa_prepare()
if (!(rli= thd->rli_fake= new Relay_log_info(FALSE, "Recovery")))
{
my_error(ER_OUTOFMEMORY, MYF(ME_FATAL), 1);
goto err2;
goto err_no_rli;
}
rli->sql_driver_thd= thd;
static LEX_CSTRING connection_name= { STRING_WITH_LEN("Recovery") };
......@@ -11003,7 +11003,7 @@ bool MYSQL_BIN_LOG::recover_explicit_xa_prepare()
{
sql_print_error("Binlog file '%s' not found in binlog index, needed "
"for recovery. Aborting.", xa_binlog_checkpoint_name);
goto err2;
goto err_no_file;
}
tmp_disable_binlog(thd);
......@@ -11090,14 +11090,14 @@ bool MYSQL_BIN_LOG::recover_explicit_xa_prepare()
{
if ((err= ev->apply_event(rgi)))
{
sql_print_error("Failed to execute binlog query event of type: %s,"
" at %s:%llu; error %d %s", ev->get_type_str(),
linfo.log_file_name,
(ev->log_pos - ev->data_written),
thd->get_stmt_da()->sql_errno(),
thd->get_stmt_da()->message());
delete ev;
goto err1;
sql_print_error(
"Failed to execute recovered binlog query event of type: %s,"
" at %s:%llu; error %d %s",
ev->get_type_str(), linfo.log_file_name,
(ev->log_pos - ev->data_written),
thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
delete ev;
goto err1;
}
else if (typ == FORMAT_DESCRIPTION_EVENT)
enable_apply_event=false;
......@@ -11108,7 +11108,7 @@ bool MYSQL_BIN_LOG::recover_explicit_xa_prepare()
--recover_xa_count;
enable_apply_event=false;
sql_print_information("Binlog event %s at %s:%llu"
sql_print_information("Recovered binlog event %s at %s:%llu"
" successfully applied",
typ == XA_PREPARE_LOG_EVENT ?
static_cast<XA_prepare_log_event *>(ev)->get_query() :
......@@ -11138,7 +11138,7 @@ bool MYSQL_BIN_LOG::recover_explicit_xa_prepare()
*/
if (recover_xa_count > 0)
goto err2;
sql_print_information("Crash recovery finished.");
sql_print_information("Binlog XA crash recovery finished.");
err= false;
err2:
if (file >= 0)
......@@ -11146,10 +11146,16 @@ bool MYSQL_BIN_LOG::recover_explicit_xa_prepare()
end_io_cache(&log);
mysql_file_close(file, MYF(MY_WME));
}
err_no_file:
thd->variables.pseudo_slave_mode= FALSE;
delete rli->mi;
delete thd->system_thread_info.rpl_sql_info;
if (!rgi)
rgi= thd->rgi_fake;
rgi->slave_close_thread_tables(thd);
err_no_rli:
thd->reset_globals();
delete thd;
......
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