[MDEV-22092] Binlog recovery fails when binlog rotation happens through FLUSH LOGS Created: 2020-03-31  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Replication
Affects Version/s: 10.1, 10.2, 10.3, 10.4
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Sujatha Sivakumar (Inactive) Assignee: Andrei Elkin
Resolution: Unresolved Votes: 0
Labels: None


 Description   

binlog based recovery works only in a case where prepared transaction is present in the active binary log at the time of crash.

For example in the following test 'INSERT INTO t VALUES (20)' is in prepared state and 'master-bin.000002' is

active log. Server crashed here. Upon recovery two records are found in table.

Test case:
======
--source include/have_innodb.inc
--source include/have_log_bin.inc
--source include/have_debug.inc
--source include/have_binlog_format_statement.inc

RESET MASTER;

CREATE TABLE t ( f INT ) ENGINE=INNODB;
INSERT INTO t VALUES (10);
FLUSH LOGS;

  1. Hold insert after write to binlog and before "run_commit_ordered" in engine
    connect(con1,localhost,root,,);
    SET DEBUG_SYNC= "commit_after_release_LOCK_log SIGNAL con1_ready WAIT_FOR con1_go";
    send INSERT INTO t VALUES (20);

--connection default
SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
#FLUSH LOGS;
#FLUSH LOGS;

--source include/kill_and_restart_mysqld.inc

--connection default
SELECT * FROM t;
--source include/show_binlog_events.inc
DROP TABLE t;

Bug case:

In the above test if "FLUSH LOGS" are uncommented the active binary log will be 'master-bin.000004'.

Prepared transaction will be in 'master-bin.000002'. Now upon restart table has only one row with value '10'.

Binlog recovery doesn't work in this case.


Generated at Thu Feb 08 09:12:07 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.