summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorunknown <mhansson/martin@linux-st28.site>2007-08-15 09:23:44 +0200
committerunknown <mhansson/martin@linux-st28.site>2007-08-15 09:23:44 +0200
commit01f8130aa68392d14f36cc17c01e1b349bf844f5 (patch)
tree2d9eb6b63a9f0e51771e9422008f51c07409e227 /sql/opt_range.cc
parent1f83b351818fca51a14bc34a224c4a80e14c9476 (diff)
downloadmariadb-git-01f8130aa68392d14f36cc17c01e1b349bf844f5.tar.gz
bug#28570: handler::index_read() is called with different find_flag when
ORDER BY is used The range analysis module did not correctly signal to the handler that a range represents a ref (EQ_RANGE flag). This causes non-range queries like SELECT ... FROM ... WHERE keypart_1=const, ..., keypart_n=const ORDER BY ... FOR UPDATE to wait for a lock unneccesarily if another running transaction uses SELECT ... FOR UPDATE on the same table. Fixed by setting EQ_RANGE for all range accesses that represent an equality predicate. mysql-test/r/innodb_mysql.result: bug#28570: Test Result mysql-test/t/innodb_mysql.test: bug#28570: Test Case sql/handler.cc: bug#28570: Updated comment sql/opt_range.cc: bug#28570: Removed the criterion that key has to be unique (HA_NOSAME) in order for the EQ_RANGE flag to be set. It is sufficient that the range represent a ref access.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 247f0eada49..39f0321955d 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -6369,8 +6369,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
range->min_key=range->max_key=(char*) ref->key_buff;
range->min_length=range->max_length=ref->key_length;
range->flag= ((ref->key_length == key_info->key_length &&
- (key_info->flags & (HA_NOSAME | HA_END_SPACE_KEY)) ==
- HA_NOSAME) ? EQ_RANGE : 0);
+ (key_info->flags & HA_END_SPACE_KEY) == 0) ? EQ_RANGE : 0);
if (!(quick->key_parts=key_part=(KEY_PART *)
alloc_root(&quick->alloc,sizeof(KEY_PART)*ref->key_parts)))