mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
select from I_S Problem: ======== When applier thread tries to access 'variable_name' of INFORMATION_SCHEMA.SESSION_VARIABLES table through triggers, it results in an abnormal exit of slave server. Analysis: ======== At the time of replication of stored routines and triggers, their associated security context will be sent by the master. The applier thread on the slave server will use this information to set the required security context for the execution of stored routines and triggers. This is achieved as follows. ->The stored routine object has a member named 'm_security_ctx' which holds the security context received from master. ->The applier thread's security_ctx is stored into a 'backup' object. ->Set the applier thread's security_ctx to 'm_security_ctx'. ->Upon the completion of stored routine execution restore the original security context of applier thread from the backup. During the above process the 'm_security_ctx' object is not initialized properly. Hence the 'external_user' of 'm_security_ctx' has invalid value for this variable and accessing this variable results in abnormal exit of server. Fix: === Invoke the Security_context::init() call from the constructor of stored routine so that 'm_security_ctx' gets initialized properly.
16 lines
753 B
Plaintext
16 lines
753 B
Plaintext
include/master-slave.inc
|
|
[connection master]
|
|
CREATE USER test_user@localhost;
|
|
SET PASSWORD FOR test_user@localhost = password('PWD');
|
|
GRANT ALL ON *.* TO test_user@localhost WITH GRANT OPTION;
|
|
connect conn_test,localhost,test_user,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
|
|
connection conn_test;
|
|
CREATE TABLE t1 (f1 INT);
|
|
CREATE TABLE t2 (f2 VARCHAR(64));
|
|
CREATE TRIGGER tr_before BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 SELECT variable_name FROM INFORMATION_SCHEMA.SESSION_VARIABLES;
|
|
CREATE DEFINER='root'@'localhost' TRIGGER tr_after AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 SELECT variable_name FROM INFORMATION_SCHEMA.SESSION_VARIABLES;
|
|
INSERT INTO t1 VALUES (1);
|
|
DROP USER 'test_user'@'localhost';
|
|
DROP TABLE t1, t2;
|
|
include/rpl_end.inc
|