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

SQ pushdown: Valgrind warnings (Conditional jump or move depends on uninitialised value) in compare_items_by_cost

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.0.4
    • Component/s: None
    • Labels:
      None

      Description

      ==6997== Thread 4:
      ==6997== Conditional jump or move depends on uninitialised value(s)
      ==6997==    at 0x67C73D: compare_items_by_cost(Item*, Item*, void*) (sql_select.cc:18677)
      ==6997==    by 0x6913F3: void bubble_sort<Item>(List<Item>*, int (*)(Item*, Item*, void*), void*) (sql_list.h:599)
      ==6997==    by 0x67C9E5: make_cond_for_table_from_pred(THD*, Item*, Item*, unsigned long long, unsigned long long, int, bool, bool) (sql_select.cc:18737)
      ==6997==    by 0x67C68A: make_cond_for_table(THD*, Item*, unsigned long long, unsigned long long, int, bool, bool) (sql_select.cc:18666)
      ==6997==    by 0x6660D4: make_join_select(JOIN*, SQL_SELECT*, Item*) (sql_select.cc:9273)
      ==6997==    by 0x650967: JOIN::optimize_inner() (sql_select.cc:1494)
      ==6997==    by 0x64ED17: JOIN::optimize() (sql_select.cc:1008)
      ==6997==    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)
      ==6997==    by 0x64D188: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:376)
      ==6997==    by 0x62251B: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:4804)
      ==6997==    by 0x61ABBC: mysql_execute_command(THD*) (sql_parse.cc:2268)
      ==6997==    by 0x624D86: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:5927)
      ==6997==    by 0x617EF7: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1091)
      ==6997==    by 0x617426: do_command(THD*) (sql_parse.cc:810)
      ==6997==    by 0x732E67: do_handle_one_connection(THD*) (sql_connect.cc:1266)
      ==6997==    by 0x732BD5: handle_one_connection (sql_connect.cc:1181)
      ==6997== Conditional jump or move depends on uninitialised value(s)
      ==6997==    at 0x67C743: compare_items_by_cost(Item*, Item*, void*) (sql_select.cc:18677)
      ==6997==    by 0x6913F3: void bubble_sort<Item>(List<Item>*, int (*)(Item*, Item*, void*), void*) (sql_list.h:599)
      ==6997==    by 0x67C9E5: make_cond_for_table_from_pred(THD*, Item*, Item*, unsigned long long, unsigned long long, int, bool, bool) (sql_select.cc:18737)
      ==6997==    by 0x67C68A: make_cond_for_table(THD*, Item*, unsigned long long, unsigned long long, int, bool, bool) (sql_select.cc:18666)
      ==6997==    by 0x6660D4: make_join_select(JOIN*, SQL_SELECT*, Item*) (sql_select.cc:9273)
      ==6997==    by 0x650967: JOIN::optimize_inner() (sql_select.cc:1494)
      ==6997==    by 0x64ED17: JOIN::optimize() (sql_select.cc:1008)
      ==6997==    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)
      ==6997==    by 0x64D188: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:376)
      ==6997==    by 0x62251B: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:4804)
      ==6997==    by 0x61ABBC: mysql_execute_command(THD*) (sql_parse.cc:2268)
      ==6997==    by 0x624D86: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:5927)
      ==6997==    by 0x617EF7: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1091)
      ==6997==    by 0x617426: do_command(THD*) (sql_parse.cc:810)
      ==6997==    by 0x732E67: do_handle_one_connection(THD*) (sql_connect.cc:1266)
      ==6997==    by 0x732BD5: handle_one_connection (sql_connect.cc:1181)
      ==6997== Conditional jump or move depends on uninitialised value(s)
      ==6997==    at 0x67C75F: compare_items_by_cost(Item*, Item*, void*) (sql_select.cc:18679)
      ==6997==    by 0x6913F3: void bubble_sort<Item>(List<Item>*, int (*)(Item*, Item*, void*), void*) (sql_list.h:599)
      ==6997==    by 0x67C9E5: make_cond_for_table_from_pred(THD*, Item*, Item*, unsigned long long, unsigned long long, int, bool, bool) (sql_select.cc:18737)
      ==6997==    by 0x67C68A: make_cond_for_table(THD*, Item*, unsigned long long, unsigned long long, int, bool, bool) (sql_select.cc:18666)
      ==6997==    by 0x6660D4: make_join_select(JOIN*, SQL_SELECT*, Item*) (sql_select.cc:9273)
      ==6997==    by 0x650967: JOIN::optimize_inner() (sql_select.cc:1494)
      ==6997==    by 0x64ED17: JOIN::optimize() (sql_select.cc:1008)
      ==6997==    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)
      ==6997==    by 0x64D188: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:376)
      ==6997==    by 0x62251B: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:4804)
      ==6997==    by 0x61ABBC: mysql_execute_command(THD*) (sql_parse.cc:2268)
      ==6997==    by 0x624D86: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:5927)
      ==6997==    by 0x617EF7: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1091)
      ==6997==    by 0x617426: do_command(THD*) (sql_parse.cc:810)
      ==6997==    by 0x732E67: do_handle_one_connection(THD*) (sql_connect.cc:1266)

      18670:static int compare_items_by_cost(Item* it1, Item* it2, void *arg)
      18671:{
      18672:  double cost1= 0, cost2= 0;
      18673:
      18674:  it1->walk(&Item::sum_cost_processor, false, (uchar*) &cost1);
      18675:  it2->walk(&Item::sum_cost_processor, false, (uchar*) &cost2);
      18676:
      18677:  if (cost1 == cost2)
      18678:    return 0;
      18679:  if (cost1 > cost2)
      18680:    return -1;
      18681:  else
      18682:    return 1;
      18683:}

      bzr version-info

      revision-id: timour@askmonty.org-20130528122232-kisslvdw5vhrna0q
      revno: 3550
      branch-nick: 10.0-mdev83

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

      Test case:

      CREATE TABLE t1 (i1 INT, c1 CHAR(1)) ENGINE=MyISAM;
      INSERT INTO t1 VALUES (1,'a'),(2,'b');
       
      CREATE TABLE t2 (i2 INT, c2 CHAR(1)) ENGINE=MyISAM;
      INSERT INTO t2 VALUES (3,'m'),(4,'n');
       
      SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE (i2 = i1) AND ( c2 , c1 )  IN ( SELECT 'f' , 'q' );

      EXPLAIN:

      SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE (i2 = i1) AND ( c2 , c1 )  IN ( SELECT 'f' , 'q' );
      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	
      1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where; Subqueries: 2; Using join buffer (flat, BNL join)
      2	DEPENDENT SUBQUERY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
      Warnings:
      Note	1003	select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`c1` AS `c1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` straight_join `test`.`t2` where ((`test`.`t2`.`i2` = `test`.`t1`.`i1`) and <expr_cache><`test`.`t2`.`c2`,`test`.`t1`.`c1`>(<in_optimizer>((`test`.`t2`.`c2`,`test`.`t1`.`c1`),<exists>(select 'f','q' having (((<cache>(`test`.`t2`.`c2`) = 'f') or isnull('f')) and ((<cache>(`test`.`t1`.`c1`) = 'q') or isnull('q')) and <is_not_null_test>('f') and <is_not_null_test>('q'))))))

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              timour Timour Katchaounov (Inactive)
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: