#At file:///work/bzr/mysql-5.1-rpl/
2669 Horst Hunger 2008-10-01
Fix for bug#37763: Inserted results of the first review.
modified:
mysql-test/r/rpl_init_slave_func.result
mysql-test/t/rpl_init_slave_func.test
=== modified file 'mysql-test/r/rpl_init_slave_func.result'
--- a/mysql-test/r/rpl_init_slave_func.result 2008-09-29 15:43:24 +0000
+++ b/mysql-test/r/rpl_init_slave_func.result 2008-10-01 12:03:28 +0000
@@ -7,41 +7,32 @@ start slave;
connection slave
SET @start_max_connections= @@global.max_connections;
SET @start_init_slave= @@global.init_slave;
-SET @@global.init_slave = "SET @@global.max_connections = 500";
-connection master
-SELECT @@global.init_slave;
-@@global.init_slave
-
-SELECT @@global.max_connections;
-@@global.max_connections
-151
-connection slave
-SELECT @@global.init_slave;
-@@global.init_slave
-SET @@global.max_connections = 500
-SELECT @@global.max_connections;
-@@global.max_connections
-151
+SET @@global.init_slave = 'SET @@global.max_connections = @@global.max_connections + 1';
+DROP TABLE IF EXISTS t1;
+CREATE TEMPORARY TABLE t1 AS SELECT @@global.init_slave AS my_column;
+DESCRIBE t1;
+Field Type Null Key Default Extra
+my_column varchar(59) NO
+DROP TABLE t1;
+SELECT @@global.init_slave = 'SET @@global.max_connections = @@global.max_connections + 1';
+@@global.init_slave = 'SET @@global.max_connections = @@global.max_connections + 1'
+1
+Expect 1
+SELECT @@global.max_connections = @start_max_connections;
+@@global.max_connections = @start_max_connections
+1
+Expect 1
STOP SLAVE;
RESET MASTER;
RESET SLAVE;
START SLAVE;
-SELECT @@global.init_slave;
-@@global.init_slave
-SET @@global.max_connections = 500
-SELECT @@global.max_connections;
-@@global.max_connections
-500
-connection master
-SELECT @@global.init_slave;
-@@global.init_slave
-
-SELECT @@global.max_connections;
-@@global.max_connections
-151
-connection slave
+SELECT @@global.max_connections = @start_max_connections + 1;
+@@global.max_connections = @start_max_connections + 1
+1
+Expect 1
SET @@global.init_slave = "SET @a=5";
STOP SLAVE;
+RESET MASTER;
RESET SLAVE;
START SLAVE;
SHOW VARIABLES LIKE 'init_slave';
@@ -50,5 +41,6 @@ init_slave SET @a=5
SELECT @a;
@a
NULL
+Expect NULL
SET @@global.max_connections= @start_max_connections;
SET @@global.init_slave= @start_init_slave;
=== modified file 'mysql-test/t/rpl_init_slave_func.test'
--- a/mysql-test/t/rpl_init_slave_func.test 2008-09-29 15:43:24 +0000
+++ b/mysql-test/t/rpl_init_slave_func.test 2008-10-01 12:03:28 +0000
@@ -23,23 +23,33 @@
source include/master-slave.inc;
--echo connection slave
connection slave;
+#
+# save the current values
+
SET @start_max_connections= @@global.max_connections;
SET @start_init_slave= @@global.init_slave;
-# setting of a global value with an effect on the nest slave start
-SET @@global.init_slave = "SET @@global.max_connections = 500";
-
-# changes not yet expected
---echo connection master
-connection master;
-SELECT @@global.init_slave;
-SELECT @@global.max_connections;
-
---echo connection slave
-connection slave;
-SELECT @@global.init_slave;
-SELECT @@global.max_connections;
-
+# setting of a global value with an effect on the next slave start
+# check that @@global.init_slave could be set
+let $my_init_slave=
+ 'SET @@global.max_connections = @@global.max_connections + 1';
+eval SET @@global.init_slave = $my_init_slave;
+
+# show the data type of the variable
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+CREATE TEMPORARY TABLE t1 AS SELECT @@global.init_slave AS my_column;
+--enable_warnings
+DESCRIBE t1;
+DROP TABLE t1;
+#
+# check that the new setting of @@global.init_slave becomes immediate visible
+eval SELECT @@global.init_slave = $my_init_slave;
+--echo Expect 1
+# check that the action in init_slave does not happen immediate
+SELECT @@global.max_connections = @start_max_connections;
+--echo Expect 1
+#
# reset of the server
STOP SLAVE;
--wait_for_slave_to_stop
@@ -47,32 +57,26 @@ RESET MASTER;
RESET SLAVE;
START SLAVE;
source include/wait_for_slave_to_start.inc;
-
-# changed values now visible
-SELECT @@global.init_slave;
-SELECT @@global.max_connections;
-
---echo connection master
-connection master;
-SELECT @@global.init_slave;
-SELECT @@global.max_connections;
-
---echo connection slave
-connection slave;
-
-# Setting a variable(is local to a session
+#
+# check that the action in init_slave was executed and had the intended effect
+SELECT @@global.max_connections = @start_max_connections + 1;
+--echo Expect 1
+#
+# Setting a variable(which is local to a session) and must not be visible
SET @@global.init_slave = "SET @a=5";
-
+#
STOP SLAVE;
--wait_for_slave_to_stop
+RESET MASTER;
RESET SLAVE;
START SLAVE;
source include/wait_for_slave_to_start.inc;
-
+#
SHOW VARIABLES LIKE 'init_slave';
# expect NULL
SELECT @a;
-
+--echo Expect NULL
+#
# Clean up
SET @@global.max_connections= @start_max_connections;
SET @@global.init_slave= @start_init_slave;
| Thread |
|---|
| • bzr commit into mysql-5.1 branch (horst:2669) Bug#37763 | Horst Hunger | 1 Oct |