Commit d0f5427c authored by Nuno Carvalho's avatar Nuno Carvalho

BUG#15891524: RLI_FAKE MODE IS NOT UNSET AFTER BINLOG REPLAY

When a binlog is replayed into a server, e.g.:
  $ mysqlbinlog binlog.000001 | mysql
it sets a pseudo slave mode on the client connection in order to server
be able to read binlog events, there is, a format description event is
needed to correctly read following events.
Also this pseudo slave mode applies to the current connection
replication rules that are needed to correctly apply binlog events.

If a binlog dump is sourced on a connection, this pseudo slave mode will
remains after it, what will apply unexpected rules from customer
perspective to following commands.

Added a new SET statement to binlog dump that will unset pseudo slave
mode at the end of dump file.
parent ea69084e
......@@ -2118,6 +2118,8 @@ int main(int argc, char** argv)
else
load_processor.init_by_cur_dir();
fprintf(result_file, "/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;\n");
fprintf(result_file,
"/*!40019 SET @@session.max_insert_delayed_threads=0*/;\n");
......@@ -2168,6 +2170,8 @@ int main(int argc, char** argv)
"/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;\n"
"/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n");
fprintf(result_file, "/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;\n");
if (tmpdir.list)
free_tmpdir(&tmpdir);
if (result_file != stdout)
......
......@@ -14,6 +14,7 @@ insert into t1 values ("Alas");
flush logs;
--- Local --
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -95,8 +96,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- Broken LOAD DATA --
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -131,8 +134,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- --database --
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -186,8 +191,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- --start-position --
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -213,8 +220,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- Remote --
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -296,8 +305,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- Broken LOAD DATA --
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -332,8 +343,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- --database --
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -387,8 +400,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- --start-position --
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -414,8 +429,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- reading stdin --
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -435,6 +452,8 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -453,6 +472,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
drop table t1,t2;
flush logs;
flush logs;
......@@ -495,6 +515,7 @@ call p1();
drop procedure p1;
call p1();
ERROR 42000: PROCEDURE test.p1 does not exist
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -517,6 +538,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
call p1();
1
1
......@@ -545,6 +567,7 @@ C3BF
D0AA
drop table t1;
flush logs;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -634,6 +657,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
CREATE TABLE t1 (c1 CHAR(10));
FLUSH LOGS;
INSERT INTO t1 VALUES ('0123456789');
......@@ -721,6 +745,7 @@ RESET MASTER;
FLUSH LOGS;
#
# Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified exists
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -772,8 +797,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified does not exist
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -806,8 +833,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database specified exists
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -849,8 +878,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database specified does not exist
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -877,6 +908,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
End of 5.0 tests
End of 5.1 tests
# Expect deprecation warning.
......
......@@ -18,6 +18,7 @@ master-bin.000001 # User var # # @`var2`=_binary 0x61 COLLATE binary
master-bin.000001 # Query # # use `test`; insert into t1 values (@var1),(@var2)
master-bin.000001 # Query # # COMMIT
flush logs;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -56,4 +57,5 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
drop table t1;
......@@ -29,6 +29,7 @@ a
1
3
==== Test --base64-output=never on a binlog with row events ====
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -51,6 +52,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
==== Test non-matching FD event and Row event ====
BINLOG '
4CdYRw8BAAAAYgAAAGYAAAAAAAQANS4xLjE1LW5kYi02LjEuMjQtZGVidWctbG9nAAAAAAAAAAAA
......
......@@ -328,6 +328,7 @@ INSERT INTO t2 SET b=1;
UPDATE t1, t2 SET t1.a=10, t2.a=20;
DROP TABLE t1,t2;
flush logs;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -4135,3 +4136,4 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
......@@ -2245,6 +2245,7 @@ FLUSH LOGS;
#
# Call mysqlbinlog to display the log file contents.
#
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -3786,6 +3787,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Cleanup.
#
......@@ -3868,6 +3870,7 @@ FLUSH LOGS;
#
# Call mysqlbinlog to display the log file contents.
#
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -4077,6 +4080,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Cleanup.
#
......@@ -4235,6 +4239,7 @@ FLUSH LOGS;
#
# Call mysqlbinlog to display the log file contents.
#
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -4746,6 +4751,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Cleanup.
#
......@@ -4796,6 +4802,7 @@ FLUSH LOGS;
#
# Call mysqlbinlog to display the log file contents.
#
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -4853,6 +4860,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Cleanup.
#
......
......@@ -2245,6 +2245,7 @@ FLUSH LOGS;
#
# Call mysqlbinlog to display the log file contents.
#
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -3808,6 +3809,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Cleanup.
#
......@@ -3890,6 +3892,7 @@ FLUSH LOGS;
#
# Call mysqlbinlog to display the log file contents.
#
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -4105,6 +4108,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Cleanup.
#
......@@ -4263,6 +4267,7 @@ FLUSH LOGS;
#
# Call mysqlbinlog to display the log file contents.
#
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -4784,6 +4789,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Cleanup.
#
......@@ -4834,6 +4840,7 @@ FLUSH LOGS;
#
# Call mysqlbinlog to display the log file contents.
#
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -4893,6 +4900,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Cleanup.
#
......
......@@ -124,6 +124,7 @@ FLUSH LOGS;
#
# Call mysqlbinlog to display the log file contents.
#
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -463,6 +464,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Cleanup.
#
......
......@@ -10,6 +10,7 @@ master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
flush logs;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -32,4 +33,5 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
drop table t2;
......@@ -10,6 +10,7 @@ master-bin.000001 # User var # # @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_
master-bin.000001 # Query # # use `test`; insert into t2 values (@v)
master-bin.000001 # Query # # COMMIT
flush logs;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -37,4 +38,5 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
drop table t2;
......@@ -35,6 +35,7 @@ KEY `event_id` (`event_id`),
KEY `visit_id` (`visit_id`),
KEY `data` (`data`)
) ENGINE=MyISAM AUTO_INCREMENT=33900731 DEFAULT CHARSET=latin1;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
BINLOG '
......@@ -47,6 +48,7 @@ Bk3vRhe0AQAAWgAAABEMyQkQAJlXFwIAAAEABv/AIE4AvvVDAQZN70YAK0Rvd25sb2Fkcy9NeVNR
TC00LjEvbXlzcWwtNC4xLjEyYS13aW4zMi56aXBPaAIC
'/*!*/;
SET INSERT_ID=21231039/*!*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
use track/*!*/;
SET TIMESTAMP=1190087942/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
......
......@@ -150,6 +150,7 @@ c1 c3 c4 c5
5 2006-02-22 00:00:00 Tested in Texas 11
--- Test 2 position test --
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -170,8 +171,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- Test 3 First Remote test --
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -201,6 +204,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- Test 4 Second Remote test --
DROP TABLE t1;
......@@ -274,6 +278,7 @@ c1 c3 c4 c5
5 2006-02-22 00:00:00 Tested in Texas 11
--- Test 5 LOAD DATA --
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -281,8 +286,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- Test 6 reading stdin --
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -312,8 +319,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- Test 7 reading stdin w/position --
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -334,6 +343,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- Test 8 switch internal charset --
stop slave;
......
......@@ -652,6 +652,7 @@ show function status like '%mysqltestbug36570%';
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
test mysqltestbug36570_f1 FUNCTION root@localhost t t DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
flush logs;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
......@@ -1178,6 +1179,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
use test;
drop procedure mysqltestbug36570_p1;
drop procedure ` mysqltestbug36570_p2`;
......
......@@ -40,6 +40,7 @@ CREATE TABLE `visits_events` (
KEY `data` (`data`)
) ENGINE=MyISAM AUTO_INCREMENT=33900731 DEFAULT CHARSET=latin1;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
--delimiter /*!*/;
......@@ -119,6 +120,7 @@ SET INSERT_ID=21231039/*!*/;
# 9c90ded 2d 63 6f 6e 6e 65 63 74 6f 72 2d 6a 61 76 61 2d |.connector.java.|
# 9c90dfd 33 2e 30 2e 31 37 2d 67 61 2e 7a 69 70 |3.0.17.ga.zip|
# Query thread_id=28278824 exec_time=0 error_code=0
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
use track/*!*/;
SET TIMESTAMP=1190087942/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
......
SET @session_start_value = @@session.pseudo_slave_mode;
SELECT @session_start_value;
@session_start_value
0
'#--------------------FN_DYNVARS_156_01------------------------#'
SET @@session.pseudo_slave_mode = 0;
Warnings:
Warning 1231 'pseudo_slave_mode' change was ineffective.
SET @@session.pseudo_slave_mode = DEFAULT;
Warnings:
Warning 1231 'pseudo_slave_mode' change was ineffective.
SELECT @@session.pseudo_slave_mode;
@@session.pseudo_slave_mode
0
SET @@session.pseudo_slave_mode = 1;
SET @@session.pseudo_slave_mode = DEFAULT;
Warnings:
Warning 1231 Slave applier execution mode not active, statement ineffective.
SELECT @@session.pseudo_slave_mode;
@@session.pseudo_slave_mode
0
'#---------------------FN_DYNVARS_156_02-------------------------#'
SET pseudo_slave_mode = 1;
SELECT @@pseudo_slave_mode;
@@pseudo_slave_mode
1
SELECT session.pseudo_slave_mode;
ERROR 42S02: Unknown table 'session' in field list
SELECT local.pseudo_slave_mode;
ERROR 42S02: Unknown table 'local' in field list
SET session pseudo_slave_mode = 0;
Warnings:
Warning 1231 Slave applier execution mode not active, statement ineffective.
SELECT @@session.pseudo_slave_mode;
@@session.pseudo_slave_mode
0
'#--------------------FN_DYNVARS_156_03------------------------#'
SET @@session.pseudo_slave_mode = 0;
Warnings:
Warning 1231 'pseudo_slave_mode' change was ineffective.
SELECT @@session.pseudo_slave_mode;
@@session.pseudo_slave_mode
0
SET @@session.pseudo_slave_mode = 1;
SELECT @@session.pseudo_slave_mode;
@@session.pseudo_slave_mode
1
'#--------------------FN_DYNVARS_156_04-------------------------#'
SET @@session.pseudo_slave_mode = -1;
ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of '-1'
SET @@session.pseudo_slave_mode = 2;
ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of '2'
SET @@session.pseudo_slave_mode = "T";
ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'T'
SET @@session.pseudo_slave_mode = "Y";
ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'Y'
SET @@session.pseudo_slave_mode = TRE;
ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'TRE'
SET @@session.pseudo_slave_mode = N;
ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'N'
SET @@session.pseudo_slave_mode = OF;
ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'OF'
SET @@session.pseudo_slave_mode = FF;
ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'FF'
SET @@session.pseudo_slave_mode = '';
ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of ''
SET @@session.pseudo_slave_mode = NO;
ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'NO'
'#-------------------FN_DYNVARS_156_05----------------------------#'
SET @@global.pseudo_slave_mode = 0;
ERROR HY000: Variable 'pseudo_slave_mode' is a SESSION variable and can't be used with SET GLOBAL
SELECT @@global.pseudo_slave_mode;
ERROR HY000: Variable 'pseudo_slave_mode' is a SESSION variable
'#----------------------FN_DYNVARS_156_06------------------------#'
SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='pseudo_slave_mode';
count(VARIABLE_VALUE)
1
'#----------------------FN_DYNVARS_156_07------------------------#'
SELECT IF(@@session.pseudo_slave_mode, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='pseudo_slave_mode';
IF(@@session.pseudo_slave_mode, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@session.pseudo_slave_mode;
@@session.pseudo_slave_mode
1
SELECT VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='pseudo_slave_mode';
VARIABLE_VALUE
ON
'#---------------------FN_DYNVARS_156_08-------------------------#'
SET @@session.pseudo_slave_mode = OFF;
Warnings:
Warning 1231 Slave applier execution mode not active, statement ineffective.
SELECT @@session.pseudo_slave_mode;
@@session.pseudo_slave_mode
0
SET @@session.pseudo_slave_mode = ON;
SELECT @@session.pseudo_slave_mode;
@@session.pseudo_slave_mode
1
'#---------------------FN_DYNVARS_156_09----------------------#'
SET @@session.pseudo_slave_mode = TRUE;
SELECT @@session.pseudo_slave_mode;
@@session.pseudo_slave_mode
1
SET @@session.pseudo_slave_mode = FALSE;
Warnings:
Warning 1231 Slave applier execution mode not active, statement ineffective.
SELECT @@session.pseudo_slave_mode;
@@session.pseudo_slave_mode
0
SET @@session.pseudo_slave_mode = @session_start_value;
Warnings:
Warning 1231 'pseudo_slave_mode' change was ineffective.
SELECT @@session.pseudo_slave_mode;
@@session.pseudo_slave_mode
0
####################### mysql-test\t\pseudo_slave_mode_basic.test ###################
# #
# Variable Name: pseudo_slave_mode #
# Scope: SESSION #
# Access Type: Dynamic #
# Data Type: boolean #
# Default Value: #
# Valid Values: 0,1 #
# #
# #
# Creation Date: 2012-11-16 #
# #
# Description: Test Cases of Dynamic System Variable pseudo_slave_mode #
# that checks the behavior of this variable in the following ways#
# * Default Value #
# * Valid & Invalid values #
# * Scope & Access method #
# * Data Integrity #
# #
# Reference: http://dev.mysql.com/doc/refman/5.5/en/ #
# server-system-variables.html #
# #
###############################################################################
--source include/load_sysvars.inc
########################################################################
# START OF pseudo_slave_mode TESTS #
########################################################################
##############################################################################
# Saving initial value of pseudo_slave_mode in a temporary variable #
##############################################################################
SET @session_start_value = @@session.pseudo_slave_mode;
SELECT @session_start_value;
--echo '#--------------------FN_DYNVARS_156_01------------------------#'
########################################################################
# Display the DEFAULT value of pseudo_slave_mode #
########################################################################
SET @@session.pseudo_slave_mode = 0;
SET @@session.pseudo_slave_mode = DEFAULT;
SELECT @@session.pseudo_slave_mode;
SET @@session.pseudo_slave_mode = 1;
SET @@session.pseudo_slave_mode = DEFAULT;
SELECT @@session.pseudo_slave_mode;
--echo '#---------------------FN_DYNVARS_156_02-------------------------#'
#############################################################################
# Check if pseudo_slave_mode can be accessed with and without @@ sign #
#############################################################################
SET pseudo_slave_mode = 1;
SELECT @@pseudo_slave_mode;
--Error ER_UNKNOWN_TABLE
SELECT session.pseudo_slave_mode;
--Error ER_UNKNOWN_TABLE
SELECT local.pseudo_slave_mode;
SET session pseudo_slave_mode = 0;
SELECT @@session.pseudo_slave_mode;
--echo '#--------------------FN_DYNVARS_156_03------------------------#'
########################################################################
# change the value of pseudo_slave_mode to a valid value #
########################################################################
SET @@session.pseudo_slave_mode = 0;
SELECT @@session.pseudo_slave_mode;
SET @@session.pseudo_slave_mode = 1;
SELECT @@session.pseudo_slave_mode;
--echo '#--------------------FN_DYNVARS_156_04-------------------------#'
###########################################################################
# Change the value of pseudo_slave_mode to invalid value #
###########################################################################
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.pseudo_slave_mode = -1;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.pseudo_slave_mode = 2;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.pseudo_slave_mode = "T";
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.pseudo_slave_mode = "Y";
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.pseudo_slave_mode = TRE;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.pseudo_slave_mode = N;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.pseudo_slave_mode = OF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.pseudo_slave_mode = FF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.pseudo_slave_mode = '';
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.pseudo_slave_mode = NO;
--echo '#-------------------FN_DYNVARS_156_05----------------------------#'
###########################################################################
# Test if accessing global pseudo_slave_mode gives error #
###########################################################################
--error ER_LOCAL_VARIABLE
SET @@global.pseudo_slave_mode = 0;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@global.pseudo_slave_mode;
--echo '#----------------------FN_DYNVARS_156_06------------------------#'
#########################################################################
# Check if the value in SESSION Table contains variable value #
#########################################################################
SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='pseudo_slave_mode';
--echo '#----------------------FN_DYNVARS_156_07------------------------#'
#########################################################################
# Check if the value in SESSION Table matches value in variable #
#########################################################################
SELECT IF(@@session.pseudo_slave_mode, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='pseudo_slave_mode';
SELECT @@session.pseudo_slave_mode;
SELECT VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='pseudo_slave_mode';
--echo '#---------------------FN_DYNVARS_156_08-------------------------#'
###################################################################
# Check if ON and OFF values can be used on variable #
###################################################################
SET @@session.pseudo_slave_mode = OFF;
SELECT @@session.pseudo_slave_mode;
SET @@session.pseudo_slave_mode = ON;
SELECT @@session.pseudo_slave_mode;
--echo '#---------------------FN_DYNVARS_156_09----------------------#'
###################################################################
# Check if TRUE and FALSE values can be used on variable #
###################################################################
SET @@session.pseudo_slave_mode = TRUE;
SELECT @@session.pseudo_slave_mode;
SET @@session.pseudo_slave_mode = FALSE;
SELECT @@session.pseudo_slave_mode;
##############################
# Restore initial value #
##############################
SET @@session.pseudo_slave_mode = @session_start_value;
SELECT @@session.pseudo_slave_mode;
###############################################################
# END OF pseudo_slave_mode TESTS #
###############################################################
......@@ -506,6 +506,8 @@ typedef struct system_variables
double long_query_time_double;
my_bool pseudo_slave_mode;
} SV;
......
......@@ -3270,6 +3270,62 @@ static Sys_var_ulong Sys_sp_cache_size(
GLOBAL_VAR(stored_program_cache_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(256, 512 * 1024), DEFAULT(256), BLOCK_SIZE(1));
static bool check_pseudo_slave_mode(sys_var *self, THD *thd, set_var *var)
{
longlong previous_val= thd->variables.pseudo_slave_mode;
longlong val= (longlong) var->save_result.ulonglong_value;
bool rli_fake= false;
#ifndef EMBEDDED_LIBRARY
rli_fake= thd->rli_fake ? true : false;
#endif
if (rli_fake)
{
if (!val)
{
#ifndef EMBEDDED_LIBRARY
delete thd->rli_fake;
thd->rli_fake= NULL;
#endif
}
else if (previous_val && val)
goto ineffective;
else if (!previous_val && val)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WRONG_VALUE_FOR_VAR,
"'pseudo_slave_mode' is already ON.");
}
else
{
if (!previous_val && !val)
goto ineffective;
else if (previous_val && !val)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WRONG_VALUE_FOR_VAR,
"Slave applier execution mode not active, "
"statement ineffective.");
}
goto end;
ineffective:
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WRONG_VALUE_FOR_VAR,
"'pseudo_slave_mode' change was ineffective.");
end:
return FALSE;
}
static Sys_var_mybool Sys_pseudo_slave_mode(
"pseudo_slave_mode",
"SET pseudo_slave_mode= 0,1 are commands that mysqlbinlog "
"adds to beginning and end of binary log dumps. While zero "
"value indeed disables, the actual enabling of the slave "
"applier execution mode is done implicitly when a "
"Format_description_event is sent through the session.",
SESSION_ONLY(pseudo_slave_mode), NO_CMD_LINE, DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_pseudo_slave_mode));
/****************************************************************************
Used templates
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment