From b74a229c23dd1d67c1f108cfec261e7756c86537 Mon Sep 17 00:00:00 2001 From: Akhila Maddukuri Date: Fri, 7 Dec 2012 18:26:02 +0530 Subject: [PATCH] Bug #15930494 MYSQLDUMP TEST SOMETIMES FAILS DUE TO MIXING STDOUT AND STDERR Fix: Added a destination file to mysqldump. --- mysql-test/r/mysqldump.result | 27 ++++++++++++++++----------- mysql-test/t/mysqldump.test | 11 +++++++++-- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 2e34bb10a87..96ab16f113f 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -5115,15 +5115,12 @@ INSERT INTO b12809202_db.t2 VALUES (1), (2), (3); # Note : In the following dump the transaction # should start only after the logs are # flushed, as 'flush logs' causes implicit -# commit starting 5.5. +# commit starting 5.5.Also, as stderr is +# unbuffered, it is redirected to a different +# file to avoid diffs due to bad stdout/stderr +# order in the output. #### Dump starts here #### --- Connecting to localhost... --- main : logs flushed successfully! --- Starting transaction... --- Retrieving table structure for table t1... --- Sending SELECT query... --- Retrieving rows... -- -- Host: localhost Database: b12809202_db -- ------------------------------------------------------ @@ -5158,9 +5155,6 @@ CREATE TABLE `t1` ( LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; INSERT INTO `t1` VALUES (1),(2),(3); --- Retrieving table structure for table t2... --- Sending SELECT query... --- Retrieving rows... /*!40000 ALTER TABLE `t1` ENABLE KEYS */; UNLOCK TABLES; @@ -5185,7 +5179,6 @@ LOCK TABLES `t2` WRITE; INSERT INTO `t2` VALUES (1),(2),(3); /*!40000 ALTER TABLE `t2` ENABLE KEYS */; UNLOCK TABLES; --- Disconnecting from localhost... /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -5197,6 +5190,18 @@ UNLOCK TABLES; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed +## stderr ## +-- Connecting to localhost... +-- main : logs flushed successfully! +-- Starting transaction... +-- Retrieving table structure for table t1... +-- Sending SELECT query... +-- Retrieving rows... +-- Retrieving table structure for table t2... +-- Sending SELECT query... +-- Retrieving rows... +-- Disconnecting from localhost... + #### Dump ends here #### DROP TABLE b12809202_db.t1; DROP TABLE b12809202_db.t2; diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 6d136c0f00a..b6af97c6f41 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -2347,11 +2347,17 @@ INSERT INTO b12809202_db.t2 VALUES (1), (2), (3); --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 # commit starting 5.5.Also, as stderr is +--echo # unbuffered, it is redirected to a different +--echo # file to avoid diffs due to bad stdout/stderr +--echo # order in the output. --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 +--exec $MYSQL_DUMP --verbose --single-transaction --flush-log b12809202_db 2>$MYSQLTEST_VARDIR/tmp/b12809202_stderr.sql +--echo +--echo ## stderr ## +--cat_file $MYSQLTEST_VARDIR/tmp/b12809202_stderr.sql --echo --echo #### Dump ends here #### @@ -2359,6 +2365,7 @@ INSERT INTO b12809202_db.t2 VALUES (1), (2), (3); DROP TABLE b12809202_db.t1; DROP TABLE b12809202_db.t2; DROP DATABASE b12809202_db; +--remove_file $MYSQLTEST_VARDIR/tmp/b12809202_stderr.sql --echo # --echo # Delete all existing binary logs.