mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
MDEV-17753 ALTER USER fail to replicate
Change mysql_alter_user to log alter user command.
This commit is contained in:
parent
7331c661db
commit
79078167c3
3 changed files with 28 additions and 0 deletions
|
@ -31,6 +31,13 @@ Host User
|
|||
fakehost barbar
|
||||
fakehost foofoo
|
||||
connection master;
|
||||
alter user 'foofoo'@'fakehost' identified by 'foo';
|
||||
alter user 'non_exist_user1'@'fakehost' identified by 'foo', 'barbar'@'fakehost' identified by 'bar';
|
||||
ERROR HY000: Operation ALTER USER failed for 'non_exist_user1'@'fakehost'
|
||||
alter user 'non_exist_user1'@'fakehost' identified by 'foo', 'non_exist_user2'@'fakehost' identified by 'bar';
|
||||
ERROR HY000: Operation ALTER USER failed for 'non_exist_user1'@'fakehost','non_exist_user2'@'fakehost'
|
||||
connection slave;
|
||||
connection master;
|
||||
drop user 'foofoo'@'fakehost';
|
||||
drop user 'not_exist_user1'@'fakehost', 'barbar'@'fakehost';
|
||||
ERROR HY000: Operation DROP USER failed for 'not_exist_user1'@'fakehost'
|
||||
|
@ -51,6 +58,10 @@ master-bin.000001 # Query # # use `test`; rename user 'foo'@'fakehost' to 'foofo
|
|||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; rename user 'not_exist_user1'@'fakehost' to 'foobar'@'fakehost', 'bar'@'fakehost' to 'barbar'@'fakehost'
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; alter user 'foofoo'@'fakehost' identified by 'foo'
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; alter user 'non_exist_user1'@'fakehost' identified by 'foo', 'barbar'@'fakehost' identified by 'bar'
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; drop user 'foofoo'@'fakehost'
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; drop user 'not_exist_user1'@'fakehost', 'barbar'@'fakehost'
|
||||
|
|
|
@ -41,6 +41,17 @@ rename user 'not_exist_user1'@'fakehost' to 'foobar'@'fakehost', 'not_exist_user
|
|||
sync_slave_with_master;
|
||||
select Host,User from mysql.user where Host='fakehost';
|
||||
|
||||
#
|
||||
# Test alter user
|
||||
#
|
||||
connection master;
|
||||
alter user 'foofoo'@'fakehost' identified by 'foo';
|
||||
--error ER_CANNOT_USER
|
||||
alter user 'non_exist_user1'@'fakehost' identified by 'foo', 'barbar'@'fakehost' identified by 'bar';
|
||||
--error ER_CANNOT_USER
|
||||
alter user 'non_exist_user1'@'fakehost' identified by 'foo', 'non_exist_user2'@'fakehost' identified by 'bar';
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# Test drop user
|
||||
#
|
||||
|
|
|
@ -10478,6 +10478,7 @@ int mysql_alter_user(THD* thd, List<LEX_USER> &users_list)
|
|||
DBUG_ENTER("mysql_alter_user");
|
||||
int result= 0;
|
||||
String wrong_users;
|
||||
bool some_users_altered= false;
|
||||
|
||||
/* The only table we're altering is the user table. */
|
||||
Grant_tables tables(Table_user, TL_WRITE);
|
||||
|
@ -10503,6 +10504,7 @@ int mysql_alter_user(THD* thd, List<LEX_USER> &users_list)
|
|||
result= TRUE;
|
||||
continue;
|
||||
}
|
||||
some_users_altered= true;
|
||||
}
|
||||
|
||||
/* Unlock ACL data structures. */
|
||||
|
@ -10527,6 +10529,10 @@ int mysql_alter_user(THD* thd, List<LEX_USER> &users_list)
|
|||
wrong_users.c_ptr_safe());
|
||||
}
|
||||
}
|
||||
|
||||
if (some_users_altered)
|
||||
result|= write_bin_log(thd, FALSE, thd->query(),
|
||||
thd->query_length());
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue