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

Assertion `marked_for_read()' failed in various places with long unique key

    XMLWordPrintable

Details

    Description

      Note: the problem only happens with a long unique key, so I assume it's related to MDEV-371.

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY, a VARCHAR(30000), UNIQUE (a)) ENGINE=InnoDB;
      INSERT INTO t1 (a) VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
      SELECT * FROM t1 WHERE a BETWEEN '1' AND '100';
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 eb872ceb

      mysqld: /data/src/10.4/sql/field.cc:7602: virtual String* Field_varstring::val_str(String*, String*): Assertion `marked_for_read()' failed.
      190409 23:39:30 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fd0f486cee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x000055bfb16c94d0 in Field_varstring::val_str (this=0x7fd0a000e170, val_buffer=0x7fd0a0016660, val_ptr=0x7fd0a0016360) at /data/src/10.4/sql/field.cc:7602
      #9  0x000055bfb170ed91 in Item_field::val_str (this=0x7fd0a0016330, str=0x7fd0a0016660) at /data/src/10.4/sql/item.cc:3135
      #10 0x000055bfb173518d in Item_func_between::val_int_cmp_string (this=0x7fd0a0016578) at /data/src/10.4/sql/item_cmpfunc.cc:2200
      #11 0x000055bfb15bd892 in Type_handler_string_result::Item_func_between_val_int (this=0x55bfb2a404a0 <type_handler_long_blob>, func=0x7fd0a0016578) at /data/src/10.4/sql/sql_type.cc:4940
      #12 0x000055bfb187c4f0 in Item_func_between::val_int (this=0x7fd0a0016578) at /data/src/10.4/sql/item_cmpfunc.h:907
      #13 0x000055bfb142d39e in evaluate_join_record (join=0x7fd0a0016fb8, join_tab=0x7fd0a0018e38, error=0) at /data/src/10.4/sql/sql_select.cc:20132
      #14 0x000055bfb142d16d in sub_select (join=0x7fd0a0016fb8, join_tab=0x7fd0a0018e38, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20076
      #15 0x000055bfb142c4ff in do_select (join=0x7fd0a0016fb8, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:19575
      #16 0x000055bfb1403119 in JOIN::exec_inner (this=0x7fd0a0016fb8) at /data/src/10.4/sql/sql_select.cc:4388
      #17 0x000055bfb14022c0 in JOIN::exec (this=0x7fd0a0016fb8) at /data/src/10.4/sql/sql_select.cc:4170
      #18 0x000055bfb1403972 in mysql_select (thd=0x7fd0a0000b00, tables=0x7fd0a0015c68, wild_num=1, fields=..., conds=0x7fd0a0016578, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fd0a0016f90, unit=0x7fd0a0004a30, select_lex=0x7fd0a00156a8) at /data/src/10.4/sql/sql_select.cc:4602
      #19 0x000055bfb13f3f06 in handle_select (thd=0x7fd0a0000b00, lex=0x7fd0a0004968, result=0x7fd0a0016f90, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:424
      #20 0x000055bfb13bd72d in execute_sqlcom_select (thd=0x7fd0a0000b00, all_tables=0x7fd0a0015c68) at /data/src/10.4/sql/sql_parse.cc:6602
      #21 0x000055bfb13b2d03 in mysql_execute_command (thd=0x7fd0a0000b00) at /data/src/10.4/sql/sql_parse.cc:3891
      #22 0x000055bfb13c14b3 in mysql_parse (thd=0x7fd0a0000b00, rawbuf=0x7fd0a00155e8 "SELECT * FROM t1 WHERE a BETWEEN '1' AND '100'", length=46, parser_state=0x7fd0edbe5180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8154
      #23 0x000055bfb13acf0a in dispatch_command (command=COM_QUERY, thd=0x7fd0a0000b00, packet=0x7fd0a013a2b1 "", packet_length=46, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1832
      #24 0x000055bfb13ab6f0 in do_command (thd=0x7fd0a0000b00) at /data/src/10.4/sql/sql_parse.cc:1365
      #25 0x000055bfb1523b15 in do_handle_one_connection (connect=0x55bfb5058330) at /data/src/10.4/sql/sql_connect.cc:1398
      #26 0x000055bfb1523886 in handle_one_connection (arg=0x55bfb5058330) at /data/src/10.4/sql/sql_connect.cc:1301
      #27 0x000055bfb1a0e5f5 in pfs_spawn_thread (arg=0x55bfb509e190) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #28 0x00007fd0f675b494 in start_thread (arg=0x7fd0edbe6700) at pthread_create.c:333
      #29 0x00007fd0f492993f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Not visible problem on a non-debug build.

      Variation (the difference is quoted vs unquoted values in the final BETWEEN clause):

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY, a VARCHAR(30000), UNIQUE (a)) ENGINE=InnoDB;
      INSERT INTO t1 (a) VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
      SELECT * FROM t1 WHERE a BETWEEN 1 AND 100;
       
      # Cleanup
      DROP TABLE t1;
      

      mysqld: /data/src/10.4/sql/field.cc:7579: virtual double Field_varstring::val_real(): Assertion `marked_for_read()' failed.
      190409 23:42:23 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f5275205ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x00005631cbf34304 in Field_varstring::val_real (this=0x7f522000e5d0) at /data/src/10.4/sql/field.cc:7579
      #9  0x00005631cbf79e3a in Item_field::val_real (this=0x7f5220016330) at /data/src/10.4/sql/item.cc:3144
      #10 0x00005631cbfa09cb in Item_func_between::val_int_cmp_real (this=0x7f5220016570) at /data/src/10.4/sql/item_cmpfunc.cc:2281
      #11 0x00005631cbe28928 in Type_handler_real_result::Item_func_between_val_int (this=0x5631cd2ab3e8 <type_handler_double>, func=0x7f5220016570) at /data/src/10.4/sql/sql_type.cc:4970
      #12 0x00005631cc0e74f0 in Item_func_between::val_int (this=0x7f5220016570) at /data/src/10.4/sql/item_cmpfunc.h:907
      #13 0x00005631cbc9839e in evaluate_join_record (join=0x7f5220016fb0, join_tab=0x7f5220018e30, error=0) at /data/src/10.4/sql/sql_select.cc:20132
      #14 0x00005631cbc9816d in sub_select (join=0x7f5220016fb0, join_tab=0x7f5220018e30, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20076
      #15 0x00005631cbc974ff in do_select (join=0x7f5220016fb0, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:19575
      #16 0x00005631cbc6e119 in JOIN::exec_inner (this=0x7f5220016fb0) at /data/src/10.4/sql/sql_select.cc:4388
      #17 0x00005631cbc6d2c0 in JOIN::exec (this=0x7f5220016fb0) at /data/src/10.4/sql/sql_select.cc:4170
      #18 0x00005631cbc6e972 in mysql_select (thd=0x7f5220000b00, tables=0x7f5220015c68, wild_num=1, fields=..., conds=0x7f5220016570, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f5220016f88, unit=0x7f5220004a30, select_lex=0x7f52200156a8) at /data/src/10.4/sql/sql_select.cc:4602
      #19 0x00005631cbc5ef06 in handle_select (thd=0x7f5220000b00, lex=0x7f5220004968, result=0x7f5220016f88, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:424
      #20 0x00005631cbc2872d in execute_sqlcom_select (thd=0x7f5220000b00, all_tables=0x7f5220015c68) at /data/src/10.4/sql/sql_parse.cc:6602
      #21 0x00005631cbc1dd03 in mysql_execute_command (thd=0x7f5220000b00) at /data/src/10.4/sql/sql_parse.cc:3891
      #22 0x00005631cbc2c4b3 in mysql_parse (thd=0x7f5220000b00, rawbuf=0x7f52200155e8 "SELECT * FROM t1 WHERE a BETWEEN 1 AND 100", length=42, parser_state=0x7f5270125180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8154
      #23 0x00005631cbc17f0a in dispatch_command (command=COM_QUERY, thd=0x7f5220000b00, packet=0x7f522013a2b1 "", packet_length=42, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1832
      #24 0x00005631cbc166f0 in do_command (thd=0x7f5220000b00) at /data/src/10.4/sql/sql_parse.cc:1365
      #25 0x00005631cbd8eb15 in do_handle_one_connection (connect=0x5631cee19330) at /data/src/10.4/sql/sql_connect.cc:1398
      #26 0x00005631cbd8e886 in handle_one_connection (arg=0x5631cee19330) at /data/src/10.4/sql/sql_connect.cc:1301
      #27 0x00005631cc2795f5 in pfs_spawn_thread (arg=0x5631cee5f190) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #28 0x00007f52770f4494 in start_thread (arg=0x7f5270126700) at pthread_create.c:333
      #29 0x00007f52752c293f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.