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

Server crash on DELETE with YEAR field with truncated expr

    XMLWordPrintable

Details

    Description

      Actual description

      Changing support_virtual_index to 1 in mysql-test/suite/gcol/t/gcol_ins_upd_innodb.test leads to a server crash.

      The root cause test is following:

      DROP TABLE IF EXISTS t;
      CREATE TABLE t (
        a INT,
        b YEAR GENERATED ALWAYS AS ('a') VIRTUAL,
        c YEAR GENERATED ALWAYS AS ('aaaa') VIRTUAL,
        b1 YEAR GENERATED ALWAYS AS ('a') STORED,
        c1 YEAR GENERATED ALWAYS AS ('aaaa') STORED,
        UNIQUE(b),
        UNIQUE(b1)
      ) ENGINE=InnoDB;
      INSERT IGNORE INTO t VALUES();
      SELECT b from t;
      SELECT b1 from t;
      SELECT * from t;
      DELETE FROM t;
      

      Stack trace:

      #0  0x00007ffff76f357f in raise () from /lib64/libc.so.6
      #1  0x00007ffff76dd895 in abort () from /lib64/libc.so.6
      #2  0x00007ffff76dd769 in __assert_fail_base.cold.0 () from /lib64/libc.so.6
      #3  0x00007ffff76eba26 in __assert_fail () from /lib64/libc.so.6
      #4  0x0000000000eff8b8 in row_upd_sec_index_entry (node=0x7fff680704d8, thr=0x7fff68074f88)
          at /home/bar/maria-git/server.10.4/storage/innobase/row/row0upd.cc:2429
      #5  0x0000000000efff2a in row_upd_sec_step (node=0x7fff680704d8, thr=0x7fff68074f88)
          at /home/bar/maria-git/server.10.4/storage/innobase/row/row0upd.cc:2543
      #6  0x0000000000f02642 in row_upd (node=0x7fff680704d8, thr=0x7fff68074f88)
          at /home/bar/maria-git/server.10.4/storage/innobase/row/row0upd.cc:3319
      #7  0x0000000000f029a9 in row_upd_step (thr=0x7fff68074f88)
          at /home/bar/maria-git/server.10.4/storage/innobase/row/row0upd.cc:3434
      #8  0x0000000000eb6458 in row_update_for_mysql (prebuilt=0x7fff6806f918)
          at /home/bar/maria-git/server.10.4/storage/innobase/row/row0mysql.cc:1889
      #9  0x0000000000d60bd8 in ha_innobase::delete_row (this=0x7fff680659f8, 
          record=0x7fff6806e970 <incomplete sequence \313>)
          at /home/bar/maria-git/server.10.4/storage/innobase/handler/ha_innodb.cc:8970
      #10 0x0000000000b4bfb2 in handler::ha_delete_row (this=0x7fff680659f8, 
          buf=0x7fff6806e970 <incomplete sequence \313>)
          at /home/bar/maria-git/server.10.4/sql/handler.cc:6790
      #11 0x0000000000ce6581 in TABLE::delete_row (this=0x7fff68064b90)
          at /home/bar/maria-git/server.10.4/sql/sql_delete.cc:297
      #12 0x0000000000ce3603 in mysql_delete (thd=0x7fff68000d60, table_list=0x7fff68014230, 
          conds=0x0, order_list=0x7fff68005710, limit=18446744073709551615, options=0, 
          result=0x0) at /home/bar/maria-git/server.10.4/sql/sql_delete.cc:834
      #13 0x00000000008220ad in mysql_execute_command (thd=0x7fff68000d60)
          at /home/bar/maria-git/server.10.4/sql/sql_parse.cc:4727
      #14 0x000000000082cd07 in mysql_parse (thd=0x7fff68000d60, 
          rawbuf=0x7fff68014168 "DELETE FROM t", length=13, parser_state=0x7ffff41d7000, 
          is_com_multi=false, is_next_command=false)
          at /home/bar/maria-git/server.10.4/sql/sql_parse.cc:7908
      

      Original description

      Note: MDEV-14134 is marked as a duplicate of MDEV-15114 and the latter is closed, so I'm filing a new one.

      --source include/have_innodb.inc
       
      CREATE TABLE t1 ( 
        pk BIGINT AUTO_INCREMENT,
        b BIT(15),
        v BIT(10) AS (b) VIRTUAL,
        PRIMARY KEY(pk),
        UNIQUE(v)
      ) ENGINE=InnoDB;
       
      INSERT IGNORE INTO t1 (b) VALUES (b'101110001110100'),(b'011101');
      SELECT pk, b FROM t1 INTO OUTFILE 'load.data';
      LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1 (pk, b);
       
      # Cleanup
      DROP TABLE t1;
      --let $datadir= `SELECT @@datadir`
      --remove_file $datadir/test/load.data
      

      10.2 f2c7972a debug

      2018-12-03 18:50:43 140185924466432 [ERROR] InnoDB: Record in index `v` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 2 fields): {NULL,[8]        (0x8000000000000001)} at: COMPACT RECORD(info_bits=0, 1 fields): {[8]infimum (0x696E66696D756D00)}
      mysqld: /data/src/10.2/storage/innobase/row/row0upd.cc:2436: dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*): Assertion `0' failed.
      181203 18:50:43 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f583467aee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x0000562b2a093991 in row_upd_sec_index_entry (node=0x7f57c406cbc0, thr=0x7f57c408fd38) at /data/src/10.2/storage/innobase/row/row0upd.cc:2436
      #9  0x0000562b2a094007 in row_upd_sec_step (node=0x7f57c406cbc0, thr=0x7f57c408fd38) at /data/src/10.2/storage/innobase/row/row0upd.cc:2549
      #10 0x0000562b2a096288 in row_upd (node=0x7f57c406cbc0, thr=0x7f57c408fd38) at /data/src/10.2/storage/innobase/row/row0upd.cc:3308
      #11 0x0000562b2a0965d9 in row_upd_step (thr=0x7f57c408fd38) at /data/src/10.2/storage/innobase/row/row0upd.cc:3425
      #12 0x0000562b2a03cc7d in row_update_for_mysql (prebuilt=0x7f57c406c068) at /data/src/10.2/storage/innobase/row/row0mysql.cc:1830
      #13 0x0000562b29f030c1 in ha_innobase::delete_row (this=0x7f57c4009d28, record=0x7f57c400b750 "\241\001") at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:9098
      #14 0x0000562b29bf711a in handler::ha_delete_row (this=0x7f57c4009d28, buf=0x7f57c400b750 "\241\001") at /data/src/10.2/sql/handler.cc:6021
      #15 0x0000562b2994c547 in write_record (thd=0x7f57c4000b00, table=0x7f57c4009120, info=0x7f582c2e4040) at /data/src/10.2/sql/sql_insert.cc:1893
      #16 0x0000562b29d91a8c in read_sep_field (thd=0x7f57c4000b00, info=..., table_list=0x7f57c40125d0, fields_vars=..., set_fields=..., set_values=..., read_info=..., enclosed=..., skip_lines=0, ignore_check_option_errors=false) at /data/src/10.2/sql/sql_load.cc:1256
      #17 0x0000562b29d8fc24 in mysql_load (thd=0x7f57c4000b00, ex=0x7f57c4012548, table_list=0x7f57c40125d0, fields_vars=..., set_fields=..., set_values=..., handle_duplicates=DUP_REPLACE, ignore=false, read_file_from_client=false) at /data/src/10.2/sql/sql_load.cc:649
      #18 0x0000562b2997345c in mysql_execute_command (thd=0x7f57c4000b00) at /data/src/10.2/sql/sql_parse.cc:4834
      #19 0x0000562b2997d1bd in mysql_parse (thd=0x7f57c4000b00, rawbuf=0x7f57c4012448 "LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1 (pk, b)", length=58, parser_state=0x7f582c2e5200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:8013
      #20 0x0000562b2996aaf5 in dispatch_command (command=COM_QUERY, thd=0x7f57c4000b00, packet=0x7f57c4095ec1 "LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1 (pk, b)", packet_length=58, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1824
      #21 0x0000562b29969458 in do_command (thd=0x7f57c4000b00) at /data/src/10.2/sql/sql_parse.cc:1378
      #22 0x0000562b29abbbc9 in do_handle_one_connection (connect=0x562b2c34e0c0) at /data/src/10.2/sql/sql_connect.cc:1335
      #23 0x0000562b29abb956 in handle_one_connection (arg=0x562b2c34e0c0) at /data/src/10.2/sql/sql_connect.cc:1241
      #24 0x0000562b29ee15ee in pfs_spawn_thread (arg=0x562b2c299570) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #25 0x00007f5836136494 in start_thread (arg=0x7f582c2e6700) at pthread_create.c:333
      #26 0x00007f583473793f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      10.2 f2c7972a non-debug

      2018-12-03 18:54:20 140039024932608 [ERROR] InnoDB: Record in index `v` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 2 fields): {NULL,[8]        (0x8000000000000001)} at: COMPACT RECORD(info_bits=0, 1 fields): {[8]infimum (0x696E66696D756D00)}
      181203 18:54:20 [ERROR] mysqld got signal 11 ;
       
      #2  <signal handler called>
      #3  row_upd_build_difference_binary (index=0x7f5cfc0b9180, entry=entry@entry=0x7f5cfc0bd390, rec=<optimized out>, offsets=<optimized out>, offsets@entry=0x0, no_sys=no_sys@entry=true, trx=<optimized out>, heap=0x7f5cfc0b7b20, mysql_table=0x7f5cfc0bbc98) at /data/src/10.2/storage/innobase/row/row0upd.cc:1165
      #4  0x000056283a9293d3 in row_ins_clust_index_entry_by_modify (mtr=0x7f5d6055b130, thr=<optimized out>, entry=0x7f5cfc0bd390, heap=0x7f5cfc0b7b20, offsets_heap=0x7f5d6055a5d0, offsets=0x7f5d6055a5d8, mode=2, flags=0, pcur=0x7f5d6055a630) at /data/src/10.2/storage/innobase/row/row0ins.cc:352
      #5  row_ins_clust_index_entry_low (flags=<optimized out>, mode=2, index=0x7f5cfc0b9180, n_uniq=<optimized out>, entry=<optimized out>, n_ext=<optimized out>, thr=0x7f5cfc0b6868, dup_chk_only=false) at /data/src/10.2/storage/innobase/row/row0ins.cc:2650
      #6  0x000056283a92a02b in row_ins_clust_index_entry (index=0x7f5cfc0b9180, entry=0x7f5cfc0bd390, thr=0x7f5cfc0b6868, n_ext=0, dup_chk_only=2, dup_chk_only@entry=false) at /data/src/10.2/storage/innobase/row/row0ins.cc:3170
      #7  0x000056283a92a731 in row_ins_index_entry (thr=0x7f5cfc0b6868, entry=<optimized out>, index=0x7f5cfc0b9180) at /data/src/10.2/storage/innobase/row/row0ins.cc:3292
      #8  row_ins_index_entry_step (thr=0x7f5cfc0b6868, node=<optimized out>) at /data/src/10.2/storage/innobase/row/row0ins.cc:3442
      #9  row_ins (thr=<optimized out>, node=<optimized out>) at /data/src/10.2/storage/innobase/row/row0ins.cc:3585
      #10 row_ins_step (thr=thr@entry=0x7f5cfc0b6868) at /data/src/10.2/storage/innobase/row/row0ins.cc:3811
      #11 0x000056283a939468 in row_insert_for_mysql (mysql_rec=mysql_rec@entry=0x7f5cfc0b9998 "\371\001", prebuilt=0x7f5cfc0b6070) at /data/src/10.2/storage/innobase/row/row0mysql.cc:1413
      #12 0x000056283a889061 in ha_innobase::write_row (this=0x7f5cfc0bc830, record=0x7f5cfc0b9998 "\371\001") at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:8224
      #13 0x000056283a66957a in handler::ha_write_row (this=0x7f5cfc0bc830, buf=0x7f5cfc0b9998 "\371\001") at /data/src/10.2/sql/handler.cc:5961
      #14 0x000056283a4af694 in write_record (thd=thd@entry=0x7f5cfc0009a8, table=table@entry=0x7f5cfc0bbc98, info=info@entry=0x7f5d6055c630) at /data/src/10.2/sql/sql_insert.cc:1655
      #15 0x000056283a794ec4 in read_sep_field (ignore_check_option_errors=<optimized out>, skip_lines=<optimized out>, enclosed=..., read_info=..., set_values=..., set_fields=..., fields_vars=..., table_list=0x7f5cfc00f218, info=..., thd=0x7f5cfc0009a8) at /data/src/10.2/sql/sql_load.cc:1256
      #16 mysql_load (thd=<optimized out>, ex=<optimized out>, table_list=0x7f5cfc00f218, fields_vars=..., set_fields=..., set_values=..., handle_duplicates=DUP_REPLACE, ignore=<optimized out>, read_file_from_client=false) at /data/src/10.2/sql/sql_load.cc:649
      #17 0x000056283a4ce991 in mysql_execute_command (thd=0x7f5cfc0009a8) at /data/src/10.2/sql/sql_parse.cc:4834
      #18 0x000056283a4d230a in mysql_parse (thd=0x7f5cfc0009a8, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/src/10.2/sql/sql_parse.cc:8013
      #19 0x000056283a4d5e84 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f5cfc0009a8, packet=packet@entry=0x7f5cfc006ce9 "LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1 (pk, b)", packet_length=packet_length@entry=58, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.2/sql/sql_parse.cc:1824
      #20 0x000056283a4d68b9 in do_command (thd=0x7f5cfc0009a8) at /data/src/10.2/sql/sql_parse.cc:1378
      #21 0x000056283a59f7c4 in do_handle_one_connection (connect=connect@entry=0x56283d977798) at /data/src/10.2/sql/sql_connect.cc:1335
      #22 0x000056283a59f964 in handle_one_connection (arg=arg@entry=0x56283d977798) at /data/src/10.2/sql/sql_connect.cc:1241
      #23 0x000056283a8638a4 in pfs_spawn_thread (arg=0x56283d93a078) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #24 0x00007f5d71bc6494 in start_thread (arg=0x7f5d6055f700) at pthread_create.c:333
      #25 0x00007f5d701c793f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Attachments

        Issue Links

          Activity

            People

              nikitamalyavin Nikita Malyavin
              elenst Elena Stepanova
              Votes:
              1 Vote for this issue
              Watchers:
              9 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.