mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
SCRUM:
Task 499 'init_connect, init_slave options'
This commit is contained in:
@ -775,7 +775,7 @@ manager_launch()
|
||||
ident=$1
|
||||
shift
|
||||
if [ $USE_MANAGER = 0 ] ; then
|
||||
$@ >> $CUR_MYERR 2>&1 &
|
||||
echo $@ | /bin/sh >> $CUR_MYERR 2>&1 &
|
||||
sleep 2 #hack
|
||||
return
|
||||
fi
|
||||
|
24
mysql-test/r/init_connect.result
Normal file
24
mysql-test/r/init_connect.result
Normal file
@ -0,0 +1,24 @@
|
||||
select hex(@a);
|
||||
hex(@a)
|
||||
NULL
|
||||
select hex(@a);
|
||||
hex(@a)
|
||||
610063
|
||||
set global init_connect="set @a=2;set @b=3";
|
||||
select @a, @b;
|
||||
@a @b
|
||||
2 3
|
||||
set GLOBAL init_connect=DEFAULT;
|
||||
select @a;
|
||||
@a
|
||||
NULL
|
||||
set global init_connect="create table t1(a char(10));\
|
||||
insert into t1 values ('\0');insert into t1 values('abc')";
|
||||
select hex(a) from t1;
|
||||
hex(a)
|
||||
00
|
||||
616263
|
||||
set GLOBAL init_connect="adsfsdfsdfs";
|
||||
select @a;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
drop table t1;
|
23
mysql-test/r/rpl_init_slave.result
Normal file
23
mysql-test/r/rpl_init_slave.result
Normal file
@ -0,0 +1,23 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
reset master;
|
||||
create table t1(n int);
|
||||
insert into t1 values (@a), (@b);
|
||||
select * from t1;
|
||||
n
|
||||
NULL
|
||||
NULL
|
||||
select * from t1;
|
||||
n
|
||||
1
|
||||
2
|
||||
set global init_connect="set @c=1";
|
||||
show variables like 'init_connect';
|
||||
Variable_name Value
|
||||
init_connect set @c=1
|
||||
drop table t1;
|
||||
stop slave;
|
1
mysql-test/t/init_connect-master.opt
Normal file
1
mysql-test/t/init_connect-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--set-variable=init_connect="set @a='a\0c'"
|
34
mysql-test/t/init_connect.test
Normal file
34
mysql-test/t/init_connect.test
Normal file
@ -0,0 +1,34 @@
|
||||
#
|
||||
# Test of init_connect variable
|
||||
#
|
||||
|
||||
connect (con0,localhost,root,,);
|
||||
connection con0;
|
||||
select hex(@a);
|
||||
connect (con1,localhost,user_1,,);
|
||||
connection con1;
|
||||
select hex(@a);
|
||||
connection con0;
|
||||
set global init_connect="set @a=2;set @b=3";
|
||||
connect (con2,localhost,user_1,,);
|
||||
connection con2;
|
||||
select @a, @b;
|
||||
connection con0;
|
||||
set GLOBAL init_connect=DEFAULT;
|
||||
connect (con3,localhost,user_1,,);
|
||||
connection con3;
|
||||
select @a;
|
||||
connection con0;
|
||||
set global init_connect="create table t1(a char(10));\
|
||||
insert into t1 values ('\0');insert into t1 values('abc')";
|
||||
connect (con4,localhost,user_1,,);
|
||||
connection con4;
|
||||
select hex(a) from t1;
|
||||
connection con0;
|
||||
set GLOBAL init_connect="adsfsdfsdfs";
|
||||
connect (con5,localhost,user_1,,);
|
||||
connection con5;
|
||||
--error 2013
|
||||
select @a;
|
||||
connection con0;
|
||||
drop table t1;
|
1
mysql-test/t/rpl_init_slave-slave.opt
Normal file
1
mysql-test/t/rpl_init_slave-slave.opt
Normal file
@ -0,0 +1 @@
|
||||
--init-slave="set @a=1;set @b=2"
|
26
mysql-test/t/rpl_init_slave.test
Normal file
26
mysql-test/t/rpl_init_slave.test
Normal file
@ -0,0 +1,26 @@
|
||||
source include/master-slave.inc;
|
||||
|
||||
#
|
||||
# Test of init_slave variable
|
||||
#
|
||||
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
reset master;
|
||||
connection master;
|
||||
create table t1(n int);
|
||||
insert into t1 values (@a), (@b);
|
||||
select * from t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
select * from t1;
|
||||
set global init_connect="set @c=1";
|
||||
show variables like 'init_connect';
|
||||
connection master;
|
||||
drop table t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
stop slave;
|
Reference in New Issue
Block a user