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

Assertion failure upon DELETE HISTORY or SELECT AS OF from precise-versioned table

    XMLWordPrintable

Details

    Description

      --source include/have_innodb.inc
       
      CREATE TABLE t (f INT, s BIGINT UNSIGNED GENERATED ALWAYS AS ROW START, e BIGINT UNSIGNED GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (s,e)) WITH SYSTEM VERSIONING ENGINE=InnoDB;
      INSERT INTO t (f) VALUES (1);
      DELETE HISTORY FROM t BEFORE SYSTEM_TIME 101;
       
      # Cleanup
      DROP TABLE t;
      

      10.5 2154a1fc

      mariadbd: /data/src/10.5/sql/sql_type.h:2305: bool Datetime::is_valid_datetime_slow() const: Assertion `time_type == MYSQL_TIMESTAMP_DATETIME' failed.
      221006 19:06:27 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f717bdc5662 in __GI___assert_fail (assertion=0x563adbc55a80 "time_type == MYSQL_TIMESTAMP_DATETIME", file=0x563adbc55860 "/data/src/10.5/sql/sql_type.h", line=2305, function=0x563adbc55ae0 "bool Datetime::is_valid_datetime_slow() const") at assert.c:101
      #8  0x0000563ad9ade865 in Datetime::is_valid_datetime_slow (this=0x7f716733cdc0) at /data/src/10.5/sql/sql_type.h:2305
      #9  0x0000563ad9f2b9de in Datetime::Datetime (this=0x7f716733cdc0, from=0x7f716733d8b0) at /data/src/10.5/sql/sql_type.h:2457
      #10 0x0000563ada118a89 in TR_table::query (this=0x7f716733d090, commit_time=..., backwards=true) at /data/src/10.5/sql/table.cc:9881
      #11 0x0000563ada3b4b55 in Item_func_trt_id::get_by_commit_ts (this=0x62b000085fd0, commit_ts=..., backwards=true) at /data/src/10.5/sql/item_vers.cc:136
      #12 0x0000563ada3b551b in Item_func_trt_id::val_int (this=0x62b000085fd0) at /data/src/10.5/sql/item_vers.cc:170
      #13 0x0000563ad9b645ac in Item::val_uint (this=0x62b000085fd0) at /data/src/10.5/sql/item.h:1294
      #14 0x0000563ada3b5b7a in Item_func_trt_trx_sees::val_int (this=0x62b000086180) at /data/src/10.5/sql/item_vers.cc:189
      #15 0x0000563ada3490e6 in Type_handler_int_result::Item_val_bool (this=0x563ade042560 <type_handler_bool>, item=0x62b000086180) at /data/src/10.5/sql/sql_type.cc:5082
      #16 0x0000563ad9ae0334 in Item::val_bool (this=0x62b000086180) at /data/src/10.5/sql/item.h:1489
      #17 0x0000563ada683960 in Item_cond_and::val_int (this=0x62b000086260) at /data/src/10.5/sql/item_cmpfunc.cc:5446
      #18 0x0000563ada0b64eb in SQL_SELECT::skip_record (this=0x62b0000863d0, thd=0x62b00007e218) at /data/src/10.5/sql/opt_range.h:1728
      #19 0x0000563adaa27e62 in record_should_be_deleted (thd=0x62b00007e218, table=0x6190000df298, sel=0x62b0000863d0, explain=0x62b0000865a8, truncate_history=true) at /data/src/10.5/sql/sql_delete.cc:220
      #20 0x0000563adaa2cfaa in mysql_delete (thd=0x62b00007e218, table_list=0x62b000085368, conds=0x62b000086260, order_list=0x62b000082ea0, limit=18446744073709551615, options=0, result=0x0) at /data/src/10.5/sql/sql_delete.cc:788
      #21 0x0000563ad9da660d in mysql_execute_command (thd=0x62b00007e218) at /data/src/10.5/sql/sql_parse.cc:4867
      #22 0x0000563ad9dbc202 in mysql_parse (thd=0x62b00007e218, rawbuf=0x62b000085238 "DELETE HISTORY FROM t BEFORE SYSTEM_TIME 101", length=44, parser_state=0x7f716733fc30, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:8087
      #23 0x0000563ad9d928cc in dispatch_command (command=COM_QUERY, thd=0x62b00007e218, packet=0x62900028a219 "DELETE HISTORY FROM t BEFORE SYSTEM_TIME 101", packet_length=44, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1891
      #24 0x0000563ad9d8f2e9 in do_command (thd=0x62b00007e218) at /data/src/10.5/sql/sql_parse.cc:1375
      #25 0x0000563ada1ca6c1 in do_handle_one_connection (connect=0x608000003238, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1416
      #26 0x0000563ada1ca05e in handle_one_connection (arg=0x6080000031b8) at /data/src/10.5/sql/sql_connect.cc:1318
      #27 0x0000563adadeef22 in pfs_spawn_thread (arg=0x61500000c898) at /data/src/10.5/storage/perfschema/pfs.cc:2201
      #28 0x00007f717c2a3ea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #29 0x00007f717be90aef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Reproducible on 10.5+, including older minor releases.
      No obvious immediate failure on a non-debug build.

      The failure appeared in 10.5 after this merge:

      commit 97a4a3872e5037b8db1e8c27152740190330ab9c (HEAD)
      Merge: 8f8f2aea938 1e08e08ccb8
      Author: Marko Mäkelä
      Date:   Wed Aug 26 12:02:07 2020 +0300
       
          Merge 10.4 into 10.5
      

      Since it's not reproducible on 10.4, I can't point at the exact commit. However, there was a fix of the same assertion failure on a different scenario in that merge (MDEV-23562), so I suppose it may be related.

      Same assertion fails with SELECT ... AS OF

      --source include/have_innodb.inc
       
       
      CREATE TABLE t (f INT, s BIGINT UNSIGNED GENERATED ALWAYS AS ROW START, e BIGINT UNSIGNED GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (s,e)) WITH SYSTEM VERSIONING ENGINE=InnoDB;
      INSERT INTO t (f) VALUES (1);
      SELECT * FROM t FOR SYSTEM_TIME AS OF 101;
       
      # Cleanup
       
      DROP TABLE t;
      

      10.4 produces ER_VERS_NO_TRX_ID instead.

      Attachments

        Issue Links

          Activity

            People

              midenok Aleksey Midenkov
              elenst Elena Stepanova
              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.