/usr/lib/mysql-testsuite/include/relocate_binlogs.inc is in mysql-testsuite-5.6 5.6.16-1~exp1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | # ==== Purpose ====
#
# Relocates the relay logs and index file from
# a directory into another. The logs relocated
# are the one listed in the index file.
#
# ==== Usage ====
#
# [--let $relocate_disable_query_log= 1]
# [--let $rpl_debug= 1]
# [--let $relocate_is_windows= 0]
# [--let $relocate_recreate_index= 0]
# [--let $relocate_fix_relay_log_info= 0]
# --let $relocate_from= DIR
# --let $relocate_to= DIR
# --let $relocate_index_file= FNAME
# --source include/relocate_binlogs.inc
if ($relocate_disable_query_log)
{
--disable_query_log
}
--let $_path_separator=/
if ($relocate_is_windows)
{
--let $_path_separator=\
}
if ($relocate_index_file)
{
SET SQL_LOG_BIN=0;
CREATE TEMPORARY TABLE tmp(id INT AUTO_INCREMENT PRIMARY KEY, filename VARCHAR(1024));
--let $write_var=
--let $_index_file= $relocate_index_file
--let $_index_file_basename= `SELECT RIGHT(RTRIM("$_index_file"), LOCATE("$_path_separator",REVERSE(RTRIM("$_index_file"))) -1)`
--let $_from= $relocate_from
--let $_to= $relocate_into
# chmod to allow the following LOAD DATA
--chmod 0666 $_index_file
--eval LOAD DATA INFILE '$_index_file' INTO TABLE tmp (filename)
--let $count= `SELECT count(*) FROM tmp`
while ($count)
{
--let $_filename= `select filename from tmp where id=$count`
--let $_filename= `SELECT RIGHT(RTRIM("$_filename"), LOCATE("$_path_separator",REVERSE(RTRIM("$_filename"))) -1)`
--move_file $_from/$_filename $_to/$_filename
if ($relocate_recreate_index)
{
if ($relocate_is_windows)
{
--let $_write_var=$_to\$_filename\n
}
if (!$relocate_is_windows)
{
--let $_write_var=$_to/$_filename\n
}
if (!$write_var)
{
--let $write_var=$_write_var
}
if (!`SELECT STRCMP('$write_var', '$_write_var') = 0`)
{
--let $write_var=$_write_var$write_var
}
}
--dec $count
}
if (!$relocate_recreate_index)
{
--move_file $_index_file $_to/$_index_file_basename
}
if ($relocate_recreate_index)
{
--let $write_to_file= $_to/$_index_file_basename
--source include/write_var_to_file.inc
--remove_file $_index_file
}
DROP TEMPORARY TABLE tmp;
if ($relocate_fix_relay_log_info)
{
CREATE TEMPORARY TABLE tmp(id INT AUTO_INCREMENT PRIMARY KEY, entry VARCHAR(1024));
--let $write_var=
# chmod to allow the following LOAD DATA
--chmod 0666 $relocate_fix_relay_log_info
--eval LOAD DATA INFILE '$relocate_fix_relay_log_info' INTO TABLE tmp (entry)
--let $count= `SELECT count(*) FROM tmp`
--let $_curr_entry= `SELECT entry FROM tmp WHERE id=2`
--let $_curr_entry_basename= `SELECT RIGHT(RTRIM("$_curr_entry"), LOCATE("$_path_separator",REVERSE(RTRIM("$_curr_entry"))) -1)`
if ($relocate_is_windows)
{
--eval UPDATE tmp SET entry='$_to\$_curr_entry_basename' WHERE id=2
}
if (!$relocate_is_windows)
{
--eval UPDATE tmp SET entry='$_to/$_curr_entry_basename' WHERE id=2
}
--remove_file $relocate_fix_relay_log_info
while($count)
{
--let $_write_var= `SELECT entry FROM tmp WHERE id= $count`
--let $write_var=$_write_var\n$write_var
--dec $count
}
--let $write_to_file= $relocate_fix_relay_log_info
--source include/write_var_to_file.inc
DROP TEMPORARY TABLE tmp;
}
SET SQL_LOG_BIN=1;
}
if ($relocate_disable_query_log)
{
--enable_query_log
}
|