Below is the list of changes that have just been committed into a local
4.1 repository of svoj. When svoj does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2502 06/06/16 21:38:36 svoj@stripped +3 -0
BUG#20357 - Got error 124 from storage engine using MIN and MAX
functions in queries
Using MAX()/MIN() on table with disabled indexes (by ALTER TABLE)
results in error 124 (wrong index) from storage engine.
The problem was that optimizer use disabled index to optimize
MAX()/MIN(). Nromally it must skip disabled index and perform
table scan.
This patch skips disabled indexes for min/max optimization.
sql/opt_sum.cc
1.46 06/06/16 21:38:31 svoj@stripped +6 -1
Skip disabled indexes for min/max optimization.
mysql-test/t/myisam.test
1.46 06/06/16 21:38:31 svoj@stripped +10 -0
Test case for BUG#20357.
mysql-test/r/myisam.result
1.60 06/06/16 21:38:31 svoj@stripped +7 -0
Test case for BUG#20357.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: svoj
# Host: may.pils.ru
# Root: /home/svoj/devel/mysql/BUG20357/mysql-4.1
--- 1.45/sql/opt_sum.cc 2005-09-25 23:22:20 +05:00
+++ 1.46/sql/opt_sum.cc 2006-06-16 21:38:31 +05:00
@@ -679,7 +679,12 @@ static bool find_key_for_maxmin(bool max
part != part_end ;
part++, jdx++, key_part_to_use= (key_part_to_use << 1) | 1)
{
- if (!(table->file->index_flags(idx, jdx, 0) & HA_READ_ORDER))
+ /*
+ Perform a check if index is not disabled by ALTER TABLE
+ and is usable for min/max function.
+ */
+ if (!table->keys_in_use.is_set(idx) ||
+ !(table->file->index_flags(idx, jdx, 0) & HA_READ_ORDER))
return 0;
if (field->eq(part->field))
--- 1.59/mysql-test/r/myisam.result 2006-03-10 18:03:00 +04:00
+++ 1.60/mysql-test/r/myisam.result 2006-06-16 21:38:31 +05:00
@@ -748,3 +748,10 @@ select count(id1) from t1 where id2 = 10
count(id1)
5
drop table t1;
+CREATE TABLE t1(a TINYINT, KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES(1);
+ALTER TABLE t1 DISABLE KEYS;
+SELECT MAX(a) FROM t1;
+MAX(a)
+1
+DROP TABLE t1;
--- 1.45/mysql-test/t/myisam.test 2006-03-10 18:03:00 +04:00
+++ 1.46/mysql-test/t/myisam.test 2006-06-16 21:38:31 +05:00
@@ -705,4 +705,14 @@ select count(*) from t1 where id2 = 10
select count(id1) from t1 where id2 = 10;
drop table t1;
+#
+# BUG##20357 - Got error 124 from storage engine using MIN and MAX functions
+# in queries
+#
+CREATE TABLE t1(a TINYINT, KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES(1);
+ALTER TABLE t1 DISABLE KEYS;
+SELECT MAX(a) FROM t1;
+DROP TABLE t1;
+
# End of 4.1 tests
| Thread |
|---|
| • bk commit into 4.1 tree (svoj:1.2502) BUG#20357 | Sergey Vojtovich | 16 Jun |