mirror of
https://github.com/MariaDB/server.git
synced 2025-01-21 06:22:28 +01:00
59f1be1b63
Original revision: ------------------------------------------------------------ revision-id: li-bing.song@sun.com-20100130124925-o6sfex42b6noyc6x parent: joro@sun.com-20100129145427-0n79l9hnk0q43ajk committer: <Li-Bing.Song@sun.com> branch nick: mysql-5.1-bugteam timestamp: Sat 2010-01-30 20:49:25 +0800 message: Bug #48321 CURRENT_USER() incorrectly replicated for DROP/RENAME USER; REVOKE/GRANT; ALTER EVENT. The following statements support the CURRENT_USER() where a user is needed. DROP USER RENAME USER CURRENT_USER() ... GRANT ... TO CURRENT_USER() REVOKE ... FROM CURRENT_USER() ALTER DEFINER = CURRENT_USER() EVENT but, When these statements are binlogged, CURRENT_USER() just is binlogged as 'CURRENT_USER()', it is not expanded to the real user name. When slave executes the log event, 'CURRENT_USER()' is expand to the user of slave SQL thread, but SQL thread's user name always NULL. This breaks the replication. After this patch, All above statements are rewritten when they are binlogged. The CURRENT_USER() is expanded to the real user's name and host. ------------------------------------------------------------
61 lines
1.5 KiB
Text
61 lines
1.5 KiB
Text
# BUG#33862 completely failed DROP USER statement gets replicated
|
|
|
|
--source include/master-slave.inc
|
|
|
|
#
|
|
# remove all users will be used in the test
|
|
#
|
|
connection master;
|
|
set session sql_log_bin=0;
|
|
delete from mysql.user where Host='fakehost';
|
|
set session sql_log_bin=1;
|
|
|
|
connection slave;
|
|
set session sql_log_bin=0;
|
|
delete from mysql.user where Host='fakehost';
|
|
set session sql_log_bin=1;
|
|
|
|
#
|
|
# Test create user
|
|
#
|
|
connection master;
|
|
create user 'foo'@'fakehost';
|
|
--error ER_CANNOT_USER
|
|
create user 'foo'@'fakehost', 'bar'@'fakehost';
|
|
--error ER_CANNOT_USER
|
|
create user 'foo'@'fakehost', 'bar'@'fakehost';
|
|
|
|
sync_slave_with_master;
|
|
select Host,User from mysql.user where Host='fakehost';
|
|
|
|
#
|
|
# Test rename user
|
|
#
|
|
connection master;
|
|
rename user 'foo'@'fakehost' to 'foofoo'@'fakehost';
|
|
--error ER_CANNOT_USER
|
|
rename user 'not_exist_user1'@'fakehost' to 'foobar'@'fakehost', 'bar'@'fakehost' to 'barbar'@'fakehost';
|
|
--error ER_CANNOT_USER
|
|
rename user 'not_exist_user1'@'fakehost' to 'foobar'@'fakehost', 'not_exist_user2'@'fakehost' to 'barfoo'@'fakehost';
|
|
|
|
sync_slave_with_master;
|
|
select Host,User from mysql.user where Host='fakehost';
|
|
|
|
#
|
|
# Test drop user
|
|
#
|
|
connection master;
|
|
drop user 'foofoo'@'fakehost';
|
|
--error ER_CANNOT_USER
|
|
drop user 'not_exist_user1'@'fakehost', 'barbar'@'fakehost';
|
|
--error ER_CANNOT_USER
|
|
drop user 'not_exist_user1'@'fakehost', 'not_exist_user2'@'fakehost';
|
|
|
|
sync_slave_with_master;
|
|
select Host,User from mysql.user where Host='fakehost';
|
|
|
|
#
|
|
# show the binlog events on the master
|
|
#
|
|
connection master;
|
|
source include/show_binlog_events.inc;
|