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

Assertion `computed_weight == weight' failed SEL_ARG::verify_weight

    XMLWordPrintable

    Details

      Description

      CREATE TABLE t1 (id INT, KEY (id));
      INSERT INTO t1 VALUES (1),(5);
      SELECT id FROM t1 WHERE id IS NULL OR id NOT BETWEEN 1 AND 4;
       
      # Cleanup
      DROP TABLE t1;
      

      10.5 cd51854d7a

      2022-08-04  0:36:58 4 [ERROR] SEL_ARG weight mismatch: computed 2 have 3
       
      mariadbd: /data/src/10.5-bug/sql/opt_range.cc:10086: uint SEL_ARG::verify_weight(): Assertion `computed_weight == weight' failed.
      220804  0:36:58 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f28277e6662 in __GI___assert_fail (assertion=0x55916195619e "computed_weight == weight", file=0x559161954248 "/data/src/10.5-bug/sql/opt_range.cc", line=10086, function=0x5591619561b8 "uint SEL_ARG::verify_weight()") at assert.c:101
      #8  0x0000559160eca343 in SEL_ARG::verify_weight (this=0x7f281005b270) at /data/src/10.5-bug/sql/opt_range.cc:10086
      #9  0x0000559160eca3cc in key_or_with_limit (param=0x7f28221a18f0, keyno=0, key1=0x7f281005b178, key2=0x7f281005b270) at /data/src/10.5-bug/sql/opt_range.cc:10107
      #10 0x0000559160ec9445 in tree_or (param=0x7f28221a18f0, tree1=0x7f281005b0f8, tree2=0x7f281005b1e8) at /data/src/10.5-bug/sql/opt_range.cc:9770
      #11 0x0000559160ec53e2 in Item_cond::get_mm_tree (this=0x7f28100166f8, param=0x7f28221a18f0, cond_ptr=0x7f2810018d88) at /data/src/10.5-bug/sql/opt_range.cc:8380
      #12 0x0000559160eb6e6e in SQL_SELECT::test_quick_select (this=0x7f2810018d80, thd=0x7f2810000db8, 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-bug/sql/opt_range.cc:2883
      #13 0x0000559160a0dbad in get_quick_record_count (thd=0x7f2810000db8, select=0x7f2810018d80, table=0x7f2810101568, keys=0x7f2810017bc8, limit=18446744073709551615) at /data/src/10.5-bug/sql/sql_select.cc:4853
      #14 0x0000559160a1050c in make_join_statistics (join=0x7f2810017140, tables_list=..., keyuse_array=0x7f2810017428) at /data/src/10.5-bug/sql/sql_select.cc:5580
      #15 0x0000559160a049d8 in JOIN::optimize_inner (this=0x7f2810017140) at /data/src/10.5-bug/sql/sql_select.cc:2325
      #16 0x0000559160a02485 in JOIN::optimize (this=0x7f2810017140) at /data/src/10.5-bug/sql/sql_select.cc:1686
      #17 0x0000559160a0d898 in mysql_select (thd=0x7f2810000db8, tables=0x7f2810015a00, fields=..., conds=0x7f28100166f8, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f2810017118, unit=0x7f2810004f60, select_lex=0x7f28100153e8) at /data/src/10.5-bug/sql/sql_select.cc:4795
      #18 0x00005591609fd2a3 in handle_select (thd=0x7f2810000db8, lex=0x7f2810004e98, result=0x7f2810017118, setup_tables_done_option=0) at /data/src/10.5-bug/sql/sql_select.cc:444
      #19 0x00005591609c00b0 in execute_sqlcom_select (thd=0x7f2810000db8, all_tables=0x7f2810015a00) at /data/src/10.5-bug/sql/sql_parse.cc:6315
      #20 0x00005591609b73e7 in mysql_execute_command (thd=0x7f2810000db8) at /data/src/10.5-bug/sql/sql_parse.cc:4006
      #21 0x00005591609c4e81 in mysql_parse (thd=0x7f2810000db8, rawbuf=0x7f2810015310 "SELECT id FROM t1 WHERE id IS NULL OR id NOT BETWEEN 1 AND 4", length=60, parser_state=0x7f28221a33d0, is_com_multi=false, is_next_command=false) at /data/src/10.5-bug/sql/sql_parse.cc:8101
      #22 0x00005591609b0fba in dispatch_command (command=COM_QUERY, thd=0x7f2810000db8, packet=0x7f281000b5c9 "SELECT id FROM t1 WHERE id IS NULL OR id NOT BETWEEN 1 AND 4", packet_length=60, is_com_multi=false, is_next_command=false) at /data/src/10.5-bug/sql/sql_parse.cc:1891
      #23 0x00005591609af814 in do_command (thd=0x7f2810000db8) at /data/src/10.5-bug/sql/sql_parse.cc:1375
      #24 0x0000559160b5ccd3 in do_handle_one_connection (connect=0x55916512a698, put_in_cache=true) at /data/src/10.5-bug/sql/sql_connect.cc:1418
      #25 0x0000559160b5c995 in handle_one_connection (arg=0x55916510a1a8) at /data/src/10.5-bug/sql/sql_connect.cc:1312
      #26 0x000055916106eb5c in pfs_spawn_thread (arg=0x55916512a418) at /data/src/10.5-bug/storage/perfschema/pfs.cc:2201
      #27 0x00007f2827cb2ea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #28 0x00007f28278afdef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      The assertion failure looks identical to MDEV-25896, but for this test case, it is a regression which started happening after this commit:

      commit 90ba999e800957c230290bd438a3e73628222a74
      Author: Sergei Petrunia
      Date:   Wed Jul 27 17:37:03 2022 +0300
       
          MDEV-25020: Range optimizer regression for key IN (const, ....)
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              psergei Sergei Petrunia
              Reporter:
              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.