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

statistics_for_command_is_needed: Conditional jump or move depends on uninitialised value

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.1, 10.2, 10.3, 10.4
    • Fix Version/s: 10.1.39
    • Component/s: Optimizer
    • Labels:
      None

      Description

      Run on a valgrind build:

      perl ./mtr main.1st --valgrind-mysqld --mysqld=--use-stat-tables=PREFERABLY
      

      10.1 3fe38574 Valgrind

      ==10062== Conditional jump or move depends on uninitialised value(s)
      ==10062==    at 0x686D14: statistics_for_command_is_needed(THD*) (sql_statistics.cc:2181)
      ==10062==    by 0x686E1D: alloc_statistics_for_table_share(THD*, TABLE_SHARE*, bool) (sql_statistics.cc:2260)
      ==10062==    by 0x576431: open_and_process_table(THD*, TABLE_LIST*, unsigned int*, unsigned int, Prelocking_strategy*, bool, Open_table_context*) (sql_base.cc:4249)
      ==10062==    by 0x577048: open_tables(THD*, DDL_options_st const&, TABLE_LIST**, unsigned int*, Sroutine_hash_entry**, unsigned int, Prelocking_strategy*) (sql_base.cc:4649)
      ==10062==    by 0x56E7FA: open_tables(THD*, DDL_options_st const&, TABLE_LIST**, unsigned int*, unsigned int, Prelocking_strategy*) (sql_base.h:264)
      ==10062==    by 0x578743: open_and_lock_tables(THD*, DDL_options_st const&, TABLE_LIST*, bool, unsigned int, Prelocking_strategy*) (sql_base.cc:5395)
      ==10062==    by 0x56B750: open_and_lock_tables(THD*, TABLE_LIST*, bool, unsigned int) (sql_base.h:555)
      ==10062==    by 0x5F639C: plugin_load(st_mem_root*) (sql_plugin.cc:1784)
      ==10062==    by 0x5F5D9D: plugin_init(int*, char**, int) (sql_plugin.cc:1662)
      ==10062==    by 0x50F6F1: init_server_components() (mysqld.cc:5183)
      ==10062==    by 0x5107AD: mysqld_main(int, char**) (mysqld.cc:5774)
      ==10062==    by 0x50592F: main (main.cc:25)
      ==10062== Conditional jump or move depends on uninitialised value(s)
      ==10062==    at 0x686D14: statistics_for_command_is_needed(THD*) (sql_statistics.cc:2181)
      ==10062==    by 0x6888E3: statistics_for_tables_is_needed(THD*, TABLE_LIST*) (sql_statistics.cc:3120)
      ==10062==    by 0x688DA2: read_statistics_for_tables_if_needed(THD*, TABLE_LIST*) (sql_statistics.cc:3261)
      ==10062==    by 0x5787D4: open_and_lock_tables(THD*, DDL_options_st const&, TABLE_LIST*, bool, unsigned int, Prelocking_strategy*) (sql_base.cc:5407)
      ==10062==    by 0x56B750: open_and_lock_tables(THD*, TABLE_LIST*, bool, unsigned int) (sql_base.h:555)
      ==10062==    by 0x5F639C: plugin_load(st_mem_root*) (sql_plugin.cc:1784)
      ==10062==    by 0x5F5D9D: plugin_init(int*, char**, int) (sql_plugin.cc:1662)
      ==10062==    by 0x50F6F1: init_server_components() (mysqld.cc:5183)
      ==10062==    by 0x5107AD: mysqld_main(int, char**) (mysqld.cc:5774)
      ==10062==    by 0x50592F: main (main.cc:25)
      ^ Found warnings in /data/bld/10.1-valgrind/mysql-test/var/log/mysqld.1.err
      ok
       
       - saving '/data/bld/10.1-valgrind/mysql-test/var/log/main.1st/' to '/data/bld/10.1-valgrind/mysql-test/var/log/main.1st/'
      ***Warnings generated in error logs during shutdown after running tests: main.1st
       
      ==10062== Thread 6:
      ==10062== Conditional jump or move depends on uninitialised value(s)
      ==10062==    at 0x686D14: statistics_for_command_is_needed(THD*) (sql_statistics.cc:2181)
      ==10062==    by 0x6888E3: statistics_for_tables_is_needed(THD*, TABLE_LIST*) (sql_statistics.cc:3120)
      ==10062==    by 0x688DA2: read_statistics_for_tables_if_needed(THD*, TABLE_LIST*) (sql_statistics.cc:3261)
      ==10062==    by 0x6C16A7: mysql_multi_update_prepare(THD*) (sql_update.cc:1569)
      ==10062==    by 0x5E03ED: mysql_execute_command(THD*) (sql_parse.cc:3803)
      ==10062==    by 0x985A57: sp_instr_stmt::exec_core(THD*, unsigned int*) (sp_head.cc:3220)
      ==10062==    by 0x985149: sp_lex_keeper::reset_lex_and_exec_core(THD*, unsigned int*, bool, sp_instr*) (sp_head.cc:2986)
      ==10062==    by 0x98571D: sp_instr_stmt::execute(THD*, unsigned int*) (sp_head.cc:3136)
      ==10062==    by 0x980F7E: sp_head::execute(THD*, bool) (sp_head.cc:1317)
      ==10062==    by 0x982E1A: sp_head::execute_procedure(THD*, List<Item>*) (sp_head.cc:2104)
      ==10062==    by 0x5DC791: do_execute_sp(THD*, sp_head*) (sql_parse.cc:2464)
      ==10062==    by 0x5E57BC: mysql_execute_command(THD*) (sql_parse.cc:5293)
      ==10062==    by 0x5EB79C: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:7459)
      ==10062==    by 0x5DA1A2: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1499)
      ==10062==    by 0x5D8F2D: do_command(THD*) (sql_parse.cc:1131)
      ==10062==    by 0x71A1B6: do_handle_one_connection(THD*) (sql_connect.cc:1330)
      

      Also reproducible on 10.4, I didn't try 10.2 and 10.3, just assume it's there as well.

      The problem appeared in 10.1 tree with this commit:

      commit 279a907fd0dea30be6d11fc4a5d63b1b98d0b329
      Commit:     Igor Babaev
      CommitDate: Mon Apr 22 17:11:07 2019 -0700
       
          MDEV-17605 Statistics for InnoDB table is wrong if persistent statistics is used
      

        Attachments

          Activity

            People

            • Assignee:
              igor Igor Babaev
              Reporter:
              elenst Elena Stepanova
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: