summaryrefslogtreecommitdiff
path: root/mysql-test/t/mysqldump.test
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay.choubey@oracle.com>2011-12-23 23:05:00 +0530
committerNirbhay Choubey <nirbhay.choubey@oracle.com>2011-12-23 23:05:00 +0530
commita4343d56eda71ab95e8d092cebedfd5abf7c710b (patch)
treed9aca95cf2b8365f593db3f7ddc7ec48f0cb969c /mysql-test/t/mysqldump.test
parent74a8331c084a038cab39a47cbb67c027aa8a9170 (diff)
downloadmariadb-git-a4343d56eda71ab95e8d092cebedfd5abf7c710b.tar.gz
Bug#12809202 61854: MYSQLDUMP --SINGLE-TRANSACTION
--FLUSH-LOG BREAKS CONSISTENCY The transaction started by mysqldump gets committed implicitly when flush-log is specified along with single-transaction option, and hence can break consistency. This is because, COM_REFRESH is executed in order to flush logs and starting from 5.5 this command performs an implicit commit. Fixed by making sure that COM_REFRESH is executed before the transaction has started and not after it. Note : This patch triggers following behavioral changes in mysqldump : 1) After this patch we no longer flush logs before dumping each database if --single-transaction option is given like it was done before (in the absence of --lock-all-tables and --master-data options). 2) Also, after this patch, we start acquiring FTWRL before flushing logs in cases when only --single-transaction and --flush-logs are given. It becomes safe to use mysqldump with these two options and without --master-data parameter for backups.
Diffstat (limited to 'mysql-test/t/mysqldump.test')
-rw-r--r--mysql-test/t/mysqldump.test32
1 files changed, 32 insertions, 0 deletions
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index e224bf6afe3..b1688986090 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -2215,5 +2215,37 @@ CREATE TABLE t1 (a INT);
--exec $MYSQL_DUMP --compatible=no_t,no_f --skip-comments test
DROP TABLE t1;
+--echo #
+--echo # Bug#12809202 61854: MYSQLDUMP --SINGLE-TRANSACTION --FLUSH-LOG BREAKS
+--echo # CONSISTENCY
+--echo #
+
+--disable_warnings
+DROP DATABASE IF EXISTS b12809202_db;
+--enable_warnings
+
+CREATE DATABASE b12809202_db;
+CREATE TABLE b12809202_db.t1 (c1 INT);
+CREATE TABLE b12809202_db.t2 (c1 INT);
+
+INSERT INTO b12809202_db.t1 VALUES (1), (2), (3);
+INSERT INTO b12809202_db.t2 VALUES (1), (2), (3);
+
+--echo # Starting mysqldump with --single-transaction & --flush-log options..
+--echo # Note : In the following dump the transaction
+--echo # should start only after the logs are
+--echo # flushed, as 'flush logs' causes implicit
+--echo # commit starting 5.5.
+--echo
+--echo #### Dump starts here ####
+--replace_regex /-- Server version.*// /-- MySQL dump .*// /-- Dump completed on .*/-- Dump completed/
+--exec $MYSQL_DUMP --verbose --single-transaction --flush-log b12809202_db 2>&1
+--echo
+--echo #### Dump ends here ####
+
+DROP TABLE b12809202_db.t1;
+DROP TABLE b12809202_db.t2;
+DROP DATABASE b12809202_db;
+
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc