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

mariadb-binlog SIGABRT when reading temporal datatype with --flashback

    XMLWordPrintable

Details

    Description

      Temporal datatypes - TIMESTAMP2, DATETTIME2,TIME2 are still affected with --flashback even after fix of MDEV-20749

      *!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
      /*!40019 SET @@session.max_delayed_threads=0*/;
      /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
      DELIMITER /*!*/;
      #260709 10:47:51 server id 1  end_log_pos 257 CRC32 0xfc496ccf 	Start: binlog v 4, server v 13.1.0-MariaDB-debug-log created 260709 10:47:51 at startup
      ROLLBACK/*!*/;
      BINLOG '
      /y5Pag8BAAAA/QAAAAEBAAAAAAQAMTMuMS4wLU1hcmlhREItZGVidWctbG9nAAAAAAAAAAAAAAAA
      AAAAAAAAAAAAAAAAAAD/Lk9qEzgNAAgAEgAEBAQEEgAA5QAEGggAAAAICAgCAAAACgoKAAAAAAAA
      CgoKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
      AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
      AAAAAAAAAAAEEwQADQgICAoKCgkBz2xJ/A==
      '/*!*/;
      #260709 10:47:51 server id 1  end_log_pos 286 CRC32 0xbf8c32fb 	Gtid list []
      #260709 10:47:51 server id 1  end_log_pos 330 CRC32 0x6c442e8c 	Binlog checkpoint master-bin.000001
      #260709 10:48:46 server id 1  end_log_pos 0 CRC32 0x300180fd 	Annotate_rows:
      #Q> insert into t1 values (1, '10:20:30')
      #260709 10:48:46 server id 1  end_log_pos 0 CRC32 0x16cd491a 	Table_map: `test`.`t1` mapped to number 18
      mariadb-binlog: /home/deepthi/repo/pr-4767-src/sql/compat56.cc:101: uint my_time_binary_length(uint): Assertion `dec <= 6' failed.
      Aborted (core dumped)
      
      

      The issue can be reproduced with the help of debug point (similar to the one added for blob datatype at MDEV-20749)

      diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc
      index 31e5018bdf8..5e9e2c1b190 100644
      --- a/sql/log_event_server.cc
      +++ b/sql/log_event_server.cc
      @@ -6874,6 +6874,19 @@ bool Table_map_log_event::write_data_body(Log_event_writer *writer)
             m_field_metadata[0]= 5;
           }
         });
      +  DBUG_EXECUTE_IF("flashback_corrupt_temporal_metadata", {
      +    if (m_dbnam && m_tblnam && m_dblen == 4 &&
      +        memcmp(m_dbnam, "test", 4) == 0 && m_tbllen == 2 &&
      +        memcmp(m_tblnam, "t1", 2) == 0 && m_colcnt == 2 &&
      +        m_field_metadata_size >= 1 &&
      +        (m_coltype[1] == MYSQL_TYPE_TIME2 ||
      +         m_coltype[1] == MYSQL_TYPE_DATETIME2 ||
      +         m_coltype[1] == MYSQL_TYPE_TIMESTAMP2))
      +    {
      +      /* Illegal fractional-seconds precision (valid range is 0..6). */
      +      m_field_metadata[0]= 0xFF;
      +    }
      +  });
       #endif
       
         return write_data(writer, dbuf, sizeof(dbuf)) ||
      
      

      MTR Test to verify the issue exists :

      # (TIME/DATETIME/TIMESTAMP) field metadata.
      #
      # These types store a fractional-seconds precision (fsp, valid 0..6) as their
      # table-map field metadata. The DBUG hook flashback_corrupt_temporal_metadata
      # rewrites that byte to 0xFF (illegal), mimicking a corrupt/foreign binlog.
       
      --source include/have_innodb.inc
      --source include/have_binlog_format_row.inc
      --source include/have_debug.inc
       
      # mariadb-binlog aborts (SIGABRT) => process exit status 128 + 6.
      --let $ABORT_STATUS= 134
       
      # TIME (my_time_binary_length)
      create table t1 (a int, b time(0)) engine=innodb;
      set @old_dbug= @@debug_dbug;
      set debug_dbug= "+d,flashback_corrupt_temporal_metadata";
      insert into t1 values (1, '10:20:30');
      set debug_dbug= @old_dbug;
      --let $MYSQLD_DATADIR= `select @@datadir`
      --let $BINLOG_FILE= query_get_value(SHOW MASTER STATUS, File, 1)
      flush binary logs;
      --error $ABORT_STATUS
      --exec $MYSQL_BINLOG -vvv --flashback $MYSQLD_DATADIR/$BINLOG_FILE >/dev/null 2>&1
      DROP TABLE t1;
       
      # DATETIME (my_datetime_binary_length)
      create table t1 (a int, b datetime(0)) engine=innodb;
      set @old_dbug= @@debug_dbug;
      set debug_dbug= "+d,flashback_corrupt_temporal_metadata";
      insert into t1 values (1, '2020-01-01 10:20:30');
      set debug_dbug= @old_dbug;
      --let $MYSQLD_DATADIR= `select @@datadir`
      --let $BINLOG_FILE= query_get_value(SHOW MASTER STATUS, File, 1)
      flush binary logs;
      --error $ABORT_STATUS
      --exec $MYSQL_BINLOG -vvv --flashback $MYSQLD_DATADIR/$BINLOG_FILE >/dev/null 2>&1
      DROP TABLE t1;
       
      # TIMESTAMP (my_timestamp_binary_length)
      create table t1 (a int, b timestamp(0)) engine=innodb;
      set @old_dbug= @@debug_dbug;
      set debug_dbug= "+d,flashback_corrupt_temporal_metadata";
      insert into t1 values (1, '2020-01-01 10:20:30');
      set debug_dbug= @old_dbug;
      --let $MYSQLD_DATADIR= `select @@datadir`
      --let $BINLOG_FILE= query_get_value(SHOW MASTER STATUS, File, 1)
      flush binary logs;
      --error $ABORT_STATUS
      --exec $MYSQL_BINLOG -vvv --flashback $MYSQLD_DATADIR/$BINLOG_FILE >/dev/null 2>&1
      DROP TABLE t1;
      
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Deepthi ES Deepthi Eranti Sreenivas
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.