summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis Soares <luis.soares@sun.com>2010-02-02 15:16:47 +0000
committerLuis Soares <luis.soares@sun.com>2010-02-02 15:16:47 +0000
commit56b911f893594004c2da92c9a77b2f122fe317d9 (patch)
tree05d67ad0dd519370fab92e60f66b7b973623195e
parent9b75c2f268f0e40fe74f38759c8f8551b2637145 (diff)
downloadmariadb-git-56b911f893594004c2da92c9a77b2f122fe317d9.tar.gz
BUG#47639: The rpl_binlog_corruption test fails on Windows
The test case rpl_binlog_corruption fails on windows because when adding a line to the binary log index file it gets terminated with a CR+LF (which btw, is the normal case in windows, but not on Unixes - LF). This causes mismatch between the relay log names, causing mysqld to report that it cannot find the log file. We fix this by creating the instrumented index file through mysql, ie, using SELECT ... INTO DUMPFILE ..., as opposed on relying on ultimatly OS commands like: -- echo "..." > index. These changes go into the file and make the procedure platform independent: include/setup_fake_relay_log.inc Side note: when using SELECT ... INTO DUMPFILE ..., one needs to check if mysqld is running with secure_file_priv. If it is, we do it in two steps: 1. create the file on the allowed location; 2. move it to the datadir. If it is not, then we just create the file directly on the datadir (so previous step 2. is not needed).
-rw-r--r--mysql-test/include/setup_fake_relay_log.inc17
1 files changed, 16 insertions, 1 deletions
diff --git a/mysql-test/include/setup_fake_relay_log.inc b/mysql-test/include/setup_fake_relay_log.inc
index f88806e1079..5b9e7f72fdd 100644
--- a/mysql-test/include/setup_fake_relay_log.inc
+++ b/mysql-test/include/setup_fake_relay_log.inc
@@ -69,7 +69,22 @@ let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`;
# Create relay log file.
copy_file $fake_relay_log $_fake_relay_log;
# Create relay log index.
---exec echo $_fake_filename-fake.000001 > $_fake_relay_index
+
+if (`SELECT LENGTH(@@secure_file_priv) > 0`)
+{
+ -- let $_file_priv_dir= `SELECT @@secure_file_priv`;
+ -- let $_suffix= `SELECT UUID()`
+ -- let $_tmp_file= $_file_priv_dir/fake-index.$_suffix
+
+ -- eval select '$_fake_filename-fake.000001\n' into dumpfile '$_tmp_file'
+ -- copy_file $_tmp_file $_fake_relay_index
+ -- remove_file $_tmp_file
+}
+
+if (`SELECT LENGTH(@@secure_file_priv) = 0`)
+{
+ -- eval select '$_fake_filename-fake.000001\n' into dumpfile '$_fake_relay_index'
+}
# Setup replication from existing relay log.
eval CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_filename-fake.000001', RELAY_LOG_POS=4;