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

Assertion `table->no_keyread || !table->covering_keys.is_set(tab->index) || table->file->keyread == tab->index' failed in join_read_first after upgrade from 10.1

Details

    Description

      10.5 debug 6be56dd1

      mysqld: /data/src/10.5/sql/sql_select.cc:21601: int join_read_first(JOIN_TAB*): Assertion `table->no_keyread || !table->covering_keys.is_set(tab->index) || table->file->keyread == tab->index' failed.
      200330  2:53:04 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f7ee5c84f12 in __GI___assert_fail (assertion=0x55d1672aea60 "table->no_keyread || !table->covering_keys.is_set(tab->index) || table->file->keyread == tab->index", file=0x55d1672ac238 "/data/src/10.5/sql/sql_select.cc", line=21601, function=0x55d1672b2450 <join_read_first(st_join_table*)::__PRETTY_FUNCTION__> "int join_read_first(JOIN_TAB*)") at assert.c:101
      #8  0x000055d166577843 in join_read_first (tab=0x7f7ea00152e8) at /data/src/10.5/sql/sql_select.cc:21599
      #9  0x000055d166575062 in sub_select (join=0x7f7ea0013e50, join_tab=0x7f7ea00152e8, end_of_records=false) at /data/src/10.5/sql/sql_select.cc:20597
      #10 0x000055d166574523 in do_select (join=0x7f7ea0013e50, procedure=0x0) at /data/src/10.5/sql/sql_select.cc:20134
      #11 0x000055d166548399 in JOIN::exec_inner (this=0x7f7ea0013e50) at /data/src/10.5/sql/sql_select.cc:4459
      #12 0x000055d1665474c5 in JOIN::exec (this=0x7f7ea0013e50) at /data/src/10.5/sql/sql_select.cc:4240
      #13 0x000055d166548bf6 in mysql_select (thd=0x7f7ea0000b18, tables=0x7f7ea0012be8, fields=..., conds=0x0, og_num=1, order=0x7f7ea0013c48, group=0x0, having=0x0, proc_param=0x0, select_options=2147748609, result=0x7f7ea0013e28, unit=0x7f7ea0004b20, select_lex=0x7f7ea00125e0) at /data/src/10.5/sql/sql_select.cc:4664
      #14 0x000055d166538766 in handle_select (thd=0x7f7ea0000b18, lex=0x7f7ea0004a58, result=0x7f7ea0013e28, setup_tables_done_option=0) at /data/src/10.5/sql/sql_select.cc:429
      #15 0x000055d1664fd992 in execute_sqlcom_select (thd=0x7f7ea0000b18, all_tables=0x7f7ea0012be8) at /data/src/10.5/sql/sql_parse.cc:6168
      #16 0x000055d1664f444c in mysql_execute_command (thd=0x7f7ea0000b18) at /data/src/10.5/sql/sql_parse.cc:3901
      #17 0x000055d1665028cc in mysql_parse (thd=0x7f7ea0000b18, rawbuf=0x7f7ea0012510 "SELECT DISTINCT col_char FROM t1 ORDER BY col_varchar", length=53, parser_state=0x7f7ee4201520, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:7953
      #18 0x000055d1664ee11d in dispatch_command (command=COM_QUERY, thd=0x7f7ea0000b18, packet=0x7f7ea0008579 "", packet_length=53, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1840
      #19 0x000055d1664ec853 in do_command (thd=0x7f7ea0000b18) at /data/src/10.5/sql/sql_parse.cc:1359
      #20 0x000055d16668efc5 in do_handle_one_connection (connect=0x55d169f1ce78, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1422
      #21 0x000055d16668ecf4 in handle_one_connection (arg=0x55d169f1ce78) at /data/src/10.5/sql/sql_connect.cc:1319
      #22 0x000055d166bc2950 in pfs_spawn_thread (arg=0x55d169f41328) at /data/src/10.5/storage/perfschema/pfs.cc:2201
      #23 0x00007f7ee7c0d4a4 in start_thread (arg=0x7f7ee4202700) at pthread_create.c:456
      #24 0x00007f7ee5d41d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      To reproduce from scratch:

      • start 10.1 server with --innodb-page-size=32K, other options can be left default;
      • run on 10.1 server

        DROP TABLE IF EXISTS t1;
         
        CREATE TABLE t1 (
          `col_char` binary(2),
          `id` int,
          `col_blob` mediumblob,
          `col_varchar` varbinary(130),
          PRIMARY KEY (`col_varchar`,`col_char`,`id`),
          KEY `id` (`id`)
        ) ENGINE=InnoDB;
         
        INSERT INTO t1 VALUES (NULL,1,NULL,''),(NULL,2,NULL,'');
        

      • shut down the server normally;
      • start 10.5 debug server on the same datadir, with --innodb-page-size=32K, otherwise defaults;
      • (optionally, it does not change the outcome) run mysql_upgrade;
      • run on 10.5 server

        SELECT DISTINCT col_char FROM test.t1 ORDER BY col_varchar;
        

      Alternatively, a datadir pre-created on 10.1 server as described above is attached. Unpack, start 10.5 debug server on it with innodb-page-size=32K and run the SELECT above.

      No crash on a non-debug build, but possibly there can be side-effects later.

      The failure appeared in 10.5 branch after this commit:

      commit eb483c5181ab430877c135c16224284cfc517b3d
      Author: Monty <monty@mariadb.org>
      Date:   Fri Feb 28 12:59:30 2020 +0200
       
          Updated optimizer costs in multi_range_read_info_const() and sql_select.cc
      

      Attachments

        1. data.tar.gz
          1.29 MB
          Elena Stepanova

        Issue Links

          Activity

            I have a bug fix. Will push it together with other fixes in a few days

            monty Michael Widenius added a comment - I have a bug fix. Will push it together with other fixes in a few days
            alice Alice Sherepa added a comment -

            seems to be the same bug. fails with Innodb/MyIsam:

            CREATE TABLE t1 (i1 int, id int, c1 int, b1 bit(34), a1 binary(99), d1 int,
              key  (d1,b1,a1(64),c1),
              key  (i1,c1,id,b1,d1));
             
            insert into t1 values (0,null,null,'\0\0\0\0',null,0),(0,null,null,'\0\0\0\0',null,0);
             
            select distinct c1 from t1 where b1 between 1 and 5 order by d1;
            

            #5  0x00007f03604de535 in __GI_abort () at abort.c:79
            #6  0x00007f03604de40f in __assert_fail_base (fmt=0x7f0360640ee0 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x555b60ee66b0 "table->no_keyread || !table->covering_keys.is_set(tab->index) || table->file->keyread == tab->index", file=0x555b60ee3e78 "/10.5/sql/sql_select.cc", line=21604, function=<optimized out>) at assert.c:92
            #7  0x00007f03604ec102 in __GI___assert_fail (assertion=0x555b60ee66b0 "table->no_keyread || !table->covering_keys.is_set(tab->index) || table->file->keyread == tab->index", file=0x555b60ee3e78 "/10.5/sql/sql_select.cc", line=21604, function=0x555b60eea070 <join_read_first(st_join_table*)::__PRETTY_FUNCTION__> "int join_read_first(JOIN_TAB*)") at assert.c:101
            #8  0x0000555b601cde59 in join_read_first (tab=0x7f03400168c8) at /10.5/sql/sql_select.cc:21602
            #9  0x0000555b601cb65f in sub_select (join=0x7f0340015430, join_tab=0x7f03400168c8, end_of_records=false) at /10.5/sql/sql_select.cc:20600
            #10 0x0000555b601cab20 in do_select (join=0x7f0340015430, procedure=0x0) at /10.5/sql/sql_select.cc:20137
            #11 0x0000555b6019ef17 in JOIN::exec_inner (this=0x7f0340015430) at /10.5/sql/sql_select.cc:4463
            #12 0x0000555b6019e043 in JOIN::exec (this=0x7f0340015430) at /10.5/sql/sql_select.cc:4244
            #13 0x0000555b6019f764 in mysql_select (thd=0x7f0340000d78, tables=0x7f0340014240, fields=..., conds=0x0, og_num=1, order=0x7f0340015298, group=0x0, having=0x0, proc_param=0x0, select_options=2147748609, result=0x7f0340015408, unit=0x7f0340004d80, select_lex=0x7f0340013c40) at /10.5/sql/sql_select.cc:4668
            #14 0x0000555b6018f42a in handle_select (thd=0x7f0340000d78, lex=0x7f0340004cb8, result=0x7f0340015408, setup_tables_done_option=0) at /10.5/sql/sql_select.cc:417
            #15 0x0000555b60154c83 in execute_sqlcom_select (thd=0x7f0340000d78, all_tables=0x7f0340014240) at /10.5/sql/sql_parse.cc:6168
            #16 0x0000555b6014b7c2 in mysql_execute_command (thd=0x7f0340000d78) at /10.5/sql/sql_parse.cc:3901
            #17 0x0000555b60159bb2 in mysql_parse (thd=0x7f0340000d78, rawbuf=0x7f0340013b90 "select distinct c1 from t1 order by d1", length=38, parser_state=0x7f0356e7d510, is_com_multi=false, is_next_command=false) at /10.5/sql/sql_parse.cc:7953
            #18 0x0000555b60145546 in dispatch_command (command=COM_QUERY, thd=0x7f0340000d78, packet=0x7f0340008d09 "", packet_length=38, is_com_multi=false, is_next_command=false) at /10.5/sql/sql_parse.cc:1839
            #19 0x0000555b60143c84 in do_command (thd=0x7f0340000d78) at /10.5/sql/sql_parse.cc:1358
            #20 0x0000555b602e54f2 in do_handle_one_connection (connect=0x555b63b2d778, put_in_cache=true) at /10.5/sql/sql_connect.cc:1422
            #21 0x0000555b602e5222 in handle_one_connection (arg=0x555b63a4cc18) at /10.5/sql/sql_connect.cc:1319
            #22 0x0000555b60814181 in pfs_spawn_thread (arg=0x555b63b2d3b8) at /10.5/storage/perfschema/pfs.cc:2201
            #23 0x00007f0360f84fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
            #24 0x00007f03605b54cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
            

            alice Alice Sherepa added a comment - seems to be the same bug. fails with Innodb/MyIsam: CREATE TABLE t1 (i1 int , id int , c1 int , b1 bit (34), a1 binary (99), d1 int , key (d1,b1,a1(64),c1), key (i1,c1,id,b1,d1));   insert into t1 values (0, null , null , '\0\0\0\0' , null ,0),(0, null , null , '\0\0\0\0' , null ,0);   select distinct c1 from t1 where b1 between 1 and 5 order by d1; #5 0x00007f03604de535 in __GI_abort () at abort.c:79 #6 0x00007f03604de40f in __assert_fail_base (fmt=0x7f0360640ee0 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x555b60ee66b0 "table->no_keyread || !table->covering_keys.is_set(tab->index) || table->file->keyread == tab->index", file=0x555b60ee3e78 "/10.5/sql/sql_select.cc", line=21604, function=<optimized out>) at assert.c:92 #7 0x00007f03604ec102 in __GI___assert_fail (assertion=0x555b60ee66b0 "table->no_keyread || !table->covering_keys.is_set(tab->index) || table->file->keyread == tab->index", file=0x555b60ee3e78 "/10.5/sql/sql_select.cc", line=21604, function=0x555b60eea070 <join_read_first(st_join_table*)::__PRETTY_FUNCTION__> "int join_read_first(JOIN_TAB*)") at assert.c:101 #8 0x0000555b601cde59 in join_read_first (tab=0x7f03400168c8) at /10.5/sql/sql_select.cc:21602 #9 0x0000555b601cb65f in sub_select (join=0x7f0340015430, join_tab=0x7f03400168c8, end_of_records=false) at /10.5/sql/sql_select.cc:20600 #10 0x0000555b601cab20 in do_select (join=0x7f0340015430, procedure=0x0) at /10.5/sql/sql_select.cc:20137 #11 0x0000555b6019ef17 in JOIN::exec_inner (this=0x7f0340015430) at /10.5/sql/sql_select.cc:4463 #12 0x0000555b6019e043 in JOIN::exec (this=0x7f0340015430) at /10.5/sql/sql_select.cc:4244 #13 0x0000555b6019f764 in mysql_select (thd=0x7f0340000d78, tables=0x7f0340014240, fields=..., conds=0x0, og_num=1, order=0x7f0340015298, group=0x0, having=0x0, proc_param=0x0, select_options=2147748609, result=0x7f0340015408, unit=0x7f0340004d80, select_lex=0x7f0340013c40) at /10.5/sql/sql_select.cc:4668 #14 0x0000555b6018f42a in handle_select (thd=0x7f0340000d78, lex=0x7f0340004cb8, result=0x7f0340015408, setup_tables_done_option=0) at /10.5/sql/sql_select.cc:417 #15 0x0000555b60154c83 in execute_sqlcom_select (thd=0x7f0340000d78, all_tables=0x7f0340014240) at /10.5/sql/sql_parse.cc:6168 #16 0x0000555b6014b7c2 in mysql_execute_command (thd=0x7f0340000d78) at /10.5/sql/sql_parse.cc:3901 #17 0x0000555b60159bb2 in mysql_parse (thd=0x7f0340000d78, rawbuf=0x7f0340013b90 "select distinct c1 from t1 order by d1", length=38, parser_state=0x7f0356e7d510, is_com_multi=false, is_next_command=false) at /10.5/sql/sql_parse.cc:7953 #18 0x0000555b60145546 in dispatch_command (command=COM_QUERY, thd=0x7f0340000d78, packet=0x7f0340008d09 "", packet_length=38, is_com_multi=false, is_next_command=false) at /10.5/sql/sql_parse.cc:1839 #19 0x0000555b60143c84 in do_command (thd=0x7f0340000d78) at /10.5/sql/sql_parse.cc:1358 #20 0x0000555b602e54f2 in do_handle_one_connection (connect=0x555b63b2d778, put_in_cache=true) at /10.5/sql/sql_connect.cc:1422 #21 0x0000555b602e5222 in handle_one_connection (arg=0x555b63a4cc18) at /10.5/sql/sql_connect.cc:1319 #22 0x0000555b60814181 in pfs_spawn_thread (arg=0x555b63b2d3b8) at /10.5/storage/perfschema/pfs.cc:2201 #23 0x00007f0360f84fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486 #24 0x00007f03605b54cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

            Pushed into 10.5

            monty Michael Widenius added a comment - Pushed into 10.5

            People

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