mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
BUG#37148 Most callers of mysql_bin_log.write ignore the return result
This is the non-ndb part of the patch. The return value of mysql_bin_log.write was ignored by most callers, which may lead to inconsistent on master and slave if the transaction was committed while the binlog was not correctly written. If my_error() is call in mysql_bin_log.write, this could also lead to assertion issue if my_ok() or my_error() is called after. This fixed the problem by let the caller to check and handle the return value of mysql_bin_log.write. This patch only adresses the simple cases.
This commit is contained in:
@@ -3092,7 +3092,7 @@ end_with_restore_list:
|
||||
/*
|
||||
Presumably, REPAIR and binlog writing doesn't require synchronization
|
||||
*/
|
||||
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
|
||||
res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
|
||||
}
|
||||
select_lex->table_list.first= (uchar*) first_table;
|
||||
lex->query_tables=all_tables;
|
||||
@@ -3124,7 +3124,7 @@ end_with_restore_list:
|
||||
/*
|
||||
Presumably, ANALYZE and binlog writing doesn't require synchronization
|
||||
*/
|
||||
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
|
||||
res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
|
||||
}
|
||||
select_lex->table_list.first= (uchar*) first_table;
|
||||
lex->query_tables=all_tables;
|
||||
@@ -3147,7 +3147,7 @@ end_with_restore_list:
|
||||
/*
|
||||
Presumably, OPTIMIZE and binlog writing doesn't require synchronization
|
||||
*/
|
||||
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
|
||||
res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
|
||||
}
|
||||
select_lex->table_list.first= (uchar*) first_table;
|
||||
lex->query_tables=all_tables;
|
||||
@@ -3288,7 +3288,7 @@ end_with_restore_list:
|
||||
if (incident)
|
||||
{
|
||||
Incident_log_event ev(thd, incident);
|
||||
mysql_bin_log.write(&ev);
|
||||
(void) mysql_bin_log.write(&ev); /* error is ignored */
|
||||
mysql_bin_log.rotate_and_purge(RP_FORCE_ROTATE);
|
||||
}
|
||||
DBUG_PRINT("debug", ("Just after generate_incident()"));
|
||||
@@ -4129,7 +4129,8 @@ end_with_restore_list:
|
||||
*/
|
||||
if (!lex->no_write_to_binlog && write_to_binlog)
|
||||
{
|
||||
write_bin_log(thd, FALSE, thd->query(), thd->query_length());
|
||||
if (res= write_bin_log(thd, FALSE, thd->query(), thd->query_length()))
|
||||
break;
|
||||
}
|
||||
my_ok(thd);
|
||||
}
|
||||
@@ -4701,12 +4702,12 @@ create_sp_error:
|
||||
case SP_KEY_NOT_FOUND:
|
||||
if (lex->drop_if_exists)
|
||||
{
|
||||
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
|
||||
res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
|
||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
|
||||
ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST),
|
||||
SP_COM_STRING(lex), lex->spname->m_name.str);
|
||||
res= FALSE;
|
||||
my_ok(thd);
|
||||
if (!res)
|
||||
my_ok(thd);
|
||||
break;
|
||||
}
|
||||
my_error(ER_SP_DOES_NOT_EXIST, MYF(0),
|
||||
|
||||
Reference in New Issue
Block a user