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

Server crash in SEL_ARG::rb_insert or assertion failure in SEL_ARG::verify_weight

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.5, 10.6, 10.10(EOL), 10.11, 11.0(EOL), 11.1(EOL), 11.2(EOL)
    • 10.5, 10.6, 10.11
    • Optimizer
    • None

    Description

      --source include/have_innodb.inc
       
      CREATE TABLE lineitem (l_orderkey INT, l_partkey INT, l_suppkey INT, l_linenumber INT, l_quantity DOUBLE, l_shipdate DATE, PRIMARY KEY (l_orderkey,l_linenumber), KEY (l_shipdate), KEY (l_partkey,l_suppkey), KEY (l_quantity)) ENGINE=InnoDB;
      INSERT INTO lineitem VALUES (1,2,3,4,5.0,'2020-12-12'),(6,7,8,9,10,'2022-01-01'); # Optional, fails either way
       
      SELECT * FROM lineitem WHERE l_partkey = 6 OR l_shipdate = '1994-01-19' OR l_partkey IN (10, 20) AND l_shipdate IN ('1994-05-16', '1995-10-16') AND (l_suppkey = 5 OR l_quantity = 3) OR (l_linenumber = 8 OR l_quantity = 5) AND (l_orderkey BETWEEN 1 AND 0 OR l_linenumber NOT IN (0,4) AND l_shipdate != '1993-02-05');
      

      10.5 6b343de8

      #3  <signal handler called>
      #4  0x00005586d506856a in SEL_ARG::rb_insert (this=0x62500010e390, leaf=0x62500010e408) at /data/src/10.5/sql/opt_range.cc:11231
      #5  0x00005586d5066c96 in SEL_ARG::insert (this=0x62500010e390, key=0x62500010e408) at /data/src/10.5/sql/opt_range.cc:11055
      #6  0x00005586d5064017 in key_or (param=0x7ff1ede88530, key1=0x62500010e390, key2=0x6210000d9bb8) at /data/src/10.5/sql/opt_range.cc:10465
      #7  0x00005586d5064bc6 in key_or (param=0x7ff1ede88530, key1=0x62500010ca78, key2=0x6210000da4b8) at /data/src/10.5/sql/opt_range.cc:10719
      #8  0x00005586d5062ee9 in key_or_with_limit (param=0x7ff1ede88530, keyno=1, key1=0x62500010ca78, key2=0x6210000da388) at /data/src/10.5/sql/opt_range.cc:10121
      #9  0x00005586d502258c in SEL_IMERGE::or_sel_tree_with_checks (this=0x62500010c2b0, param=0x7ff1ede88530, n_trees=4, tree=0x62500010baa0, is_first_check_pass=false, is_last_check_pass=0x7ff1ede87930) at /data/src/10.5/sql/opt_range.cc:722
      #10 0x00005586d5022b89 in SEL_IMERGE::or_sel_imerge_with_checks (this=0x62500010c2b0, param=0x7ff1ede88530, n_trees=4, imerge=0x6210000da530, is_first_check_pass=false, is_last_check_pass=0x7ff1ede87a00) at /data/src/10.5/sql/opt_range.cc:805
      #11 0x00005586d5023a97 in imerge_list_or_list (param=0x7ff1ede88530, im1=0x6210000d78a0, im2=0x6210000d8e40) at /data/src/10.5/sql/opt_range.cc:1012
      #12 0x00005586d5060dcb in tree_or (param=0x7ff1ede88530, tree1=0x6210000d7870, tree2=0x6210000d8e10) at /data/src/10.5/sql/opt_range.cc:9831
      #13 0x00005586d5055986 in Item_cond::get_mm_tree (this=0x62b000086bc0, param=0x7ff1ede88530, cond_ptr=0x6290002b0980) at /data/src/10.5/sql/opt_range.cc:8404
      #14 0x00005586d5031630 in SQL_SELECT::test_quick_select (this=0x6290002b0978, thd=0x62b00007e218, keys_to_use=..., prev_tables=0, limit=18446744073709551615, force_quick_range=false, ordered_output=false, remove_false_parts_of_where=true, only_single_index_range_scan=false) at /data/src/10.5/sql/opt_range.cc:2892
      #15 0x00005586d450dc36 in get_quick_record_count (thd=0x62b00007e218, select=0x6290002b0978, table=0x6190000e0b98, keys=0x6290002af218, limit=18446744073709551615) at /data/src/10.5/sql/sql_select.cc:4903
      #16 0x00005586d4514aaf in make_join_statistics (join=0x62b00008a730, tables_list=..., keyuse_array=0x62b00008aa28) at /data/src/10.5/sql/sql_select.cc:5630
      #17 0x00005586d44f3331 in JOIN::optimize_inner (this=0x62b00008a730) at /data/src/10.5/sql/sql_select.cc:2363
      #18 0x00005586d44ec7a5 in JOIN::optimize (this=0x62b00008a730) at /data/src/10.5/sql/sql_select.cc:1721
      #19 0x00005586d450d36a in mysql_select (thd=0x62b00007e218, tables=0x62b000085ba8, fields=..., conds=0x62b000086bc0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x62b00008a700, unit=0x62b0000823c8, select_lex=0x62b000085520) at /data/src/10.5/sql/sql_select.cc:4845
      #20 0x00005586d44de208 in handle_select (thd=0x62b00007e218, lex=0x62b000082300, result=0x62b00008a700, setup_tables_done_option=0) at /data/src/10.5/sql/sql_select.cc:450
      #21 0x00005586d44471fd in execute_sqlcom_select (thd=0x62b00007e218, all_tables=0x62b000085ba8) at /data/src/10.5/sql/sql_parse.cc:6343
      #22 0x00005586d4435cf1 in mysql_execute_command (thd=0x62b00007e218) at /data/src/10.5/sql/sql_parse.cc:4020
      #23 0x00005586d44521c3 in mysql_parse (thd=0x62b00007e218, rawbuf=0x62b000085238 "SELECT * FROM lineitem WHERE l_partkey = 6 OR l_shipdate = '1994-01-19' OR l_partkey IN (10, 20) AND l_shipdate IN ('1994-05-16', '1995-10-16') AND (l_suppkey = 5 OR l_quantity = 3) OR (l_linenumber ="..., length=314, parser_state=0x7ff1ede8ac10, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:8120
      #24 0x00005586d4427b2a in dispatch_command (command=COM_QUERY, thd=0x62b00007e218, packet=0x629000280219 "SELECT * FROM lineitem WHERE l_partkey = 6 OR l_shipdate = '1994-01-19' OR l_partkey IN (10, 20) AND l_shipdate IN ('1994-05-16', '1995-10-16') AND (l_suppkey = 5 OR l_quantity = 3) OR (l_linenumber ="..., packet_length=314, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1891
      #25 0x00005586d44244bd in do_command (thd=0x62b00007e218) at /data/src/10.5/sql/sql_parse.cc:1375
      #26 0x00005586d4873819 in do_handle_one_connection (connect=0x6080000039b8, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1416
      #27 0x00005586d48731e1 in handle_one_connection (arg=0x608000003938) at /data/src/10.5/sql/sql_connect.cc:1318
      #28 0x00005586d54c1c0e in pfs_spawn_thread (arg=0x61500000c898) at /data/src/10.5/storage/perfschema/pfs.cc:2201
      #29 0x00007ff2026a7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #30 0x00007ff2027285bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      The next test case differs from the first one in only one condition: instead of l_linenumber NOT IN (0,4) it has {{l_linenumber != 0 }}.

      --source include/have_innodb.inc
       
      CREATE TABLE lineitem (l_orderkey INT, l_partkey INT, l_suppkey INT, l_linenumber INT, l_quantity DOUBLE, l_shipdate DATE, PRIMARY KEY (l_orderkey,l_linenumber), KEY (l_shipdate), KEY (l_partkey,l_suppkey), KEY (l_quantity)) ENGINE=InnoDB;
      INSERT INTO lineitem VALUES (1,2,3,4,5.0,'2020-12-12'),(6,7,8,9,10,'2022-01-01'); # Optional, fails either way
       
      SELECT * FROM lineitem WHERE l_partkey = 6 OR l_shipdate = '1994-01-19' OR l_partkey IN (10, 20) AND l_shipdate IN ('1994-05-16', '1995-10-16') AND (l_suppkey = 5 OR l_quantity = 3) OR (l_linenumber = 8 OR l_quantity = 5) AND (l_orderkey BETWEEN 1 AND 0 OR l_linenumber != 0 AND l_shipdate != '1993-02-05');
      

      2023-10-11 23:17:40 4 [ERROR] SEL_ARG weight mismatch: computed 14 have 13
       
      mariadbd: /data/src/10.5/sql/opt_range.cc:10104: uint SEL_ARG::verify_weight(): Assertion `computed_weight == weight' failed.
      231011 23:17:40 [ERROR] mysqld got signal 6 ;
       
      #9  0x00007fe6c0c53df2 in __GI___assert_fail (assertion=0x558790d678c0 "computed_weight == weight", file=0x558790d609c0 "/data/src/10.5/sql/opt_range.cc", line=10104, function=0x558790d67900 "uint SEL_ARG::verify_weight()") at ./assert/assert.c:101
      #10 0x000055878f35ee90 in SEL_ARG::verify_weight (this=0x62500010c798) at /data/src/10.5/sql/opt_range.cc:10104
      #11 0x000055878f35ef19 in key_or_with_limit (param=0x7fe6b35f1530, keyno=1, key1=0x62500010c798, key2=0x6210000da0c0) at /data/src/10.5/sql/opt_range.cc:10125
      #12 0x000055878f31e58c in SEL_IMERGE::or_sel_tree_with_checks (this=0x62500010bfd0, param=0x7fe6b35f1530, n_trees=4, tree=0x6210000da778, is_first_check_pass=false, is_last_check_pass=0x7fe6b35f0930) at /data/src/10.5/sql/opt_range.cc:722
      #13 0x000055878f31eb89 in SEL_IMERGE::or_sel_imerge_with_checks (this=0x62500010bfd0, param=0x7fe6b35f1530, n_trees=4, imerge=0x6210000da268, is_first_check_pass=false, is_last_check_pass=0x7fe6b35f0a00) at /data/src/10.5/sql/opt_range.cc:805
      #14 0x000055878f31fa97 in imerge_list_or_list (param=0x7fe6b35f1530, im1=0x6210000d78a0, im2=0x6210000d8e40) at /data/src/10.5/sql/opt_range.cc:1012
      #15 0x000055878f35cdcb in tree_or (param=0x7fe6b35f1530, tree1=0x6210000d7870, tree2=0x6210000d8e10) at /data/src/10.5/sql/opt_range.cc:9831
      #16 0x000055878f351986 in Item_cond::get_mm_tree (this=0x62b000086bb0, param=0x7fe6b35f1530, cond_ptr=0x6290002b0890) at /data/src/10.5/sql/opt_range.cc:8404
      #17 0x000055878f32d630 in SQL_SELECT::test_quick_select (this=0x6290002b0888, thd=0x62b00007e218, keys_to_use=..., prev_tables=0, limit=18446744073709551615, force_quick_range=false, ordered_output=false, remove_false_parts_of_where=true, only_single_index_range_scan=false) at /data/src/10.5/sql/opt_range.cc:2892
      #18 0x000055878e809c36 in get_quick_record_count (thd=0x62b00007e218, select=0x6290002b0888, table=0x6190000e0b98, keys=0x6290002af128, limit=18446744073709551615) at /data/src/10.5/sql/sql_select.cc:4903
      #19 0x000055878e810aaf in make_join_statistics (join=0x62b00008a6b0, tables_list=..., keyuse_array=0x62b00008a9a8) at /data/src/10.5/sql/sql_select.cc:5630
      #20 0x000055878e7ef331 in JOIN::optimize_inner (this=0x62b00008a6b0) at /data/src/10.5/sql/sql_select.cc:2363
      #21 0x000055878e7e87a5 in JOIN::optimize (this=0x62b00008a6b0) at /data/src/10.5/sql/sql_select.cc:1721
      #22 0x000055878e80936a in mysql_select (thd=0x62b00007e218, tables=0x62b000085b98, fields=..., conds=0x62b000086bb0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x62b00008a680, unit=0x62b0000823c8, select_lex=0x62b000085510) at /data/src/10.5/sql/sql_select.cc:4845
      #23 0x000055878e7da208 in handle_select (thd=0x62b00007e218, lex=0x62b000082300, result=0x62b00008a680, setup_tables_done_option=0) at /data/src/10.5/sql/sql_select.cc:450
      #24 0x000055878e7431fd in execute_sqlcom_select (thd=0x62b00007e218, all_tables=0x62b000085b98) at /data/src/10.5/sql/sql_parse.cc:6343
      #25 0x000055878e731cf1 in mysql_execute_command (thd=0x62b00007e218) at /data/src/10.5/sql/sql_parse.cc:4020
      #26 0x000055878e74e1c3 in mysql_parse (thd=0x62b00007e218, rawbuf=0x62b000085238 "SELECT * FROM lineitem WHERE l_partkey = 6 OR l_shipdate = '1994-01-19' OR l_partkey IN (10, 20) AND l_shipdate IN ('1994-05-16', '1995-10-16') AND (l_suppkey = 5 OR l_quantity = 3) OR (l_linenumber ="..., length=306, parser_state=0x7fe6b35f3c10, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:8120
      #27 0x000055878e723b2a in dispatch_command (command=COM_QUERY, thd=0x62b00007e218, packet=0x629000280219 "SELECT * FROM lineitem WHERE l_partkey = 6 OR l_shipdate = '1994-01-19' OR l_partkey IN (10, 20) AND l_shipdate IN ('1994-05-16', '1995-10-16') AND (l_suppkey = 5 OR l_quantity = 3) OR (l_linenumber ="..., packet_length=306, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1891
      #28 0x000055878e7204bd in do_command (thd=0x62b00007e218) at /data/src/10.5/sql/sql_parse.cc:1375
      #29 0x000055878eb6f819 in do_handle_one_connection (connect=0x6080000039b8, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1416
      #30 0x000055878eb6f1e1 in handle_one_connection (arg=0x608000003938) at /data/src/10.5/sql/sql_connect.cc:1318
      #31 0x000055878f7bdc0e in pfs_spawn_thread (arg=0x61500000c898) at /data/src/10.5/storage/perfschema/pfs.cc:2201
      #32 0x00007fe6c0ca7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #33 0x00007fe6c0d285bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.