Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-37116

Replication should remain async until the primary receives rpl_semi_sync_master_wait_for_slave_count no. of ACKs

    XMLWordPrintable

Details

    • Unexpected results
    • Q3/2025 Maintenance

    Description

      At present when the primary doesn't receive rpl_semi_sync_master_wait_for_slave_count no. of ACKs the subsequent SQL statements hit the timeout alternately. I mean one statement hits the timeout and the next one doesn't, the next one hits the timeout and the next one doesn't. It's reflected both in the SQL interface execution time as well as in the log.

      Repro steps
      rpl_topology: 1->2 1->3
      Set up semi-sync replication on the primary and on the replicas.

      @primary:

      MariaDB [(none)]> SHOW STATUS LIKE 'Rpl_semi_sync_master_status';
      +-----------------------------+-------+
      | Variable_name               | Value |
      +-----------------------------+-------+
      | Rpl_semi_sync_master_status | OFF   |
      +-----------------------------+-------+
      1 row in set (0.001 sec)
       
      MariaDB [(none)]> SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
      +------------------------------+-------+
      | Variable_name                | Value |
      +------------------------------+-------+
      | Rpl_semi_sync_master_clients | 2     |
      +------------------------------+-------+
      1 row in set (0.001 sec)
       
      MariaDB [(none)]> SHOW VARIABLES LIKE '%semi%';
      +-------------------------------------------+--------------+
      | Variable_name                             | Value        |
      +-------------------------------------------+--------------+
      | rpl_semi_sync_master_enabled              | ON           |
      | rpl_semi_sync_master_timeout              | 3000         |
      | rpl_semi_sync_master_trace_level          | 32           |
      | rpl_semi_sync_master_wait_for_slave_count | 3            |
      | rpl_semi_sync_master_wait_no_slave        | ON           |
      | rpl_semi_sync_master_wait_point           | AFTER_COMMIT |
      | rpl_semi_sync_slave_delay_master          | OFF          |
      | rpl_semi_sync_slave_enabled               | OFF          |
      | rpl_semi_sync_slave_kill_conn_timeout     | 5            |
      | rpl_semi_sync_slave_trace_level           | 32           |
      +-------------------------------------------+--------------+
      10 rows in set (0.001 sec)
       
      MariaDB [(none)]> USE test;
      Database changed
      MariaDB [test]> CREATE TABLE t1 (id INT) ENGINE=Innodb;
      Query OK, 0 rows affected (0.006 sec)
       
      MariaDB [test]> SHOW STATUS LIKE 'Rpl_semi_sync_master_status';
      +-----------------------------+-------+
      | Variable_name               | Value |
      +-----------------------------+-------+
      | Rpl_semi_sync_master_status | ON    |
      +-----------------------------+-------+
      1 row in set (0.000 sec)
       
      MariaDB [test]> INSERT INTO t1 VALUES (1);
      Query OK, 1 row affected (3.001 sec)
       
      MariaDB [test]> SHOW STATUS LIKE 'Rpl_semi_sync_master_status';
      +-----------------------------+-------+
      | Variable_name               | Value |
      +-----------------------------+-------+
      | Rpl_semi_sync_master_status | OFF   |
      +-----------------------------+-------+
      1 row in set (0.000 sec)
       
      MariaDB [test]> INSERT INTO t1 VALUES (2);
      Query OK, 1 row affected (0.001 sec)
       
      MariaDB [test]> SHOW STATUS LIKE 'Rpl_semi_sync_master_status';
      +-----------------------------+-------+
      | Variable_name               | Value |
      +-----------------------------+-------+
      | Rpl_semi_sync_master_status | ON    |
      +-----------------------------+-------+
      1 row in set (0.000 sec)
       
      MariaDB [test]> INSERT INTO t1 VALUES (3);
      Query OK, 1 row affected (3.001 sec)
       
      MariaDB [test]> SHOW STATUS LIKE 'Rpl_semi_sync_master_status';
      +-----------------------------+-------+
      | Variable_name               | Value |
      +-----------------------------+-------+
      | Rpl_semi_sync_master_status | OFF   |
      +-----------------------------+-------+
      1 row in set (0.000 sec)
       
      MariaDB [test]> INSERT INTO t1 VALUES (4);
      Query OK, 1 row affected (0.001 sec)
       
      MariaDB [test]> SHOW STATUS LIKE 'Rpl_semi_sync_master_status';
      +-----------------------------+-------+
      | Variable_name               | Value |
      +-----------------------------+-------+
      | Rpl_semi_sync_master_status | ON    |
      +-----------------------------+-------+
      1 row in set (0.000 sec)
       
      MariaDB [test]>
      

      log:

      2025-06-30 13:24:20 9 [Note] Semi-sync replication switched ON with slave (server_id: 103) at (binny1.000001, 3273)
       
      2025-06-30 13:28:15 12 [Warning] Timeout waiting for reply of binlog (file: binny1.000001, pos: 3438), semi-sync up to file binny1.000001, position 1959.
      2025-06-30 13:28:15 12 [Note] Semi-sync replication switched OFF.
       
      2025-06-30 13:28:36 9 [Note] Semi-sync replication switched ON with slave (server_id: 102) at (binny1.000001, 3603)
      2025-06-30 13:28:50 12 [Warning] Timeout waiting for reply of binlog (file: binny1.000001, pos: 3768), semi-sync up to file binny1.000001, position 1959.
      2025-06-30 13:28:50 12 [Note] Semi-sync replication switched OFF.
      2025-06-30 13:29:03 9 [Note] Semi-sync replication switched ON with slave (server_id: 102) at (binny1.000001, 3933)
      

      Expected behavior
      All statements after the timeout should fall back to async until the primary receives rpl_semi_sync_master_wait_for_slave_count no. of ACKs. In other words the status variable Rpl_semi_sync_master_status should remain Off until the primary receives rpl_semi_sync_master_wait_for_slave_count no. of ACKs.

      Attachments

        Issue Links

          Activity

            People

              ParadoxV5 Jimmy Hú
              susil.behera Susil Behera
              Jimmy Hú Jimmy Hú
              Brandon Nesterenko Brandon Nesterenko
              Susil Behera Susil Behera
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.