summaryrefslogtreecommitdiff
path: root/mysql-test/include/truncate_file.inc
diff options
context:
space:
mode:
authorunknown <Li-Bing.Song@sun.com>2010-01-08 13:42:23 +0800
committerunknown <Li-Bing.Song@sun.com>2010-01-08 13:42:23 +0800
commitc1043021c81a4394b5aa9961d7106c437275b040 (patch)
tree02c3b5d470c056ddc431efb653a4cdfba1c9172f /mysql-test/include/truncate_file.inc
parent4d090ed4f396b0c24770eafe66f630c3dcdff8fd (diff)
downloadmariadb-git-c1043021c81a4394b5aa9961d7106c437275b040.tar.gz
BUG #28421 Infinite loop on slave relay logs
Manually deleteing one or more entries from 'master-bin.index', will cause master infinitely loop to send one binlog file. When starting a dump session, master opens index file and search the binlog file which is being requested by the slave. The position of the binlog file in the index file is recorded. it will be used to find the next binlog file when current binlog file has dumped completely. As only the position is used, it may not get the correct file if some entries has been removed manually from the index file. the master will reopen the current binlog file which has been dump completely and redump it if it can not get the next binlog file's name from index file. It obviously is a logical error. Even though it is allowed to manually change index file, but it is not recommended. so after this patch, master sends a fatal error to slave and close the dump session if a new binlog file has been generated and master can not get it from the index file.
Diffstat (limited to 'mysql-test/include/truncate_file.inc')
-rw-r--r--mysql-test/include/truncate_file.inc16
1 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/include/truncate_file.inc b/mysql-test/include/truncate_file.inc
new file mode 100644
index 00000000000..c82108681bd
--- /dev/null
+++ b/mysql-test/include/truncate_file.inc
@@ -0,0 +1,16 @@
+# truncate a giving file, all contents of the file are be cleared
+
+if (`SELECT 'x$file' = 'x'`)
+{
+ --echo Please assign a file name to $file!!
+ exit;
+}
+
+let TRUNCATE_FILE= $file;
+
+perl;
+use Env;
+Env::import('TRUNCATE_FILE');
+open FILE, '>', $TRUNCATE_FILE || die "Can not open file $file";
+close FILE;
+EOF