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

Assertion failure upon DECODE_HISTOGRAM with NULLs in first column

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: N/A
    • Fix Version/s: 10.7.1
    • Component/s: Optimizer
    • Labels:
      None

      Description

      CREATE TABLE t1 (a INT, b INT);
      INSERT INTO t1 VALUES (NULL,1), (NULL,2);
      SET histogram_type = JSON_HB;
      ANALYZE TABLE t1 PERSISTENT FOR ALL;
      SELECT DECODE_HISTOGRAM(hist_type, histogram) from mysql.column_stats;
       
      # Cleanup
      DROP TABLE t1;
      

      preview-10.7-MDEV-21130-json-histograms 8fc778f3e9c

      mariadbd: /data/src/preview-10.7-MDEV-21130-json-histograms/sql/sql_type.cc:7457: bool Type_handler::Item_send_str(Item*, Protocol*, st_value*) const: Assertion `!it
      em->null_value' failed.
      210911 12:44:49 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fcbe9582f36 in __GI___assert_fail (assertion=0x5595b90af58f "!item->null_value", file=0x5595b90ac490 "/data/src/preview-10.7-MDEV-21130-json-histograms/sql/sql_type.cc", line=7457, function=0x5595b90af5a8 "bool Type_handler::Item_send_str(Item*, Protocol*, st_value*) const") at assert.c:101
      #8  0x00005595b7c7dcc9 in Type_handler::Item_send_str (this=0x5595ba6f9ac0 <type_handler_long_blob>, item=0x7fcbc8015a90, protocol=0x7fcbc80013a0, buf=0x7fcbe45ddc60) at /data/src/preview-10.7-MDEV-21130-json-histograms/sql/sql_type.cc:7457
      #9  0x00005595b7ad0358 in Type_handler_string_result::Item_send (this=0x5595ba6f9ac0 <type_handler_long_blob>, item=0x7fcbc8015a90, protocol=0x7fcbc80013a0, buf=0x7fcbe45ddc60) at /data/src/preview-10.7-MDEV-21130-json-histograms/sql/sql_type.h:5440
      #10 0x00005595b74ca666 in Item::send (this=0x7fcbc8015a90, protocol=0x7fcbc80013a0, buffer=0x7fcbe45ddc60) at /data/src/preview-10.7-MDEV-21130-json-histograms/sql/item.h:1227
      #11 0x00005595b754fe9e in Protocol::send_result_set_row (this=0x7fcbc80013a0, row_items=0x7fcbc8015618) at /data/src/preview-10.7-MDEV-21130-json-histograms/sql/protocol.cc:1327
      #12 0x00005595b76b6e27 in select_send::send_data (this=0x7fcbc8016bd0, items=...) at /data/src/preview-10.7-MDEV-21130-json-histograms/sql/sql_class.cc:3072
      #13 0x00005595b7914c19 in select_result_sink::send_data_with_check (this=0x7fcbc8016bd0, items=..., u=0x7fcbc8005120, sent=1) at /data/src/preview-10.7-MDEV-21130-json-histograms/sql/sql_class.h:5634
      #14 0x00005595b78e34fa in end_send (join=0x7fcbc8016bf8, join_tab=0x7fcbc8018278, end_of_records=false) at /data/src/preview-10.7-MDEV-21130-json-histograms/sql/sql_select.cc:22285
      #15 0x00005595b78de5b1 in evaluate_join_record (join=0x7fcbc8016bf8, join_tab=0x7fcbc8017ec8, error=0) at /data/src/preview-10.7-MDEV-21130-json-histograms/sql/sql_select.cc:21278
      #16 0x00005595b78dda54 in sub_select (join=0x7fcbc8016bf8, join_tab=0x7fcbc8017ec8, end_of_records=false) at /data/src/preview-10.7-MDEV-21130-json-histograms/sql/sql_select.cc:21094
      #17 0x00005595b78dbe49 in do_select (join=0x7fcbc8016bf8, procedure=0x0) at /data/src/preview-10.7-MDEV-21130-json-histograms/sql/sql_select.cc:20602
      #18 0x00005595b788b47c in JOIN::exec_inner (this=0x7fcbc8016bf8) at /data/src/preview-10.7-MDEV-21130-json-histograms/sql/sql_select.cc:4735
      #19 0x00005595b78897a5 in JOIN::exec (this=0x7fcbc8016bf8) at /data/src/preview-10.7-MDEV-21130-json-histograms/sql/sql_select.cc:4513
      #20 0x00005595b788c97b in mysql_select (thd=0x7fcbc8000db8, tables=0x7fcbc8015c10, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fcbc8016bd0, unit=0x7fcbc8005120, select_lex=0x7fcbc8015378) at /data/src/preview-10.7-MDEV-21130-json-histograms/sql/sql_select.cc:4991
      #21 0x00005595b786cbb8 in handle_select (thd=0x7fcbc8000db8, lex=0x7fcbc8005058, result=0x7fcbc8016bd0, setup_tables_done_option=0) at /data/src/preview-10.7-MDEV-21130-json-histograms/sql/sql_select.cc:545
      #22 0x00005595b77c7176 in execute_sqlcom_select (thd=0x7fcbc8000db8, all_tables=0x7fcbc8015c10) at /data/src/preview-10.7-MDEV-21130-json-histograms/sql/sql_parse.cc:6256
      #23 0x00005595b77b342a in mysql_execute_command (thd=0x7fcbc8000db8, is_called_from_prepared_stmt=false) at /data/src/preview-10.7-MDEV-21130-json-histograms/sql/sql_parse.cc:3946
      #24 0x00005595b77d086c in mysql_parse (thd=0x7fcbc8000db8, rawbuf=0x7fcbc8015290 "SELECT DECODE_HISTOGRAM(hist_type, histogram) from mysql.column_stats", length=69, parser_state=0x7fcbe45df480) at /data/src/preview-10.7-MDEV-21130-json-histograms/sql/sql_parse.cc:8030
      #25 0x00005595b77a6b0c in dispatch_command (command=COM_QUERY, thd=0x7fcbc8000db8, packet=0x7fcbc800b849 "", packet_length=69, blocking=true) at /data/src/preview-10.7-MDEV-21130-json-histograms/sql/sql_parse.cc:1896
      #26 0x00005595b77a3ba2 in do_command (thd=0x7fcbc8000db8, blocking=true) at /data/src/preview-10.7-MDEV-21130-json-histograms/sql/sql_parse.cc:1404
      #27 0x00005595b7b0d493 in do_handle_one_connection (connect=0x5595bc8dd8c8, put_in_cache=true) at /data/src/preview-10.7-MDEV-21130-json-histograms/sql/sql_connect.cc:1418
      #28 0x00005595b7b0cc5b in handle_one_connection (arg=0x5595bc8dc1f8) at /data/src/preview-10.7-MDEV-21130-json-histograms/sql/sql_connect.cc:1312
      #29 0x00005595b83eea83 in pfs_spawn_thread (arg=0x5595bc8dd418) at /data/src/preview-10.7-MDEV-21130-json-histograms/storage/perfschema/pfs.cc:2201
      #30 0x00007fcbe9a9b609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #31 0x00007fcbe966e293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Reproducible with at least MyISAM and InnoDB.

      As far as I could tell, the important part here is that the first column of the table has only NULLs. If one of the values in the first column isn't NULL, the failure doesn't happen.
      If this generalization is incorrect, please modify the ticket summary to avoid confusion.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration