Valgrind warnings in create_ref_for_key with extended_keys+join_cache_hashed+join_cache_bka

Bug #923236 reported by Elena Stepanova on 2012-01-29
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released
Igor Babaev

Bug Description

==2090== Conditional jump or move depends on uninitialised value(s)
==2090== at 0x8542F76: create_ref_for_key(JOIN*, st_join_table*, keyuse_t*, bool, unsigned long long) (
==2090== by 0x8541034: get_best_combination(JOIN*) (
==2090== by 0x8532147: make_join_statistics(JOIN*, List<TABLE_LIST>&, Item*, st_dynamic_array*) (
==2090== by 0x8521D08: JOIN::optimize() (
==2090== by 0x852DCCA: 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*) (
==2090== by 0x858804C: mysql_explain_union(THD*, st_select_lex_unit*, select_result*) (
==2090== by 0x843BA9B: execute_sqlcom_select(THD*, TABLE_LIST*) (
==2090== by 0x84294D6: mysql_execute_command(THD*) (
==2090== by 0x8440EB7: mysql_parse(THD*, char*, unsigned int, char const**) (
==2090== by 0x84248D0: dispatch_command(enum_server_command, THD*, char*, unsigned int) (
==2090== by 0x8422F76: do_command(THD*) (
==2090== by 0x841C469: handle_one_connection (
==2090== by 0x40C9B24: start_thread (in /lib/
==2090== by 0x42F534D: clone (in /lib/

bzr version-info
revision-id: <email address hidden>
date: 2012-01-24 23:34:02 -0800
build-date: 2012-01-29 10:08:31 +0400
revno: 3395
branch-nick: lp-5.3-extended_keys

Reproducible with join_cache_hashed=on,join_cache_bka=on,extended_keys=on and join_cache_level >= 3.
The problem seems to be somehow related to the number of columns and the length of their names.


id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.a 2 100.00 Using where; Using join buffer (flat, BNLH join)
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t1`.`f3` AS `f3`,`test`.`t1`.`f4` AS `f4`,`test`.`t1`.`f5` AS `f5`,`test`.`t1`.`long_column_name_1` AS `long_column_name_1`,`test`.`t1`.`long_column_name_2` AS `long_column_name_2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`f6` AS `f6`,`test`.`t2`.`f7` AS `f7`,`test`.`t2`.`long_column_name_3` AS `long_column_name_3`,`test`.`t2`.`long_column_name_4` AS `long_column_name_4`,`test`.`t2`.`long_column_name_5` AS `long_column_name_5`,`test`.`t2`.`long_column_name_6` AS `long_column_name_6`,`test`.`t2`.`long_column_name_7` AS `long_column_name_7`,`test`.`t2`.`long_column_name_8` AS `long_column_name_8`,`test`.`t2`.`long_column_name_9` AS `long_column_name_9` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`b` = `test`.`t1`.`a`)

Minimal optimizer_switch: join_cache_hashed=on,join_cache_bka=on,extended_keys=on

Full optimizer_switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on

Test case:

SET join_cache_level=3;
SET optimizer_switch='join_cache_hashed=on,join_cache_bka=on,extended_keys=on';

  a INT, f1 INT, f2 INT,
  f3 INT, f4 INT, f5 INT,
  long_column_name_1 INT,
  long_column_name_2 INT

  b INT, f6 INT, f7 INT,
  long_column_name_3 INT,
  long_column_name_4 INT,
  long_column_name_5 INT,
  long_column_name_6 INT,
  long_column_name_7 INT,
  long_column_name_8 INT,
  long_column_name_9 INT

INSERT INTO t1 (a) VALUES (4),(6);
INSERT INTO t2 (b) VALUES (0),(8);

SELECT * FROM t1, t2 WHERE b=a;

Elena Stepanova (elenst) wrote :

Also filed in JIRA as MDEV-126

Changed in maria:
status: New → Confirmed
importance: Undecided → High
Changed in maria:
status: Confirmed → In Progress
Changed in maria:
status: In Progress → Fix Committed
Elena Stepanova (elenst) wrote :

Fix released with 5.5.21.

Changed in maria:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers