Commit 2c032b99 authored by unknown's avatar unknown

MDEV-4983: Do not leave stale master-bin.state binlog state file

Attempt to read the master-bin.state file always, even if the
binlog files (master-bin.index and master-bin.XXXXXX) have been
deleted.

This allows to easily preserve the binlog state when provisioning
a new server from a copy of an old one, without needing to copy
over the binlog files themselves.
parent a4281992
......@@ -9209,10 +9209,16 @@ MYSQL_BIN_LOG::do_binlog_recovery(const char *opt_name, bool do_xa_recovery)
if ((error= find_log_pos(&log_info, NullS, 1)))
{
/*
If there are no binlog files (LOG_INFO_EOF), then we still try to read
the .state file to restore the binlog state. This allows to copy a server
to provision a new one without copying the binlog files (except the
master-bin.state file) and still preserve the correct binlog state.
*/
if (error != LOG_INFO_EOF)
sql_print_error("find_log_pos() failed (error: %d)", error);
else
error= 0;
error= read_state_from_file();
return error;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment