mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
eec4836a1b
BIN LOG HAS BEEN MOVED When moving the binary/relay log files from one location to another and restarting the server with a different log-bin or relay-log paths, would cause the startup process to abort. The root cause was that the server would not be able to find the log files because it would consider old paths for entries in the index file instead of the new location. What's even worse, the relative paths would not be considered relative to the path provided in log-bin and relay-log, but to mysql_data_dir. We fix the cases where the server contains relative paths. When the server is reading from the index file, it checks whether the entry contains relative paths. If it does, we replace it with the absolute path set in log-bin/relay-log option. Absolute paths remain unchanged and the index must be manually edited to consider the new log-bin and/or relay-log path (this should be documented). This is a fix for a GA version, that does not break behavior (that much). For development versions, we should go with Zhenxing's approach that removes paths altogether from index files. mysql-test/include/begin_include_file.inc: Added parameter to keep the begin_include_file.inc silent. Useful when including scripts that contain platform dependent parameters, for example: --let $rpl_server_parameters=--log-bin=$tmpdir/slave-bin --relay-log=$tmpdir/slave-relay-bin --let $keep_include_silent=1 source include/rpl_start_server.inc; --let $keep_include_silent=0 We want the paths ($tmpdir/slave-bin and $tmpdir/slave-relay-bin) not to be in the result file. mysql-test/suite/rpl/t/rpl_binlog_index.test: Test case. sql/log.cc: When finding the corresponding log entry in the index file, we first normalize the paths before doing the comparison. This will make relative paths to be turned into absolute paths (based on the opt_bin_logname or opt_relay_logname) and then compared against also, expanded paths entered, through CHANGE MASTER for instance. sql/log.h: Added normalize_binlog_name, which turns relative paths, into absolute paths given the parameter: is_relay_log ? opt_relay_logname : opt_bin_logname . sql/mysqld.cc: Exposing opt_bin_logname. sql/mysqld.h: Exposing opt_bin_logname.
91 lines
2.9 KiB
PHP
91 lines
2.9 KiB
PHP
# ==== Purpose ====
|
|
#
|
|
# This is an auxiliary file that facilitates writing include/*.inc
|
|
# files. It has three purposes:
|
|
#
|
|
# 1. Store mtr's state at the beginning of the .inc file and restore
|
|
# the state at the end. The following status is restored:
|
|
#
|
|
# disable_warnings
|
|
# disable_query_log
|
|
# disable_result_log
|
|
# disable_abort_on_errors
|
|
# Current connection
|
|
#
|
|
# 2. This file also prints the name of the .inc file that sources
|
|
# it. Only the name of the top-level .inc file is printed: if
|
|
# file_1.inc sources file_2.inc, then this file only prints
|
|
# file_1.inc.
|
|
#
|
|
# 3. If the mysqltest variable $rpl_debug is set, then
|
|
# this file will print:
|
|
#
|
|
# ==== BEGIN include/<filename> ====
|
|
#
|
|
# and end_include_file.inc will print
|
|
#
|
|
# ==== END include/<filename> ====
|
|
#
|
|
# These printouts are indented to make it easier to read the
|
|
# result log.
|
|
#
|
|
#
|
|
# ==== Usage ====
|
|
#
|
|
# # At the beginning of include/my_file.inc:
|
|
# --let $include_filename= my_file.inc
|
|
# [--let $rpl_debug= 1]
|
|
# --source include/begin_include_file.inc
|
|
#
|
|
# # At the end of include/my_file.inc:
|
|
# --let $include_filename= my_file.inc
|
|
# --source include/end_include_file.inc
|
|
#
|
|
# Parameters:
|
|
# $include_filename
|
|
# The basename of the file: a file named /path/to/my_file.inc
|
|
# should set $include_filename=my_file.inc. This parameter
|
|
# must be provided both for begin_include_file.inc and
|
|
# end_include_file.inc.
|
|
#
|
|
# $keep_include_silent
|
|
# This specifies whether it should be echoed to the result file
|
|
# the following string: include/$include_filename
|
|
# If not set, the string will be echoed.
|
|
#
|
|
# $rpl_debug
|
|
# If set, this script will print the following text:
|
|
# ==== BEGIN include/$include_filename.inc ====
|
|
|
|
|
|
# Print 'include/$include_filename', but only when invoked from
|
|
# the top-level. We don't want to print
|
|
# 'include/$include_filename' from all files included
|
|
# recursively.
|
|
if (!$_include_file_depth)
|
|
{
|
|
if (!$keep_include_silent)
|
|
{
|
|
--echo include/$include_filename
|
|
}
|
|
--let $_include_file_depth= 0
|
|
}
|
|
--inc $_include_file_depth
|
|
if ($rpl_debug)
|
|
{
|
|
--echo $_include_file_indent==== BEGIN include/$include_filename ====
|
|
}
|
|
|
|
--let $_include_file_enabled_warnings= $ENABLED_WARNINGS$_include_file_enabled_warnings
|
|
--let $_include_file_enabled_query_log= $ENABLED_QUERY_LOG$_include_file_enabled_query_log
|
|
--let $_include_file_enabled_result_log= $ENABLED_RESULT_LOG$_include_file_enabled_result_log
|
|
--let $_include_file_enabled_abort_on_error= $ENABLED_ABORT_ON_ERROR$_include_file_enabled_abort_on_error
|
|
--let $_include_file_connection= $CURRENT_CONNECTION,$_include_file_connection
|
|
|
|
if ($rpl_debug)
|
|
{
|
|
--echo $_include_file_indent con='$CURRENT_CONNECTION' warn='$ENABLED_WARNINGS' qlog='$ENABLED_QUERY_LOG' rlog='$ENABLED_RESULT_LOG' aborterr='$ENABLED_ABORT_ON_ERROR'
|
|
}
|
|
|
|
--let $include_filename=
|
|
--let $_include_file_indent= .$_include_file_indent
|