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

PITR - mariabackup not restored to specific point in time

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.6.20, 10.11.10, 11.4.4
    • None
    • Backup
    • None
    • Ubuntu 20, 22

    Description

      Steps to reproduce:

      1. Have database
      2. Create table t1
      3. Create mariabackup
      4. Create table t2
      5. Create table t3
      6. Restore using PITR to time between t2 and t3 was added (in my case time was '2024-11-15 11:28:23')

      Current result

      Database is restored and contains only t1

      Expected result

      Database contains table t1 and t2

      Additional info

      Content of binlog events:

      MariaDB [(none)]> SHOW BINLOG EVENTS IN 'binlog.000010';
      +---------------+------+-------------------+-----------+-------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | Log_name      | Pos  | Event_type        | Server_id | End_log_pos | Info                                                                                                                                                                          |
      +---------------+------+-------------------+-----------+-------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | binlog.000010 |    4 | Format_desc       |      1001 |         256 | Server ver: 11.4.4-MariaDB-ubu2204-log, Binlog ver: 4                                                                                                                         |
      | binlog.000010 |  256 | Gtid_list         |      1001 |         299 | [0-1001-60]                                                                                                                                                                   |
      | binlog.000010 |  299 | Binlog_checkpoint |      1001 |         339 | binlog.000010                                                                                                                                                                 |
      | binlog.000010 |  339 | Gtid              |      1001 |         381 | GTID 0-1001-61                                                                                                                                                                |
      | binlog.000010 |  381 | Query             |      1001 |         546 | use `information_schema`; ALTER USER 'backupuser'@'127.0.0.1' IDENTIFIED BY 'wN4.UyBKJR6%%,K70p5oK7zzmf3mmQS2'                                                                |
      | binlog.000010 |  546 | Gtid              |      1001 |         588 | GTID 0-1001-62                                                                                                                                                                |
      | binlog.000010 |  588 | Query             |      1001 |         836 | use `information_schema`; GRANT RELOAD,LOCK TABLES,REPLICATION CLIENT,EVENT,CREATE TABLESPACE,PROCESS,CREATE,INSERT,SELECT,SUPER,SHOW VIEW ON *.* TO 'backupuser'@'127.0.0.1' |
      | binlog.000010 |  836 | Gtid              |      1001 |         878 | GTID 0-1001-63                                                                                                                                                                |
      | binlog.000010 |  878 | Query             |      1001 |        1043 | use `information_schema`; ALTER USER 'backupuser'@'localhost' IDENTIFIED BY 'wN4.UyBKJR6%%,K70p5oK7zzmf3mmQS2'                                                                |
      | binlog.000010 | 1043 | Gtid              |      1001 |        1085 | GTID 0-1001-64                                                                                                                                                                |
      | binlog.000010 | 1085 | Query             |      1001 |        1333 | use `information_schema`; GRANT RELOAD,LOCK TABLES,REPLICATION CLIENT,EVENT,CREATE TABLESPACE,PROCESS,CREATE,INSERT,SELECT,SUPER,SHOW VIEW ON *.* TO 'backupuser'@'localhost' |
      | binlog.000010 | 1333 | Gtid              |      1001 |        1375 | GTID 0-1001-65                                                                                                                                                                |
      | binlog.000010 | 1375 | Query             |      1001 |        1540 | use `information_schema`; ALTER USER 'backupuser'@'127.0.0.1' IDENTIFIED BY 'wN4.UyBKJR6%%,K70p5oK7zzmf3mmQS2'                                                                |
      | binlog.000010 | 1540 | Gtid              |      1001 |        1582 | GTID 0-1001-66                                                                                                                                                                |
      | binlog.000010 | 1582 | Query             |      1001 |        1830 | use `information_schema`; GRANT RELOAD,LOCK TABLES,REPLICATION CLIENT,EVENT,CREATE TABLESPACE,PROCESS,CREATE,INSERT,SELECT,SUPER,SHOW VIEW ON *.* TO 'backupuser'@'127.0.0.1' |
      | binlog.000010 | 1830 | Gtid              |      1001 |        1872 | GTID 0-1001-67                                                                                                                                                                |
      | binlog.000010 | 1872 | Query             |      1001 |        2037 | use `information_schema`; ALTER USER 'backupuser'@'localhost' IDENTIFIED BY 'wN4.UyBKJR6%%,K70p5oK7zzmf3mmQS2'                                                                |
      | binlog.000010 | 2037 | Gtid              |      1001 |        2079 | GTID 0-1001-68                                                                                                                                                                |
      | binlog.000010 | 2079 | Query             |      1001 |        2327 | use `information_schema`; GRANT RELOAD,LOCK TABLES,REPLICATION CLIENT,EVENT,CREATE TABLESPACE,PROCESS,CREATE,INSERT,SELECT,SUPER,SHOW VIEW ON *.* TO 'backupuser'@'localhost' |
      | binlog.000010 | 2327 | Rotate            |      1001 |        2371 | binlog.000011;pos=4                                                                                                                                                           |
      +---------------+------+-------------------+-----------+-------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      20 rows in set (0.000 sec)
       
      MariaDB [(none)]> SHOW BINLOG EVENTS IN 'binlog.000011';
      +---------------+------+-------------------+-----------+-------------+-----------------------------------------------------------------+
      | Log_name      | Pos  | Event_type        | Server_id | End_log_pos | Info                                                            |
      +---------------+------+-------------------+-----------+-------------+-----------------------------------------------------------------+
      | binlog.000011 |    4 | Format_desc       |      1001 |         256 | Server ver: 11.4.4-MariaDB-ubu2204-log, Binlog ver: 4           |
      | binlog.000011 |  256 | Gtid_list         |      1001 |         299 | [0-1001-68]                                                     |
      | binlog.000011 |  299 | Binlog_checkpoint |      1001 |         339 | binlog.000010                                                   |
      | binlog.000011 |  339 | Binlog_checkpoint |      1001 |         379 | binlog.000011                                                   |
      | binlog.000011 |  379 | Gtid              |      1001 |         421 | GTID 0-1001-69                                                  |
      | binlog.000011 |  421 | Query             |      1001 |         548 | use `d1`; CREATE TABLE t2 (     ID INT,     Name VARCHAR(100) ) |
      | binlog.000011 |  548 | Gtid              |      1001 |         590 | BEGIN GTID 0-1001-70                                            |
      | binlog.000011 |  590 | Annotate_rows     |      1001 |           0 | INSERT INTO t2 (ID, Name) VALUES (2, 'bob')                     |
      | binlog.000011 |  656 | Table_map         |      1001 |           0 | table_id: 854 (d1.t2)                                           |
      | binlog.000011 |  702 | Write_rows_v1     |      1001 |           0 | table_id: 854 flags: STMT_END_F                                 |
      | binlog.000011 |  744 | Xid               |      1001 |         775 | COMMIT /* xid=38790 */                                          |
      | binlog.000011 |  775 | Gtid              |      1001 |         817 | GTID 0-1001-71                                                  |
      | binlog.000011 |  817 | Query             |      1001 |         944 | use `d1`; CREATE TABLE t3 (     ID INT,     Name VARCHAR(100) ) |
      | binlog.000011 |  944 | Gtid              |      1001 |         986 | BEGIN GTID 0-1001-72                                            |
      | binlog.000011 |  986 | Annotate_rows     |      1001 |           0 | INSERT INTO t3 (ID, Name) VALUES (2, 'bob')                     |
      | binlog.000011 | 1052 | Table_map         |      1001 |           0 | table_id: 858 (d1.t3)                                           |
      | binlog.000011 | 1098 | Write_rows_v1     |      1001 |           0 | table_id: 858 flags: STMT_END_F                                 |
      | binlog.000011 | 1140 | Xid               |      1001 |        1171 | COMMIT /* xid=39535 */                                          |
      | binlog.000011 | 1171 | Stop              |      1001 |        1194 |                                                                 |
      +---------------+------+-------------------+-----------+-------------+-----------------------------------------------------------------+
      19 rows in set (0.016 sec)
      

      Content of binlog info file:

      cat mariadb_backup_binlog_info
      binlog.000010	2327	0-1001-68
      

      Command used to restore:

      mariadb-binlog --stop-datetime='2024-11-15 11:28:23' --disable-log-bin --skip-gtid-strict-mode --start-position=0-1001-68 binlog.000010 binlog.000011
      

      Output:

      /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
      /*!40019 SET @@session.max_delayed_threads=0*/;
      /*!32316 SET @OLD_SQL_LOG_BIN=@@SQL_LOG_BIN, SQL_LOG_BIN=0*/;
      /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
      DELIMITER /*!*/;
      # at 4
      #241115 10:23:02 server id 1001  end_log_pos 256 CRC32 0xdc7c73f2 	Start: binlog v 4, server v 11.4.4-MariaDB-ubu2204-log created 241115 10:23:02 at startup
      ROLLBACK/*!*/;
      BINLOG '
      BiE3Zw/pAwAA/AAAAAABAAAAAAQAMTEuNC40LU1hcmlhREItdWJ1MjIwNC1sb2cAAAAAAAAAAAAA
      AAAAAAAAAAAAAAAAAAAGITdnEzgNAAgAEgAEBAQEEgAA5AAEGggAAAAICAgCAAAACgoKAAAAAAAA
      AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
      AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
      AAAAAAAAAAAEEwQADQgICAoKCgHyc3zc
      '/*!*/;
      # at 256
      #241115 10:23:02 server id 1001  end_log_pos 299 CRC32 0x63ead02b 	Gtid list [0-1001-60]
      # at 299
      #241115 10:23:02 server id 1001  end_log_pos 339 CRC32 0x1da7761d 	Binlog checkpoint binlog.000010
      WARNING: Did not reach stop datetime '2024-11-15 11:28:23' before end of input
      DELIMITER ;
      # End of log file
      ROLLBACK /* added by mysqlbinlog */;
      /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
      /*!32316 SET SQL_LOG_BIN=@OLD_SQL_LOG_BIN*/;
      /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
      /*!100001 SET @@SESSION.SERVER_ID=@@GLOBAL.SERVER_ID */;
      /*!100001 SET @@SESSION.GTID_DOMAIN_ID=@@GLOBAL.GTID_DOMAIN_ID */;
      WARNING: Binary logs never reached expected GTID state of 0-1001-68
      

      Before restore:

      MariaDB [d1]> show tables;
      +--------------+
      | Tables_in_d1 |
      +--------------+
      | t1           |
      | t2           |
      | t3           |
      +--------------+
      

      After restore:

      +--------------+
      | Tables_in_d1 |
      +--------------+
      | t1           |
      +--------------+
      

      Attachments

        Activity

          People

            susil.behera Susil Behera
            martin.strecansky Martin Strecansky
            Votes:
            0 Vote for this issue
            Watchers:
            4 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.