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

Replica stops with error 1526 on a row event for an INTERVAL partitioned table when the master session has another time zone

    XMLWordPrintable

Details

    • Q4/2026 Server Maintenance

    Description

      --source include/have_partition.inc
      --source include/have_binlog_format_row.inc
      --source include/master-slave.inc
       
      --connection master
      --error 0,ER_PARSE_ERROR,ER_PARTITIONS_MUST_BE_DEFINED_ERROR
      CREATE TABLE t1 (c DATE) PARTITION BY RANGE COLUMNS (c) INTERVAL 1 DAY (PARTITION p0 VALUES LESS THAN ('2026-04-30'));
      if ($mysql_errno)
      {
        --skip Needs RANGE COLUMNS ... INTERVAL partitioning
      }
      --sync_slave_with_master
      # The replica applies the row events in the time zone +00:00
      --source include/stop_slave_sql.inc
      SET @save_time_zone= @@GLOBAL.time_zone;
      SET GLOBAL time_zone='+00:00';
      START SLAVE SQL_THREAD;
      --source include/wait_for_slave_sql_to_start.inc
       
      --connection master
      SET time_zone='+13:00';
      SET timestamp= UNIX_TIMESTAMP('2026-05-03 01:00:00');
      # 2026-05-03 is the current date in the time zone of the master session
      INSERT INTO t1 VALUES ('2026-05-03');
       
      --connection slave
      --let $i= 300
      while ($i)
      {
        --let $err= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1)
        if ($err)
        {
          --die The replica stopped: it adds the INTERVAL partitions up to the current date in its own time zone, not in the time zone of the master session
        }
        --let $n= query_get_value(SELECT COUNT(*) AS n FROM t1, n, 1)
        if ($n == 1)
        {
          --let $i= 1
        }
        --sleep 0.1
        --dec $i
      }
      if ($n != 1)
      {
        --die The row did not reach the replica within 30 seconds
      }
      --source include/stop_slave_sql.inc
      SET GLOBAL time_zone= @save_time_zone;
      START SLAVE SQL_THREAD;
      --source include/wait_for_slave_sql_to_start.inc
       
      --connection master
      DROP TABLE t1;
      --source include/rpl_end.inc

      Leads to:

      CS 13.1.2 87e62ca17270e163a6d41b3fc8d6f4d440f1bb88 (Optimized, Clang 22.1.8-20260622) Build 06/10/2026

      mysqltest: At line 42: The replica stopped: it adds the INTERVAL partitions up to the current date in its own time zone, not in the time zone of the master session

      The replica error log:

      CS 13.1.2 87e62ca17270e163a6d41b3fc8d6f4d440f1bb88 (Optimized, Clang 22.1.8-20260622) Build 06/10/2026

      2026-10-07 10:21:06 10 [ERROR] Slave SQL: Could not execute Write_rows_v1 event on table test.t1; Table has no partition for value from column_list, Error_code: 1526; handler error HA_ERR_NO_PARTITION_FOUND; the event's master log master-bin.000001, end_log_pos 0, Gtid 0-1-2, Internal MariaDB error code: 1526
      2026-10-07 10:21:06 10 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'master-bin.000001' position 587; GTID position '0-1-1'

      With the replica time zone set to +13:00, the row is applied. With binlog_format STATEMENT or MIXED, the row is applied too. Debug builds give the same result.

      From the code it seems that, for a row event, range_interval_set_count() in sql/sql_partition_auto_interval.cc finds the current date from the event time in the time zone of the replica applier thread. On the master, the same function used the time zone of the session that ran the INSERT.

      Attachments

        Issue Links

          Activity

            People

              ycp Yuchen Pei
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 1d 3h 34m Original Estimate - 1d 3h 34m
                  1d 3h 34m
                  Remaining:
                  Time Spent - 50m Remaining Estimate - 1d 3h 34m
                  1d 3h 34m
                  Logged:
                  Time Spent - 50m Remaining Estimate - 1d 3h 34m
                  50m

                  Git Integration

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