forked from alibaba/AliSQL
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug #17076131 MYSQLDUMP FAILS WHEN ERR LOG ON RUNNING SERVER IS DELET…
…ED ON WINDOWS Problem: As the title mentions, on windows mysqldump tool is creating the dump file without the content (tables, views etc) of a database that is dumped when the error log file is deleted (by the user). Similar behaviour is not happening on Linux falvours. The difference is due to the difference in handling of the deleted files. In Windows, the line "if (flush_logs || opt_delete_master_logs)" in main.c of mysqldump is returning error whereas on linux this line is passing Solution: The core problem is that, in Windows, the new error log file is being created but the old file descriptor which is associated with both stdout and stderr stream is not being closed by the program. So a retry logic has been implemented where we close the error log's file descriptor (associated open fds of stderr and stdout) in the first attempt and open a new file and associating it with stdout/stderr streams.
- Loading branch information
Anirudh Mangipudi
committed
May 26, 2014
1 parent
a3654cc
commit 820ecb0
Showing
5 changed files
with
57 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# | ||
# Bug#17076131 MYSQLDUMP FAILS WHEN ERR LOG ON RUNNING SERVER IS | ||
# DELETED ON WINDOWS | ||
# | ||
# Creating file aliases. | ||
# Executing mysqldump normally. | ||
# Removing Error_log file. | ||
# Executing mysqldump after deleting error_log file. | ||
# Checking diff of the 2 dumps. | ||
# No Difference found. | ||
# Clean Up. | ||
# End of Test. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--no-console | ||
--log-error=$MYSQLTEST_VARDIR/tmp/mysql.err |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--echo # | ||
--echo # Bug#17076131 MYSQLDUMP FAILS WHEN ERR LOG ON RUNNING SERVER IS | ||
--echo # DELETED ON WINDOWS | ||
--echo # | ||
|
||
--source include/not_embedded.inc | ||
|
||
--echo # Creating file aliases. | ||
let $dump_with_err_log=$MYSQLTEST_VARDIR/tmp/bug17076131_with_err_log.sql; | ||
let $dump_without_err_log=$MYSQLTEST_VARDIR/tmp/bug17076131_without_err_log.sql; | ||
|
||
--echo # Executing mysqldump normally. | ||
--exec $MYSQL_DUMP --extended-insert --flush-logs --add-drop-database --add-drop-table --force --databases --skip-dump-date mysql > $dump_with_err_log | ||
|
||
--echo # Removing Error_log file. | ||
--move_file $MYSQLTEST_VARDIR/tmp/mysql.err $MYSQLTEST_VARDIR/tmp/mysql-temp.err | ||
|
||
--echo # Executing mysqldump after deleting error_log file. | ||
--exec $MYSQL_DUMP --extended-insert --flush-logs --add-drop-database --add-drop-table --force --databases --skip-dump-date mysql > $dump_without_err_log | ||
|
||
--echo # Checking diff of the 2 dumps. | ||
--diff_files $dump_with_err_log $dump_without_err_log | ||
--echo # No Difference found. | ||
|
||
--echo # Clean Up. | ||
--remove_file $dump_with_err_log | ||
--remove_file $dump_without_err_log | ||
--echo # End of Test. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters