Commit 9742cf42 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-24668 debug assert on SET PASSWORD when binlog fails

don't use `result` both for an error status and to remember
if the mutex was locked
parent cf1ca57e
......@@ -100,6 +100,12 @@ ERROR HY000: Error writing file 'master-bin' ((errno: #)
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
SET PASSWORD FOR user1=PASSWORD('foobar');
SET PASSWORD FOR user1=PASSWORD('foobar');
ERROR HY000: Error writing file 'master-bin' ((errno: #)
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP USER user1;
DROP USER user1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
......
......@@ -75,5 +75,8 @@ source include/binlog_inject_error.inc;
let $query= REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1;
source include/binlog_inject_error.inc;
let $query= SET PASSWORD FOR user1=PASSWORD('foobar');
source include/binlog_inject_error.inc;
let $query= DROP USER user1;
source include/binlog_inject_error.inc;
......@@ -100,6 +100,12 @@ ERROR HY000: Error writing file 'master-bin' ((errno: #)
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
SET PASSWORD FOR user1=PASSWORD('foobar');
SET PASSWORD FOR user1=PASSWORD('foobar');
ERROR HY000: Error writing file 'master-bin' ((errno: #)
set @@global.debug_dbug = @saved_dbug;
set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP USER user1;
DROP USER user1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
......
......@@ -3794,7 +3794,7 @@ bool change_password(THD *thd, LEX_USER *user)
char buff[512];
ulong query_length= 0;
enum_binlog_format save_binlog_format;
int result=0;
bool result, acl_cache_is_locked= false;
ACL_USER *acl_user;
ACL_USER::AUTH auth;
const char *password_plugin= 0;
......@@ -3819,7 +3819,7 @@ bool change_password(THD *thd, LEX_USER *user)
if ((result= tables.open_and_lock(thd, Table_user, TL_WRITE)))
DBUG_RETURN(result != 1);
result= 1;
acl_cache_is_locked= 1;
mysql_mutex_lock(&acl_cache->lock);
if (!(acl_user= find_user_exact(user->host.str, user->user.str)))
......@@ -3872,7 +3872,7 @@ bool change_password(THD *thd, LEX_USER *user)
acl_cache->clear(1); // Clear locked hostname cache
mysql_mutex_unlock(&acl_cache->lock);
result= 0;
result= acl_cache_is_locked= 0;
if (mysql_bin_log.is_open())
{
query_length= sprintf(buff, "SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'",
......@@ -3883,7 +3883,7 @@ bool change_password(THD *thd, LEX_USER *user)
FALSE, FALSE, FALSE, 0) > 0;
}
end:
if (result)
if (acl_cache_is_locked)
mysql_mutex_unlock(&acl_cache->lock);
close_mysql_tables(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