Commit 7671fd70 authored by Kristian Nielsen's avatar Kristian Nielsen

MDEV-7080: rpl.rpl_gtid_crash fails sporadically in buildbot

The real problem here was inconsistent handling of entry->commit_errno in
MYSQL_BIN_LOG::write_transaction_or_stmt(). Some return paths were setting it
to the value of errno, some where not. And the setting was redundant anyway,
as it is set consistently by the caller.

Fix by consistently setting it in the caller, and not in each return path in
the function.

The test failure happened because a DBUG_EXECUTE_IF() used in the test case
set an entry->commit_errno that was immediately overwritten in the caller with
whatever happened to be the value of errno. This could lead to different error
message in the .result file.
parent b7d32e05
......@@ -124,7 +124,7 @@ SET GLOBAL debug_dbug="+d,inject_error_writing_xid";
BEGIN;
INSERT INTO t1 VALUES (11);
COMMIT;
ERROR HY000: Error writing file 'master-bin' (errno: 11 "Resource temporarily unavailable")
ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device")
SET GLOBAL debug_dbug="+d,crash_dispatch_command_before";
COMMIT;
Got one of the listed errors
......@@ -141,7 +141,7 @@ SET GLOBAL debug_dbug="+d,inject_error_writing_xid";
BEGIN;
INSERT INTO t1 VALUES (12);
COMMIT;
ERROR HY000: Error writing file 'master-bin' (errno: 11 "Resource temporarily unavailable")
ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device")
SET GLOBAL debug_dbug="+d,crash_dispatch_command_before";
COMMIT;
Got one of the listed errors
......@@ -164,7 +164,7 @@ SET GLOBAL debug_dbug="+d,inject_error_writing_xid";
BEGIN;
INSERT INTO t1 VALUES (21);
COMMIT;
ERROR HY000: Error writing file 'master-bin' (errno: 11 "Resource temporarily unavailable")
ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device")
SET GLOBAL debug_dbug="+d,crash_dispatch_command_before";
COMMIT;
Got one of the listed errors
......@@ -185,7 +185,7 @@ SET GLOBAL debug_dbug="+d,inject_error_writing_xid";
BEGIN;
INSERT INTO t1 VALUES (22);
COMMIT;
ERROR HY000: Error writing file 'master-bin' (errno: 11 "Resource temporarily unavailable")
ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device")
SET GLOBAL debug_dbug="+d,crash_dispatch_command_before";
COMMIT;
Got one of the listed errors
......
......@@ -7437,7 +7437,6 @@ MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry,
write_cache(entry->thd, mngr->get_binlog_cache_log(FALSE)))
{
entry->error_cache= &mngr->stmt_cache.cache_log;
entry->commit_errno= errno;
DBUG_RETURN(ER_ERROR_ON_WRITE);
}
......@@ -7458,7 +7457,6 @@ MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry,
if (write_cache(entry->thd, mngr->get_binlog_cache_log(TRUE)))
{
entry->error_cache= &mngr->trx_cache.cache_log;
entry->commit_errno= errno;
DBUG_RETURN(ER_ERROR_ON_WRITE);
}
}
......@@ -7466,14 +7464,13 @@ MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry,
DBUG_EXECUTE_IF("inject_error_writing_xid",
{
entry->error_cache= NULL;
entry->commit_errno= 28;
errno= 28;
DBUG_RETURN(ER_ERROR_ON_WRITE);
});
if (entry->end_event->write(&log_file))
{
entry->error_cache= NULL;
entry->commit_errno= errno;
DBUG_RETURN(ER_ERROR_ON_WRITE);
}
status_var_add(entry->thd->status_var.binlog_bytes_written,
......@@ -7484,7 +7481,6 @@ MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry,
if (entry->incident_event->write(&log_file))
{
entry->error_cache= NULL;
entry->commit_errno= errno;
DBUG_RETURN(ER_ERROR_ON_WRITE);
}
}
......@@ -7492,13 +7488,11 @@ MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry,
if (mngr->get_binlog_cache_log(FALSE)->error) // Error on read
{
entry->error_cache= &mngr->stmt_cache.cache_log;
entry->commit_errno= errno;
DBUG_RETURN(ER_ERROR_ON_WRITE);
}
if (mngr->get_binlog_cache_log(TRUE)->error) // Error on read
{
entry->error_cache= &mngr->trx_cache.cache_log;
entry->commit_errno= errno;
DBUG_RETURN(ER_ERROR_ON_WRITE);
}
......
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