diff options
author | Luis Soares <luis.soares@sun.com> | 2010-03-22 09:51:16 +0000 |
---|---|---|
committer | Luis Soares <luis.soares@sun.com> | 2010-03-22 09:51:16 +0000 |
commit | fc34cd1c2180976426b2c6fbcd9bdadd7b1ce337 (patch) | |
tree | 271615c8ea384a08b3b28f7aa38755b7addc92e4 /sql/sql_acl.cc | |
parent | 8feadddbe437556fe4f8c054fa9c749f77dd20ca (diff) | |
download | mariadb-git-fc34cd1c2180976426b2c6fbcd9bdadd7b1ce337.tar.gz |
BUG#51987: revoke privileges logs wrong error code
A failed REVOKE statement is logged with error=0, thus causing
the slave to stop. The slave should not stop as this was an
expected error. Given that the execution failed on the master as
well the error code should be logged so that the slave can replay
the statement, get an error and compare with the master's
execution outcome. If errors match, then slave can proceed with
replication, as the error it got, when replaying the statement,
was expected.
In this particular case, the bug surfaces because the error code
is pushed to the THD diagnostics area after writing the event to
the binary log. Therefore, it would be logged with the THD
diagnostics area clean, hence its error code would not contain
the correct code.
We fix this by moving the error reporting ahead of the call to
the routine that writes the event to the binary log.
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r-- | sql/sql_acl.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index a8828d15cae..dd256c70ecb 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -6117,19 +6117,19 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list) VOID(pthread_mutex_unlock(&acl_cache->lock)); - int binlog_error= + if (result) + my_message(ER_REVOKE_GRANTS, ER(ER_REVOKE_GRANTS), MYF(0)); + + result= result | write_bin_log(thd, FALSE, thd->query(), thd->query_length()); rw_unlock(&LOCK_grant); close_thread_tables(thd); - /* error for writing binary log has already been reported */ - if (result && !binlog_error) - my_message(ER_REVOKE_GRANTS, ER(ER_REVOKE_GRANTS), MYF(0)); /* Restore the state of binlog format */ thd->current_stmt_binlog_row_based= save_binlog_row_based; - DBUG_RETURN(result || binlog_error); + DBUG_RETURN(result); } |