3895 Chaithra Gopalareddy 2012-04-18
PROBLEM:
This is a follow up patch on 5.6 for the bug#12713907.
This bug is not reproducible on 5.6 as changes for WL#5558
hides the problem.
In 5.6, since keyread is set to true in test_if_skip_sot_order
for both 'QUICK_RANGE_SELECT' and 'JT_INDEX_SCAN', we need
to move the call for set_keyread to join_init_read_record.
Access function for JT_INDEX_SCAN already has the call to
'set_keyread'.
Note that a Work log is being created to clean up the
set_keyread calls from places other than access functions.
For now, we are only removing the call from
test_if_skip_sort_order and moving it to
join_init_read_record.
@ sql/sql_executor.cc
Call set_keyread from access function join_init_read_record
@ sql/sql_select.cc
Remove the call to set_keyread from test_if_skip_sort_order
modified:
sql/sql_executor.cc
sql/sql_select.cc
3894 Nuno Carvalho 2012-04-18 [merge]
WL#6236: Allow SHOW MASTER LOGS and SHOW BINARY LOGS with REPLICATION CLIENT
Merge from 5.5 into 5.6.
modified:
mysql-test/suite/binlog/r/binlog_grant.result
mysql-test/suite/binlog/t/binlog_grant.test
sql/sql_parse.cc
=== modified file 'sql/sql_executor.cc'
--- a/sql/sql_executor.cc 2012-04-12 15:31:01 +0000
+++ b/sql/sql_executor.cc 2012-04-18 09:46:51 +0000
@@ -3145,6 +3145,18 @@ int join_init_read_record(JOIN_TAB *tab)
if (init_read_record(&tab->read_record, tab->join->thd, tab->table,
tab->select, 1, 1, FALSE))
return 1;
+ /*
+ set keyread to TRUE if quick index is covering.
+ @todo: Call set_keyread only from access functions. Currently this is
+ also done in make_join_readinfo.
+ */
+ if (tab->select && tab->select->quick)
+ {
+ TABLE *table= tab->table;
+ if(!table->no_keyread && tab->select->quick->index != MAX_KEY //not index merge
+ && table->covering_keys.is_set(tab->select->quick->index))
+ table->set_keyread(true);
+ }
return (*tab->read_record.read_record)(&tab->read_record);
}
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2012-04-18 06:07:33 +0000
+++ b/sql/sql_select.cc 2012-04-18 09:46:51 +0000
@@ -3974,17 +3974,12 @@ check_reverse_order:
bool quick_created=
(select && select->quick && select->quick!=save_quick);
- /*
- If 'best_key' has changed from prev. 'ref_key':
- Update strategy for using index tree reading only
- ('Using index' in EXPLAIN)
+ /*
+ If ref_key used index tree reading only ('Using index' in EXPLAIN),
+ and best_key doesn't, then revert the decision.
*/
- if (best_key != ref_key)
- {
- const bool using_index=
- (table->covering_keys.is_set(best_key) && !table->no_keyread);
- table->set_keyread(using_index);
- }
+ if(!table->covering_keys.is_set(best_key))
+ table->set_keyread(false);
if (!quick_created)
{
if (select) // Throw any existing quick select
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (chaithra.gopalareddy:3894 to 3895)Bug#12713907 WL#5558 | Chaithra Gopalareddy | 20 Apr |