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

Assertion in compare_record upon multi-update involving versioned table via view

    XMLWordPrintable

Details

    Description

      Assertion `records_are_comparable(table)' failed in compare_record upon multi-update involving versioned table via view

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (a INT, PRIMARY KEY (a)) ENGINE=InnoDB;
      INSERT INTO t1 VALUES(0),(1);
       
      CREATE TABLE t2 (pk INT, b INT, PRIMARY KEY (pk), KEY(b)) ENGINE=InnoDB WITH SYSTEM VERSIONING;
      INSERT INTO t2 VALUES (1,0),(2,0);
       
      CREATE ALGORITHM = MERGE VIEW v AS SELECT a, b FROM t1, t2;
      UPDATE v SET b = NULL WHERE a <=> 0 ORDER BY b LIMIT 4;
       
      # Cleanup
      DROP VIEW v;
      DROP TABLE t1, t2;
      

      10.3 debug b633b6a9

      mysqld: /data/src/10.3/sql/sql_update.cc:70: bool compare_record(const TABLE*): Assertion `records_are_comparable(table)' failed.
      200622  1:37:02 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f1135f90f12 in __GI___assert_fail (assertion=0x5599c9202d30 "records_are_comparable(table)", file=0x5599c9202d50 "/data/src/10.3/sql/sql_update.cc", line=70, function=0x5599c92033c0 <compare_record(TABLE const*)::__PRETTY_FUNCTION__> "bool compare_record(const TABLE*)") at assert.c:101
      #8  0x00005599c867db2d in compare_record (table=0x7f10dc08dc80) at /data/src/10.3/sql/sql_update.cc:70
      #9  0x00005599c86866ae in multi_update::do_updates (this=0x7f10dc017d10) at /data/src/10.3/sql/sql_update.cc:2715
      #10 0x00005599c8686d7e in multi_update::send_eof (this=0x7f10dc017d10) at /data/src/10.3/sql/sql_update.cc:2841
      #11 0x00005599c85f386c in do_select (join=0x7f10dc017de8, procedure=0x0) at /data/src/10.3/sql/sql_select.cc:19291
      #12 0x00005599c85ca531 in JOIN::exec_inner (this=0x7f10dc017de8) at /data/src/10.3/sql/sql_select.cc:4116
      #13 0x00005599c85c9904 in JOIN::exec (this=0x7f10dc017de8) at /data/src/10.3/sql/sql_select.cc:3910
      #14 0x00005599c85cac15 in mysql_select (thd=0x7f10dc000af0, tables=0x7f10dc012930, wild_num=0, fields=..., conds=0x7f10dc013310, og_num=1, order=0x7f10dc013588, group=0x0, having=0x0, proc_param=0x0, select_options=1342177408, result=0x7f10dc017d10, unit=0x7f10dc0049b8, select_lex=0x7f10dc005140) at /data/src/10.3/sql/sql_select.cc:4315
      #15 0x00005599c8683192 in mysql_multi_update (thd=0x7f10dc000af0, table_list=0x7f10dc012930, fields=0x7f10dc005268, values=0x7f10dc005770, conds=0x7f10dc013310, options=0, handle_duplicates=DUP_ERROR, ignore=false, unit=0x7f10dc0049b8, select_lex=0x7f10dc005140, result=0x7f112b30afd0) at /data/src/10.3/sql/sql_update.cc:1799
      #16 0x00005599c857bf4a in mysql_execute_command (thd=0x7f10dc000af0) at /data/src/10.3/sql/sql_parse.cc:4369
      #17 0x00005599c8587e89 in mysql_parse (thd=0x7f10dc000af0, rawbuf=0x7f10dc012818 "UPDATE v SET b = NULL WHERE a <=> 0 ORDER BY b LIMIT 4", length=54, parser_state=0x7f112b30b5e0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7818
      #18 0x00005599c85746d1 in dispatch_command (command=COM_QUERY, thd=0x7f10dc000af0, packet=0x7f10dc165771 "UPDATE v SET b = NULL WHERE a <=> 0 ORDER BY b LIMIT 4", packet_length=54, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1856
      #19 0x00005599c8572fe9 in do_command (thd=0x7f10dc000af0) at /data/src/10.3/sql/sql_parse.cc:1401
      #20 0x00005599c86ec289 in do_handle_one_connection (connect=0x5599cb848020) at /data/src/10.3/sql/sql_connect.cc:1403
      #21 0x00005599c86ebfeb in handle_one_connection (arg=0x5599cb848020) at /data/src/10.3/sql/sql_connect.cc:1308
      #22 0x00005599c90a2b52 in pfs_spawn_thread (arg=0x5599cb862fd0) at /data/src/10.3/storage/perfschema/pfs.cc:1869
      #23 0x00007f1137f194a4 in start_thread (arg=0x7f112b30c700) at pthread_create.c:456
      #24 0x00007f113604dd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible with InnoDB, not with MyISAM.
      Reproducible on 10.3-10.4, couldn't reproduce on the current 10.5.
      Non-debug builds don't crash. All of them return the warning

      UPDATE v SET b = NULL WHERE a <=> 0 ORDER BY b LIMIT 4;
      Warnings:
      Note	1355	View being updated does not have complete key of underlying table in it
      

      I'm not sure whether the warning is expected, but it happens on all versions, regardless system versioning or the engine.

      Attachments

        Activity

          People

            midenok Aleksey Midenkov
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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