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. ------------------------------------------------------------
45 lines
1 KiB
Text
45 lines
1 KiB
Text
source include/master-slave.inc;
|
|
-- source include/have_innodb.inc
|
|
-- source include/not_embedded.inc
|
|
-- source include/have_binlog_format_mixed_or_statement.inc
|
|
|
|
let $VERSION=`select version()`;
|
|
|
|
# Bug #21975: grant/revoke statements in transaction
|
|
# used to disappear from binlog upon rallback.
|
|
# Now GRANT/REVOKE do implicitly commit
|
|
# transaction
|
|
|
|
--disable_warnings
|
|
drop database if exists d1;
|
|
--enable_warnings
|
|
create database d1;
|
|
use d1;
|
|
create table t (s1 int) engine=innodb;
|
|
set @@autocommit=0;
|
|
start transaction;
|
|
insert into t values (1);
|
|
grant select on t to x@y;
|
|
#
|
|
# There is no active transaction here
|
|
#
|
|
rollback;
|
|
show grants for x@y;
|
|
--replace_result $VERSION VERSION
|
|
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
|
|
show binlog events;
|
|
start transaction;
|
|
insert into t values (2);
|
|
revoke select on t from x@y;
|
|
#
|
|
# There is no active transaction here
|
|
#
|
|
commit;
|
|
select * from t;
|
|
show grants for x@y;
|
|
--replace_result $VERSION VERSION
|
|
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
|
|
show binlog events;
|
|
drop user x@y;
|
|
drop database d1;
|
|
--sync_slave_with_master
|