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

LP:665057 - sql_select.cc:13863: int join_read_key2(THD*, JOIN_TAB*, TABLE*, TABLE_REF*): Assertion `table_ref->has_record' failed in maria-5.3-mwl128

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      The following query, when run with the default join_cache_level:

      SELECT STRAIGHT_JOIN table1 .`col_int_key`
      FROM R table1 LEFT JOIN C table2 JOIN Q table3 ON table2 .`col_int_key` = table3 .`pk` ON table1 .`col_varchar_1024_utf8_key` = table3 .`col_varchar_1024_latin1_key` RIGHT JOIN BB table4 RIGHT JOIN V LEFT JOIN X table6 RIGHT JOIN M table7 JOIN Q table8 ON table8 .`col_int` ON table8 .`col_int` ON table7 .`col_varchar_10_utf8` JOIN I table9 ON table9 .`col_varchar_10_utf8_key` ON table4 .`col_varchar_1024_latin1_key` = table9 .`col_varchar_1024_utf8_key` ON table1 .`col_varchar_1024_utf8` = table6 .`col_varchar_1024_latin1`
      WHERE table8 .`col_int_key` ;

      asserts in maria-5.3-maria-5.3-mwl128 with the following backtrace. No Valgrind warnings. 5.3 is not affected.

      mysqld: sql_select.cc:13863: int join_read_key2(THD*, JOIN_TAB*, TABLE*, TABLE_REF*): Assertion `table_ref->has_record' failed.

      #8 0x00133d98 in __assert_fail () from /lib/libc.so.6
      #9 0x08321651 in join_read_key2 (thd=0xb087118, tab=0xb1ded1c, table=0xb109be8, table_ref=0xb1dee60) at sql_select.cc:13863
      #10 0x0832146d in join_read_key (tab=0xb1ded1c) at sql_select.cc:13814
      #11 0x08320256 in sub_select (join=0xb1d8cc8, join_tab=0xb1ded1c, end_of_records=false) at sql_select.cc:13292
      #12 0x08320902 in evaluate_join_record (join=0xb1d8cc8, join_tab=0xb1deb48, error=0) at sql_select.cc:13487
      #13 0x083202a9 in sub_select (join=0xb1d8cc8, join_tab=0xb1deb48, end_of_records=false) at sql_select.cc:13295
      #14 0x08320902 in evaluate_join_record (join=0xb1d8cc8, join_tab=0xb1de974, error=0) at sql_select.cc:13487
      #15 0x083203f7 in sub_select (join=0xb1d8cc8, join_tab=0xb1de974, end_of_records=false) at sql_select.cc:13335
      #16 0x08320902 in evaluate_join_record (join=0xb1d8cc8, join_tab=0xb1de7a0, error=0) at sql_select.cc:13487
      #17 0x083203f7 in sub_select (join=0xb1d8cc8, join_tab=0xb1de7a0, end_of_records=false) at sql_select.cc:13335
      #18 0x0831f6ca in do_select (join=0xb1d8cc8, fields=0xb088b24, table=0x0, procedure=0x0) at sql_select.cc:12839
      #19 0x083056cb in JOIN::exec (this=0xb1d8cc8) at sql_select.cc:2412
      #20 0x08305df4 in mysql_select (thd=0xb087118, rref_pointer_array=0xb088b94, tables=0xb0d8928, wild_num=0, fields=..., conds=0xb1ca118, og_num=0, order=0x0,
      group=0x0, having=0x0, proc_param=0x0, select_options=2147764738, result=0xb1d6d08, unit=0xb0887f8, select_lex=0xb088a90) at sql_select.cc:2613
      #21 0x082fe4af in handle_select (thd=0xb087118, lex=0xb08879c, result=0xb1d6d08, setup_tables_done_option=0) at sql_select.cc:277
      #22 0x0829b6d4 in execute_sqlcom_select (thd=0xb087118, all_tables=0xb0d8928) at sql_parse.cc:5081
      #23 0x082920b4 in mysql_execute_command (thd=0xb087118) at sql_parse.cc:2265
      #24 0x0829d8b5 in mysql_parse (thd=0xb087118,
      inBuf=0xb0d82e8 "SELECT STRAIGHT_JOIN table1 .`col_int_key`\nFROM R table1 LEFT JOIN C table2 JOIN Q table3 ON table2 .`col_int_key` = table3 .`pk` ON table1 .`col_varchar_1024_utf8_key` = table3 .`col_varchar_"..., length=625, found_semicolon=0xa6e71230) at sql_parse.cc:6027
      #25 0x0828fae6 in dispatch_command (command=COM_QUERY, thd=0xb087118, packet=0xb09f151 "", packet_length=628) at sql_parse.cc:1184
      #26 0x0828ef8c in do_command (thd=0xb087118) at sql_parse.cc:890
      #27 0x0828c0ec in handle_one_connection (arg=0xb087118) at sql_connect.cc:1153
      #28 0x00bea919 in start_thread () from /lib/libpthread.so.0
      #29 0x001edcbe in clone () from /lib/libc.so.6

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            philipstoev Philip Stoev added a comment -

            Test case
            LPexportBug665057_bug665057.test

            Show
            philipstoev Philip Stoev added a comment - Test case LPexportBug665057_bug665057.test
            Hide
            philipstoev Philip Stoev added a comment -

            Re: sql_select.cc:13863: int join_read_key2(THD*, JOIN_TAB*, TABLE*, TABLE_REF*): Assertion `table_ref->has_record' failed in maria-5.3-mwl128

            Show
            philipstoev Philip Stoev added a comment - Re: sql_select.cc:13863: int join_read_key2(THD*, JOIN_TAB*, TABLE*, TABLE_REF*): Assertion `table_ref->has_record' failed in maria-5.3-mwl128
            Hide
            philipstoev Philip Stoev added a comment -

            Re: sql_select.cc:13863: int join_read_key2(THD*, JOIN_TAB*, TABLE*, TABLE_REF*): Assertion `table_ref->has_record' failed in maria-5.3-mwl128
            Apologies for the gigantic test case. It appears that the automatic simplification is not able to remove all middle tables from a multi-table join in case only the first and last tables are required to reproduce a problem.

            Show
            philipstoev Philip Stoev added a comment - Re: sql_select.cc:13863: int join_read_key2(THD*, JOIN_TAB*, TABLE*, TABLE_REF*): Assertion `table_ref->has_record' failed in maria-5.3-mwl128 Apologies for the gigantic test case. It appears that the automatic simplification is not able to remove all middle tables from a multi-table join in case only the first and last tables are required to reproduce a problem.
            Hide
            igor Igor Babaev added a comment -

            Re: sql_select.cc:13863: int join_read_key2(THD*, JOIN_TAB*, TABLE*, TABLE_REF*): Assertion `table_ref->has_record' failed in maria-5.3-mwl128
            This bug is another manifestation of the bug #52005 (in the code that implemented Warshall's algorithm).
            The bug was fixed in the mariadb-5.1 code (5.1.50 release was with this fix). After the latest merge
            5.3->5.3-mwl128 the bug 665057 cannot be reproduced anymore.

            Show
            igor Igor Babaev added a comment - Re: sql_select.cc:13863: int join_read_key2(THD*, JOIN_TAB*, TABLE*, TABLE_REF*): Assertion `table_ref->has_record' failed in maria-5.3-mwl128 This bug is another manifestation of the bug #52005 (in the code that implemented Warshall's algorithm). The bug was fixed in the mariadb-5.1 code (5.1.50 release was with this fix). After the latest merge 5.3->5.3-mwl128 the bug 665057 cannot be reproduced anymore.
            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 665057

            Show
            ratzpo Rasmus Johansson added a comment - Launchpad bug id: 665057

              People

              • Assignee:
                igor Igor Babaev
                Reporter:
                philipstoev Philip Stoev
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: