1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00
Files
mariadb/sql/rpl_relay_log_info_file.h
ParadoxV5 8436fe3f48 MDEV-39788: Remove added line in master.info format
The line-count lines in `master.info` and `relay-log.info`
have been inconsistent (off by one) since their introduction.
MDEV-37530 “fixed” this with its common code merger by chance,
changing `master.info` to use `relay-log.info`’s line-count definition.
This change, howëver, affected backward compatibility,
as `master.info` now expects an ignored MySQL-only line
where the first `key=value` option, `master_use_gtid`, is.

Since this legacy text-based format has limitations that make
it due for replacement, only code reüsablility is valuable,
and its consistency does not outweigh its compatibility.
Therefore, this commit solves this problem without reverting code by:
* Changing the writing code to be compatible with both interpretations
  (albeit inconsistent with the reading code)
* Adding a shim entry to `master.info`’s list
  to emulate prior versions’ reading behaviour
  * Although this solution can only restore upgrade compatibility with
    versions 10.0+, versions before MariaDB 10 have long been EOL.

While here, this commit also fixes code and
comments that contradict the actual effect.

[P.S.] The test for this regression is pushed to 10.11 in PR #5147.

Reviewed-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com>
2026-07-28 13:29:55 -06:00

59 lines
1.7 KiB
C

/*
Copyright (c) 2025 MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA.
*/
#ifndef RPL_RELAY_LOG_INFO_FILE_H
#define RPL_RELAY_LOG_INFO_FILE_H
#include "rpl_info_file.h"
/// @note The line count excludes the line-count line.
struct Relay_log_info_file: Info_file
{
/**
`@@relay_log_info_file` values in SHOW SLAVE STATUS order
@{
*/
String_value<> relay_log_file;
Int_value<my_off_t> relay_log_pos;
/// Relay_Master_Log_File (of the event *group*)
String_value<> read_master_log_file;
/// Exec_Master_Log_Pos (of the event *group*)
Int_value<my_off_t> read_master_log_pos;
/// SQL_Delay
Int_value<uint32_t> sql_delay;
/// }@
inline static const Mem_fn VALUE_LIST[] {
&Relay_log_info_file::relay_log_file,
&Relay_log_info_file::relay_log_pos,
&Relay_log_info_file::read_master_log_file,
&Relay_log_info_file::read_master_log_pos,
&Relay_log_info_file::sql_delay
};
bool load_from_file() override
{
return Info_file::load_from_file(VALUE_LIST, /* Exec_Master_Log_Pos */ 4);
}
void save_to_file() override
{
return Info_file::save_to_file(VALUE_LIST);
}
};
#endif