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

SIGSEGV or assertion failures in rec_get_status upon ALTER TABLE

    XMLWordPrintable

Details

    Description

      Test cases differ only in the datatype of the column a – BIGINT vs INT.

      Test case 1

      --source include/have_innodb.inc
      --source include/have_sequence.inc
       
      CREATE TABLE t1 (
        id INT,
        a INT,
        b CHAR(60),
        PRIMARY KEY (id)
      ) ENGINE=InnoDB;
       
      INSERT INTO t1 SELECT seq, seq%21500, seq%4300 FROM seq_1_to_43000;
      --error ER_DUP_ENTRY
      ALTER TABLE t1 ADD UNIQUE (a, b);
       
      # Cleanup
      DROP TABLE t1;
      

      Test case 2

      --source include/have_innodb.inc
      --source include/have_sequence.inc
       
      CREATE TABLE t1 (
        id INT,
        a BIGINT,
        b CHAR(60),
        PRIMARY KEY (id)
      ) ENGINE=InnoDB;
       
      INSERT INTO t1 SELECT seq, seq%21500, seq%4300 FROM seq_1_to_43000;
      --error ER_DUP_ENTRY
      ALTER TABLE t1 ADD UNIQUE (a, b);
       
      # Cleanup
      DROP TABLE t1;
      

      10.3 1656ea28 with test case 1

      #3  <signal handler called>
      #4  0x0000558b9bf0ef5b in rec_get_status (rec=0x7fcce04f9002 "\200") at /data/src/10.3/storage/innobase/include/rem0rec.h:338
      #5  0x0000558b9bffa279 in rec_offs_validate (rec=0x7fcce04f9002 "\200", index=0x7fcc94035d20, offsets=0x7fcc940d7450) at /data/src/10.3/storage/innobase/rem/rem0rec.cc:518
      #6  0x0000558b9bf0f638 in rec_get_nth_cfield (rec=0x7fcce04f9002 "\200", index=0x7fcc94035d20, offsets=0x7fcc940d7450, n=2, len=0x7fcce9486d48) at /data/src/10.3/storage/innobase/include/rem0rec.h:832
      #7  0x0000558b9bef28db in innobase_rec_to_mysql (table=0x7fcc94091290, rec=0x7fcce04f9002 "\200", index=0x7fcc94035d20, offsets=0x7fcc940d7450) at /data/src/10.3/storage/innobase/handler/handler0alter.cc:2286
      #8  0x0000558b9bff2d9d in cmp_rec_rec_simple (rec1=0x7fcce04f9002 "\200", rec2=0x7fcce05f9048 "\200", offsets1=0x7fcc940d7450, offsets2=0x7fcc94093a10, index=0x7fcc94035d20, table=0x7fcc94091290) at /data/src/10.3/storage/innobase/rem/rem0cmp.cc:1074
      #9  0x0000558b9c04123a in row_merge_blocks (dup=0x7fcce94873f0, file=0x7fcc94157fe0, block=0x7fcce04f9000 "\002", foffs0=0x7fcce94870f0, foffs1=0x7fcce94870f8, of=0x7fcce9487110, stage=0x7fcc9412da60, crypt_block=0x0, space=5) at /data/src/10.3/storage/innobase/row/row0merge.cc:3012
      #10 0x0000558b9c042229 in row_merge (trx=0x7fcce9f7f0f0, dup=0x7fcce94873f0, file=0x7fcc94157fe0, block=0x7fcce04f9000 "\002", tmpfd=0x7fcce94873c0, num_run=0x7fcce94871b0, run_offset=0x7fcc940712d0, stage=0x7fcc9412da60, crypt_block=0x0, space=5) at /data/src/10.3/storage/innobase/row/row0merge.cc:3211
      #11 0x0000558b9c04294f in row_merge_sort (trx=0x7fcce9f7f0f0, dup=0x7fcce94873f0, file=0x7fcc94157fe0, block=0x7fcce04f9000 "\002", tmpfd=0x7fcce94873c0, update_progress=true, pct_progress=50, pct_cost=20, crypt_block=0x0, space=5, stage=0x7fcc9412da60) at /data/src/10.3/storage/innobase/row/row0merge.cc:3377
      #12 0x0000558b9c0475da in row_merge_build_indexes (trx=0x7fcce9f7f0f0, old_table=0x7fcc9400b140, new_table=0x7fcc9400b140, online=true, indexes=0x7fcc94093168, key_numbers=0x7fcc94093170, n_indexes=1, table=0x7fcc94091290, defaults=0x0, col_map=0x0, add_autoinc=18446744073709551615, sequence=..., skip_pk_sort=false, stage=0x7fcc9412da60, add_v=0x0, eval_table=0x7fcc94091290, allow_not_null=false) at /data/src/10.3/storage/innobase/row/row0merge.cc:4851
      #13 0x0000558b9bf054ac in ha_innobase::inplace_alter_table (this=0x7fcc9400a608, altered_table=0x7fcc94091290, ha_alter_info=0x7fcce94881c0) at /data/src/10.3/storage/innobase/handler/handler0alter.cc:7151
      #14 0x0000558b9ba5aa69 in handler::ha_inplace_alter_table (this=0x7fcc9400a608, altered_table=0x7fcc94091290, ha_alter_info=0x7fcce94881c0) at /data/src/10.3/sql/handler.h:4207
      #15 0x0000558b9ba4f108 in mysql_inplace_alter_table (thd=0x7fcc94000af0, table_list=0x7fcc94012908, table=0x7fcc940a2470, altered_table=0x7fcc94091290, ha_alter_info=0x7fcce94881c0, inplace_supported=HA_ALTER_INPLACE_NOCOPY_NO_LOCK, target_mdl_request=0x7fcce9488340, alter_ctx=0x7fcce94888f0) at /data/src/10.3/sql/sql_table.cc:7654
      #16 0x0000558b9ba55b6e in mysql_alter_table (thd=0x7fcc94000af0, new_db=0x7fcc940051d8, new_name=0x7fcc940055a0, create_info=0x7fcce94894e0, table_list=0x7fcc94012908, alter_info=0x7fcce9489420, order_num=0, order=0x0, ignore=false) at /data/src/10.3/sql/sql_table.cc:9946
      #17 0x0000558b9bae4694 in Sql_cmd_alter_table::execute (this=0x7fcc94013060, thd=0x7fcc94000af0) at /data/src/10.3/sql/sql_alter.cc:512
      #18 0x0000558b9b9747ac in mysql_execute_command (thd=0x7fcc94000af0) at /data/src/10.3/sql/sql_parse.cc:6022
      #19 0x0000558b9b979f61 in mysql_parse (thd=0x7fcc94000af0, rawbuf=0x7fcc94012818 "ALTER TABLE t1 ADD UNIQUE (a, b)", length=32, parser_state=0x7fcce948a5e0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7810
      #20 0x0000558b9b9667a8 in dispatch_command (command=COM_QUERY, thd=0x7fcc94000af0, packet=0x7fcc941656d1 "", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1848
      #21 0x0000558b9b9650c0 in do_command (thd=0x7fcc94000af0) at /data/src/10.3/sql/sql_parse.cc:1393
      #22 0x0000558b9bade693 in do_handle_one_connection (connect=0x558b9ebe94b0) at /data/src/10.3/sql/sql_connect.cc:1403
      #23 0x0000558b9bade3f5 in handle_one_connection (arg=0x558b9ebe94b0) at /data/src/10.3/sql/sql_connect.cc:1308
      #24 0x0000558b9c4962f2 in pfs_spawn_thread (arg=0x558b9ec04560) at /data/src/10.3/storage/perfschema/pfs.cc:1869
      #25 0x00007fccf20714a4 in start_thread (arg=0x7fcce948b700) at pthread_create.c:456
      #26 0x00007fccf01a5d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      10.3 1656ea28 with test case 2

      mysqld: /data/src/10.3/storage/innobase/include/rem0rec.h:339: rec_comp_status_t rec_get_status(const rec_t*): Assertion `bits <= REC_STATUS_COLUMNS_ADDED' failed.
      200730  1:55:14 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fb314688f12 in __GI___assert_fail (assertion=0x555e6103e208 "bits <= REC_STATUS_COLUMNS_ADDED", file=0x555e6103e230 "/data/src/10.3/storage/innobase/include/rem0rec.h", line=339, function=0x555e61044ee0 <rec_get_status(unsigned char const*)::__PRETTY_FUNCTION__> "rec_comp_status_t rec_get_status(const rec_t*)") at assert.c:101
      #8  0x0000555e60789fd2 in rec_get_status (rec=0x7fb30436f89e "\200") at /data/src/10.3/storage/innobase/include/rem0rec.h:339
      #9  0x0000555e60875279 in rec_offs_validate (rec=0x7fb30436f89e "\200", index=0x7fb2bc035d20, offsets=0x7fb2bc0d7450) at /data/src/10.3/storage/innobase/rem/rem0rec.cc:518
      #10 0x0000555e6078a638 in rec_get_nth_cfield (rec=0x7fb30436f89e "\200", index=0x7fb2bc035d20, offsets=0x7fb2bc0d7450, n=2, len=0x7fb30da26d48) at /data/src/10.3/storage/innobase/include/rem0rec.h:832
      #11 0x0000555e6076d8db in innobase_rec_to_mysql (table=0x7fb2bc091290, rec=0x7fb30436f89e "\200", index=0x7fb2bc035d20, offsets=0x7fb2bc0d7450) at /data/src/10.3/storage/innobase/handler/handler0alter.cc:2286
      #12 0x0000555e6086dd9d in cmp_rec_rec_simple (rec1=0x7fb30436f89e "\200", rec2=0x7fb3043f4002 "\200", offsets1=0x7fb2bc0d7450, offsets2=0x7fb2bc0939a0, index=0x7fb2bc035d20, table=0x7fb2bc091290) at /data/src/10.3/storage/innobase/rem/rem0cmp.cc:1074
      #13 0x0000555e608bc23a in row_merge_blocks (dup=0x7fb30da273f0, file=0x7fb2bc157fe0, block=0x7fb3042f4000 "\002", foffs0=0x7fb30da270f0, foffs1=0x7fb30da270f8, of=0x7fb30da27110, stage=0x7fb2bc0112d0, crypt_block=0x0, space=5) at /data/src/10.3/storage/innobase/row/row0merge.cc:3012
      #14 0x0000555e608bd229 in row_merge (trx=0x7fb30e51f0f0, dup=0x7fb30da273f0, file=0x7fb2bc157fe0, block=0x7fb3042f4000 "\002", tmpfd=0x7fb30da273c0, num_run=0x7fb30da271b0, run_offset=0x7fb2bc17b420, stage=0x7fb2bc0112d0, crypt_block=0x0, space=5) at /data/src/10.3/storage/innobase/row/row0merge.cc:3211
      #15 0x0000555e608bd94f in row_merge_sort (trx=0x7fb30e51f0f0, dup=0x7fb30da273f0, file=0x7fb2bc157fe0, block=0x7fb3042f4000 "\002", tmpfd=0x7fb30da273c0, update_progress=true, pct_progress=50, pct_cost=20, crypt_block=0x0, space=5, stage=0x7fb2bc0112d0) at /data/src/10.3/storage/innobase/row/row0merge.cc:3377
      #16 0x0000555e608c25da in row_merge_build_indexes (trx=0x7fb30e51f0f0, old_table=0x7fb2bc00b140, new_table=0x7fb2bc00b140, online=true, indexes=0x7fb2bc093168, key_numbers=0x7fb2bc093170, n_indexes=1, table=0x7fb2bc091290, defaults=0x0, col_map=0x0, add_autoinc=18446744073709551615, sequence=..., skip_pk_sort=false, stage=0x7fb2bc0112d0, add_v=0x0, eval_table=0x7fb2bc091290, allow_not_null=false) at /data/src/10.3/storage/innobase/row/row0merge.cc:4851
      #17 0x0000555e607804ac in ha_innobase::inplace_alter_table (this=0x7fb2bc00a608, altered_table=0x7fb2bc091290, ha_alter_info=0x7fb30da281c0) at /data/src/10.3/storage/innobase/handler/handler0alter.cc:7151
      #18 0x0000555e602d5a69 in handler::ha_inplace_alter_table (this=0x7fb2bc00a608, altered_table=0x7fb2bc091290, ha_alter_info=0x7fb30da281c0) at /data/src/10.3/sql/handler.h:4207
      #19 0x0000555e602ca108 in mysql_inplace_alter_table (thd=0x7fb2bc000af0, table_list=0x7fb2bc012908, table=0x7fb2bc0a2470, altered_table=0x7fb2bc091290, ha_alter_info=0x7fb30da281c0, inplace_supported=HA_ALTER_INPLACE_NOCOPY_NO_LOCK, target_mdl_request=0x7fb30da28340, alter_ctx=0x7fb30da288f0) at /data/src/10.3/sql/sql_table.cc:7654
      #20 0x0000555e602d0b6e in mysql_alter_table (thd=0x7fb2bc000af0, new_db=0x7fb2bc0051d8, new_name=0x7fb2bc0055a0, create_info=0x7fb30da294e0, table_list=0x7fb2bc012908, alter_info=0x7fb30da29420, order_num=0, order=0x0, ignore=false) at /data/src/10.3/sql/sql_table.cc:9946
      #21 0x0000555e6035f694 in Sql_cmd_alter_table::execute (this=0x7fb2bc013060, thd=0x7fb2bc000af0) at /data/src/10.3/sql/sql_alter.cc:512
      #22 0x0000555e601ef7ac in mysql_execute_command (thd=0x7fb2bc000af0) at /data/src/10.3/sql/sql_parse.cc:6022
      #23 0x0000555e601f4f61 in mysql_parse (thd=0x7fb2bc000af0, rawbuf=0x7fb2bc012818 "ALTER TABLE t1 ADD UNIQUE (a, b)", length=32, parser_state=0x7fb30da2a5e0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7810
      #24 0x0000555e601e17a8 in dispatch_command (command=COM_QUERY, thd=0x7fb2bc000af0, packet=0x7fb2bc1656d1 "", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1848
      #25 0x0000555e601e00c0 in do_command (thd=0x7fb2bc000af0) at /data/src/10.3/sql/sql_parse.cc:1393
      #26 0x0000555e60359693 in do_handle_one_connection (connect=0x555e62afd4b0) at /data/src/10.3/sql/sql_connect.cc:1403
      #27 0x0000555e603593f5 in handle_one_connection (arg=0x555e62afd4b0) at /data/src/10.3/sql/sql_connect.cc:1308
      #28 0x0000555e60d112f2 in pfs_spawn_thread (arg=0x555e62b18560) at /data/src/10.3/storage/perfschema/pfs.cc:1869
      #29 0x00007fb3166114a4 in start_thread (arg=0x7fb30da2b700) at pthread_create.c:456
      #30 0x00007fb314745d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      10.4 423de1e5 with test case 2

      mysqld: /data/src/10.4/storage/innobase/include/rem0rec.h:310: rec_comp_status_t rec_get_status(const rec_t*): Assertion `bits <= REC_STATUS_INSTANT' failed.
      200730  1:56:16 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f15b4d08f12 in __GI___assert_fail (assertion=0x55820c12971c "bits <= REC_STATUS_INSTANT", file=0x55820c129738 "/data/src/10.4/storage/innobase/include/rem0rec.h", line=310, function=0x55820c131e60 <rec_get_status(unsigned char const*)::__PRETTY_FUNCTION__> "rec_comp_status_t rec_get_status(const rec_t*)") at assert.c:101
      #8  0x000055820b80b7af in rec_get_status (rec=0x7f15a81e589e "\200") at /data/src/10.4/storage/innobase/include/rem0rec.h:310
      #9  0x000055820b90077c in rec_offs_validate (rec=0x7f15a81e589e "\200", index=0x7f155c0725a0, offsets=0x7f155c1f1ba0) at /data/src/10.4/storage/innobase/rem/rem0rec.cc:533
      #10 0x000055820b80bfd5 in rec_get_nth_cfield (rec=0x7f15a81e589e "\200", index=0x7f155c0725a0, offsets=0x7f155c1f1ba0, n=2, len=0x7f15aa06b878) at /data/src/10.4/storage/innobase/include/rem0rec.h:890
      #11 0x000055820b7ecb63 in innobase_rec_to_mysql (table=0x7f15aa06cdf0, rec=0x7f15a81e589e "\200", index=0x7f155c0725a0, offsets=0x7f155c1f1ba0) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:3318
      #12 0x000055820b8fac9e in cmp_rec_rec_simple (rec1=0x7f15a81e589e "\200", rec2=0x7f15a826a002 "\200", offsets1=0x7f155c1f1ba0, offsets2=0x7f155c0703a0, index=0x7f155c0725a0, table=0x7f15aa06cdf0) at /data/src/10.4/storage/innobase/rem/rem0cmp.cc:1074
      #13 0x000055820b94a631 in row_merge_blocks (dup=0x7f15aa06bf20, file=0x7f155c0bbf30, block=0x7f15a816a000 "\002", foffs0=0x7f15aa06bc20, foffs1=0x7f15aa06bc28, of=0x7f15aa06bc40, stage=0x7f155c0adf90, crypt_block=0x0, space=5) at /data/src/10.4/storage/innobase/row/row0merge.cc:3011
      #14 0x000055820b94b620 in row_merge (trx=0x7f15aaa73140, dup=0x7f15aa06bf20, file=0x7f155c0bbf30, block=0x7f15a816a000 "\002", tmpfd=0x7f15aa06bef0, num_run=0x7f15aa06bce0, run_offset=0x7f155c0bbdb0, stage=0x7f155c0adf90, crypt_block=0x0, space=5) at /data/src/10.4/storage/innobase/row/row0merge.cc:3212
      #15 0x000055820b94bd45 in row_merge_sort (trx=0x7f15aaa73140, dup=0x7f15aa06bf20, file=0x7f155c0bbf30, block=0x7f15a816a000 "\002", tmpfd=0x7f15aa06bef0, update_progress=true, pct_progress=50, pct_cost=20, crypt_block=0x0, space=5, stage=0x7f155c0adf90) at /data/src/10.4/storage/innobase/row/row0merge.cc:3378
      #16 0x000055820b95062c in row_merge_build_indexes (trx=0x7f15aaa73140, old_table=0x7f155c1a07f0, new_table=0x7f155c1a07f0, online=true, indexes=0x7f155c06f968, key_numbers=0x7f155c06f970, n_indexes=1, table=0x7f15aa06cdf0, defaults=0x0, col_map=0x0, add_autoinc=18446744073709551615, sequence=..., skip_pk_sort=false, stage=0x7f155c0adf90, add_v=0x0, eval_table=0x7f15aa06cdf0, allow_not_null=false) at /data/src/10.4/storage/innobase/row/row0merge.cc:4851
      #17 0x000055820b7ff908 in ha_innobase::inplace_alter_table (this=0x7f155c19fd88, altered_table=0x7f15aa06cdf0, ha_alter_info=0x7f15aa06cd50) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:8487
      #18 0x000055820b30382d in handler::ha_inplace_alter_table (this=0x7f155c19fd88, altered_table=0x7f15aa06cdf0, ha_alter_info=0x7f15aa06cd50) at /data/src/10.4/sql/handler.h:4369
      #19 0x000055820b2f78ee in mysql_inplace_alter_table (thd=0x7f155c000af0, table_list=0x7f155c013288, table=0x7f155c19ef20, altered_table=0x7f15aa06cdf0, ha_alter_info=0x7f15aa06cd50, target_mdl_request=0x7f15aa06dbc0, alter_ctx=0x7f15aa06e700) at /data/src/10.4/sql/sql_table.cc:7746
      #20 0x000055820b2fe806 in mysql_alter_table (thd=0x7f155c000af0, new_db=0x7f155c0052b0, new_name=0x7f155c0056b8, create_info=0x7f15aa06f2f0, table_list=0x7f155c013288, alter_info=0x7f15aa06f230, order_num=0, order=0x0, ignore=false) at /data/src/10.4/sql/sql_table.cc:10156
      #21 0x000055820b396b31 in Sql_cmd_alter_table::execute (this=0x7f155c013a48, thd=0x7f155c000af0) at /data/src/10.4/sql/sql_alter.cc:520
      #22 0x000055820b214122 in mysql_execute_command (thd=0x7f155c000af0) at /data/src/10.4/sql/sql_parse.cc:6098
      #23 0x000055820b219613 in mysql_parse (thd=0x7f155c000af0, rawbuf=0x7f155c013198 "ALTER TABLE t1 ADD UNIQUE (a, b)", length=32, parser_state=0x7f15aa070570, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7896
      #24 0x000055820b205b48 in dispatch_command (command=COM_QUERY, thd=0x7f155c000af0, packet=0x7f155c0083a1 "", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1835
      #25 0x000055820b2042ea in do_command (thd=0x7f155c000af0) at /data/src/10.4/sql/sql_parse.cc:1353
      #26 0x000055820b38d544 in do_handle_one_connection (connect=0x55820eeebb70) at /data/src/10.4/sql/sql_connect.cc:1412
      #27 0x000055820b38d293 in handle_one_connection (arg=0x55820eeebb70) at /data/src/10.4/sql/sql_connect.cc:1316
      #28 0x000055820bd8e50d in pfs_spawn_thread (arg=0x55820ee0e530) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #29 0x00007f15b6c914a4 in start_thread (arg=0x7f15aa071700) at pthread_create.c:456
      #30 0x00007f15b4dc5d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Not reproducible on 10.2.
      Non-debug builds don't crash, at least on my machine.

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              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.