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

SQ pushdown: Valgrind warnings (Conditional jump or move depends on uninitialised value) in best_extension_by_limited_search / greedy_search with expensive_pred_static_pushdown=on

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • None
    • 10.0.4
    • None
    • None

    Description

      Test case:

      SET optimizer_switch='expensive_pred_static_pushdown=on';
       
      CREATE TABLE t1 (i INT) ENGINE=MyISAM;
      INSERT INTO t1 VALUES (8),(18);
      SELECT 1 FROM t1 WHERE i IN ( SELECT 8 UNION SELECT 8 );

      ==29718== Thread 4:
      ==29718== Conditional jump or move depends on uninitialised value(s)
      ==29718==    at 0x6619E3: best_extension_by_limited_search(JOIN*, unsigned long long, unsigned int, double, double, unsigned int, unsigned int, unsigned int) (sql_select.cc:7524)
      ==29718==    by 0x65FA54: greedy_search(JOIN*, unsigned long long, unsigned int, unsigned int, unsigned int) (sql_select.cc:6684)
      ==29718==    by 0x65F05A: choose_plan(JOIN*, unsigned long long) (sql_select.cc:6261)
      ==29718==    by 0x658F3E: make_join_statistics(JOIN*, List<TABLE_LIST>&, Item*, st_dynamic_array*) (sql_select.cc:3916)
      ==29718==    by 0x64FD9D: JOIN::optimize_inner() (sql_select.cc:1314)
      ==29718==    by 0x64ED17: JOIN::optimize() (sql_select.cc:1008)
      ==29718==    by 0x6569FE: mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:3233)
      ==29718==    by 0x64D188: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:376)
      ==29718==    by 0x62251B: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:4804)
      ==29718==    by 0x61ABBC: mysql_execute_command(THD*) (sql_parse.cc:2268)
      ==29718==    by 0x624D86: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:5927)
      ==29718==    by 0x617EF7: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1091)
      ==29718==    by 0x617426: do_command(THD*) (sql_parse.cc:810)
      ==29718==    by 0x732E67: do_handle_one_connection(THD*) (sql_connect.cc:1266)
      ==29718==    by 0x732BD5: handle_one_connection (sql_connect.cc:1181)
      ==29718==    by 0x99CA4F: pfs_spawn_thread (pfs.cc:1015)
      ==29718== Conditional jump or move depends on uninitialised value(s)
      ==29718==    at 0x65FA94: greedy_search(JOIN*, unsigned long long, unsigned int, unsigned int, unsigned int) (sql_select.cc:6692)
      ==29718==    by 0x65F05A: choose_plan(JOIN*, unsigned long long) (sql_select.cc:6261)
      ==29718==    by 0x658F3E: make_join_statistics(JOIN*, List<TABLE_LIST>&, Item*, st_dynamic_array*) (sql_select.cc:3916)
      ==29718==    by 0x64FD9D: JOIN::optimize_inner() (sql_select.cc:1314)
      ==29718==    by 0x64ED17: JOIN::optimize() (sql_select.cc:1008)
      ==29718==    by 0x6569FE: mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:3233)
      ==29718==    by 0x64D188: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:376)
      ==29718==    by 0x62251B: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:4804)
      ==29718==    by 0x61ABBC: mysql_execute_command(THD*) (sql_parse.cc:2268)
      ==29718==    by 0x624D86: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:5927)
      ==29718==    by 0x617EF7: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1091)
      ==29718==    by 0x617426: do_command(THD*) (sql_parse.cc:810)
      ==29718==    by 0x732E67: do_handle_one_connection(THD*) (sql_connect.cc:1266)
      ==29718==    by 0x732BD5: handle_one_connection (sql_connect.cc:1181)
      ==29718==    by 0x99CA4F: pfs_spawn_thread (pfs.cc:1015)
      ==29718==    by 0x545AE99: start_thread (pthread_create.c:308)

      bzr version-info

      revision-id: timour@askmonty.org-20130611081135-rge7p00h8e9nhypj
      revno: 3551
      branch-nick: 10.0-mdev83

      BUILD/compile-pentium-valgrind-max-no-ndb

      7522:        }
      7523:
      7524:        if (current_read_time < join->best_read)
      7525:        {
      7526:          memcpy((uchar*) join->best_positions, (uchar*) join->positions,
      7527:                 sizeof(POSITION) * (idx + 1));
      7528:          join->record_count= join->positions[idx].partial_join_cardinality;
      7529:          join->best_read= current_read_time - 0.001;
      7530:          /*
      7531:            Store the current best choice of pushdown POSITIONs for all subqueries
      7532:          */

      6681:  do {
      6682:    /* Find the extension of the current QEP with the lowest cost */
      6683:    join->best_read= DBL_MAX;
      6684:    if (best_extension_by_limited_search(join, remaining_tables, idx, record_count,
      6685:                                         read_time, search_depth, prune_level,
      6686:                                         use_cond_selectivity))
      6687:      DBUG_RETURN(TRUE);
      6688:    /*
      6689:      'best_read < DBL_MAX' means that optimizer managed to find
      6690:      some plan and updated 'best_positions' array accordingly.
      6691:    */
      6692:    DBUG_ASSERT(join->best_read < DBL_MAX); 

      EXPLAIN:

      id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
      1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where; Subqueries: 2
      2	DEPENDENT SUBQUERY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
      3	DEPENDENT UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
      NULL	UNION RESULT	<union2,3>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
      Warnings:
      Note	1003	select 1 AS `1` from `test`.`t1` where <expr_cache><`test`.`t1`.`i`>(<in_optimizer>(`test`.`t1`.`i`,<exists>(select 8 having (<cache>(`test`.`t1`.`i`) = <ref_null_helper>(8)) union select 8 having (<cache>(`test`.`t1`.`i`) = <ref_null_helper>(8)))))

      Attachments

        Issue Links

          Activity

            People

              timour Timour Katchaounov (Inactive)
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.