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

Assertion failures in Histogram_builder::next / Field_long::val_real upon ANALYZE .. PERSISTENT FOR COLUMNS()

    XMLWordPrintable

Details

    Description

      SET histogram_size= 254;
      CREATE TABLE t (a INT);
      INSERT INTO t VALUES (1),(2);
      LOCK TABLE t WRITE;
      ANALYZE TABLE t PERSISTENT FOR ALL;
      ANALYZE TABLE t PERSISTENT FOR COLUMNS () INDEXES ();
       
      # Cleanup
      DROP TABLE t;
      

      10.2 b2a5e0f2

      mysqld: /data/src/10.2/sql/field.cc:4356: virtual double Field_long::val_real(): Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' failed.
      211001  2:55:01 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f39a75c3f36 in __GI___assert_fail (assertion=0x562776eac0e0 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))", file=0x562776eabaa4 "/data/src/10.2/sql/field.cc", line=4356, function=0x562776ead088 "virtual double Field_long::val_real()") at assert.c:101
      #8  0x00005627765c0176 in Field_long::val_real (this=0x7f399017f550) at /data/src/10.2/sql/field.cc:4356
      #9  0x00005627765b527d in Field::pos_in_interval_val_real (this=0x7f399017f550, min=0x7f399017f7f8, max=0x7f39900a2ab8) at /data/src/10.2/sql/field.cc:1137
      #10 0x00005627763ec1d5 in Field_num::pos_in_interval (this=0x7f399017f550, min=0x7f399017f7f8, max=0x7f39900a2ab8) at /data/src/10.2/sql/field.h:1722
      #11 0x0000562776421742 in Histogram_builder::next (this=0x7f39a15ce050, elem=0x7f39900b56d0, elem_cnt=1) at /data/src/10.2/sql/sql_statistics.cc:1590
      #12 0x00005627764193f4 in histogram_build_walk (elem=0x7f39900b56d0, elem_cnt=1, arg=0x7f39a15ce050) at /data/src/10.2/sql/sql_statistics.cc:1610
      #13 0x0000562776d4ad38 in tree_walk_left_root_right (tree=0x7f39900132b8, element=0x7f39900b56b8, action=0x5627764193bf <histogram_build_walk(void*, element_count, void*)>, argument=0x7f39a15ce050) at /data/src/10.2/mysys/tree.c:552
      #14 0x0000562776d4ac7c in tree_walk (tree=0x7f39900132b8, action=0x5627764193bf <histogram_build_walk(void*, element_count, void*)>, argument=0x7f39a15ce050, visit=left_root_right) at /data/src/10.2/mysys/tree.c:538
      #15 0x000056277648d540 in Unique::walk (this=0x7f3990013118, table=0x7f399017e920, action=0x5627764193bf <histogram_build_walk(void*, element_count, void*)>, walk_action_arg=0x7f39a15ce050) at /data/src/10.2/sql/uniques.cc:646
      #16 0x0000562776421b07 in Count_distinct_field::get_value_with_histogram (this=0x7f39900130f8, rows=2) at /data/src/10.2/sql/sql_statistics.cc:1708
      #17 0x00005627764226c9 in Column_statistics_collected::finish (this=0x7f399017f680, rows=2) at /data/src/10.2/sql/sql_statistics.cc:2406
      #18 0x000056277641a580 in collect_statistics_for_table (thd=0x7f3990000d90, table=0x7f399017e920) at /data/src/10.2/sql/sql_statistics.cc:2666
      #19 0x00005627764cc35a in mysql_admin_table (thd=0x7f3990000d90, tables=0x7f3990012818, check_opt=0x7f39900058b8, operator_name=0x562776e08eaf "analyze", lock_type=TL_READ_NO_INSERT, org_open_for_modify=true, repair_table_use_frm=false, extra_open_options=0, prepare_func=0x0, operator_func=(int (handler::*)(class handler * const, class THD *, HA_CHECK_OPT *)) 0x5627765f3b56 <handler::ha_analyze(THD*, st_ha_check_opt*)>, view_operator_func=0x0, is_cmd_replicated=true) at /data/src/10.2/sql/sql_admin.cc:902
      #20 0x00005627764cdea5 in Sql_cmd_analyze_table::execute (this=0x7f3990012e70, thd=0x7f3990000d90) at /data/src/10.2/sql/sql_admin.cc:1341
      #21 0x000056277636bd20 in mysql_execute_command (thd=0x7f3990000d90) at /data/src/10.2/sql/sql_parse.cc:6017
      #22 0x0000562776370b86 in mysql_parse (thd=0x7f3990000d90, rawbuf=0x7f3990012708 "ANALYZE TABLE t PERSISTENT FOR COLUMNS () INDEXES ()", length=52, parser_state=0x7f39a15cf560, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7793
      #23 0x000056277635ede1 in dispatch_command (command=COM_QUERY, thd=0x7f3990000d90, packet=0x7f3990008b61 "", packet_length=52, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1827
      #24 0x000056277635d8dc in do_command (thd=0x7f3990000d90) at /data/src/10.2/sql/sql_parse.cc:1381
      #25 0x00005627764b96ab in do_handle_one_connection (connect=0x5627787180d0) at /data/src/10.2/sql/sql_connect.cc:1336
      #26 0x00005627764b9410 in handle_one_connection (arg=0x5627787180d0) at /data/src/10.2/sql/sql_connect.cc:1241
      #27 0x0000562776ce3dca in pfs_spawn_thread (arg=0x5627786fb4d0) at /data/src/10.2/storage/perfschema/pfs.cc:1869
      #28 0x00007f39a7ad4609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #29 0x00007f39a76af293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      10.6 309209c5

      mariadbd: /data/src/10.6/sql/field.cc:4409: virtual double Field_long::val_real(): Assertion `marked_for_read()' failed.
      211001  2:56:02 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fe042a87f36 in __GI___assert_fail (assertion=0x5581f79ec1ad "marked_for_read()", file=0x5581f79ebbe3 "/data/src/10.6/sql/field.cc", line=4409, function=0x5581f79ed150 "virtual double Field_long::val_real()") at assert.c:101
      #8  0x00005581f6ddf408 in Field_long::val_real (this=0x7fe02c1b0ba8) at /data/src/10.6/sql/field.cc:4409
      #9  0x00005581f6dd46b9 in Field::pos_in_interval_val_real (this=0x7fe02c1b0ba8, min=0x7fe02c1b0e58, max=0x7fe02c07c5d0) at /data/src/10.6/sql/field.cc:1114
      #10 0x00005581f6c14709 in Field_num::pos_in_interval (this=0x7fe02c1b0ba8, min=0x7fe02c1b0e58, max=0x7fe02c07c5d0) at /data/src/10.6/sql/field.h:2068
      #11 0x00005581f6b639ce in Histogram_builder::next (this=0x7fe03d2e21d0, elem=0x7fe02c237798, elem_cnt=1) at /data/src/10.6/sql/sql_statistics.cc:1569
      #12 0x00005581f6b5b201 in histogram_build_walk (elem=0x7fe02c237798, elem_cnt=1, arg=0x7fe03d2e21d0) at /data/src/10.6/sql/sql_statistics.cc:1589
      #13 0x00005581f770d4fc in tree_walk_left_root_right (tree=0x7fe02c016208, element=0x7fe02c237780, action=0x5581f6b5b1cc <histogram_build_walk(void*, element_count, void*)>, argument=0x7fe03d2e21d0) at /data/src/10.6/mysys/tree.c:590
      #14 0x00005581f770d440 in tree_walk (tree=0x7fe02c016208, action=0x5581f6b5b1cc <histogram_build_walk(void*, element_count, void*)>, argument=0x7fe03d2e21d0, visit=left_root_right) at /data/src/10.6/mysys/tree.c:576
      #15 0x00005581f6bf88f2 in Unique::walk (this=0x7fe02c016060, table=0x7fe02c1b06f8, action=0x5581f6b5b1cc <histogram_build_walk(void*, element_count, void*)>, walk_action_arg=0x7fe03d2e21d0) at /data/src/10.6/sql/uniques.cc:654
      #16 0x00005581f6b63d4b in Count_distinct_field::walk_tree_with_histogram (this=0x7fe02c016030, rows=2) at /data/src/10.6/sql/sql_statistics.cc:1698
      #17 0x00005581f6b6492c in Column_statistics_collected::finish (this=0x7fe02c1b0ce0, rows=2, sample_fraction=1) at /data/src/10.6/sql/sql_statistics.cc:2410
      #18 0x00005581f6b5c5db in collect_statistics_for_table (thd=0x7fe02c000db8, table=0x7fe02c1b06f8) at /data/src/10.6/sql/sql_statistics.cc:2713
      #19 0x00005581f6c4ad96 in mysql_admin_table (thd=0x7fe02c000db8, tables=0x7fe02c0156c0, check_opt=0x7fe02c0063b8, operator_name=0x5581f8045460 <msg_analyze>, lock_type=TL_READ_NO_INSERT, org_open_for_modify=true, repair_table_use_frm=false, extra_open_options=0, prepare_func=0x0, operator_func=(int (handler::*)(class handler * const, class THD *, HA_CHECK_OPT *)) 0x5581f6e22210 <handler::ha_analyze(THD*, st_ha_check_opt*)>, view_operator_func=0x0, is_cmd_replicated=true) at /data/src/10.6/sql/sql_admin.cc:1043
      #20 0x00005581f6c4c858 in Sql_cmd_analyze_table::execute (this=0x7fe02c015dd8, thd=0x7fe02c000db8) at /data/src/10.6/sql/sql_admin.cc:1516
      #21 0x00005581f6a8302b in mysql_execute_command (thd=0x7fe02c000db8, is_called_from_prepared_stmt=false) at /data/src/10.6/sql/sql_parse.cc:5997
      #22 0x00005581f6a891d7 in mysql_parse (thd=0x7fe02c000db8, rawbuf=0x7fe02c0155c0 "ANALYZE TABLE t PERSISTENT FOR COLUMNS () INDEXES ()", length=52, parser_state=0x7fe03d2e3480) at /data/src/10.6/sql/sql_parse.cc:8030
      #23 0x00005581f6a75607 in dispatch_command (command=COM_QUERY, thd=0x7fe02c000db8, packet=0x7fe02c00b879 "", packet_length=52, blocking=true) at /data/src/10.6/sql/sql_parse.cc:1896
      #24 0x00005581f6a73fa3 in do_command (thd=0x7fe02c000db8, blocking=true) at /data/src/10.6/sql/sql_parse.cc:1404
      #25 0x00005581f6c32047 in do_handle_one_connection (connect=0x5581f9f36e38, put_in_cache=true) at /data/src/10.6/sql/sql_connect.cc:1418
      #26 0x00005581f6c31cd7 in handle_one_connection (arg=0x5581f9f34198) at /data/src/10.6/sql/sql_connect.cc:1312
      #27 0x00005581f7162597 in pfs_spawn_thread (arg=0x5581f9f36988) at /data/src/10.6/storage/perfschema/pfs.cc:2201
      #28 0x00007fe042fa0609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #29 0x00007fe042b73293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Reproducible with at least MyISAM and InnoDB.
      Non-debug builds don't crash, but the stack trace above makes me wonder if the statement is doing something it's not supposed to at all, as PERSISTENT FOR COLUMNS() INDEXES () only updates table stats,

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.