Below is the list of changes that have just been committed into a local
5.1 repository of alik. When alik 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@stripped, 2007-10-20 21:48:15+04:00, anozdrin@station. +3 -0
Fix for BUG#31148: bool close_thread_table(THD*, TABLE**):
Assertion `table->key_read == 0' failed.
The problem was that key_read on a table in a sub-select was not
properly reset. That happens because the code responsible for that
is copy&pasted all around the server. In some place, it was obviously
forgotten to be pasted.
The fix is to reset key_read properly.
mysql-test/r/key.result@stripped, 2007-10-20 21:48:13+04:00, anozdrin@station. +15 -0
Update result file.
mysql-test/t/key.test@stripped, 2007-10-20 21:48:13+04:00, anozdrin@station. +23 -0
A test case for BUG#31148: bool close_thread_table(THD*, TABLE**):
Assertion `table->key_read == 0' failed.
sql/sql_select.cc@stripped, 2007-10-20 21:48:13+04:00, anozdrin@station. +8 -1
Reset key_read before closing index.
diff -Nrup a/mysql-test/r/key.result b/mysql-test/r/key.result
--- a/mysql-test/r/key.result 2007-09-20 12:56:24 +04:00
+++ b/mysql-test/r/key.result 2007-10-20 21:48:13 +04:00
@@ -530,3 +530,18 @@ ORDER BY c.b, c.d
a b c d e f g h i j a b c d
2 2 1 2004-11-30 12:00:00 1 0 0 0 0 0 2 3388000 -553000 NULL
DROP TABLE t1, t2;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT PRIMARY KEY AUTO_INCREMENT);
+INSERT INTO t1 VALUES (), (), ();
+SELECT 1 AS c1
+FROM t1
+ORDER BY (
+SELECT 1 AS c2
+FROM t1
+GROUP BY GREATEST(LAST_INSERT_ID(), t1.a) ASC
+LIMIT 1);
+c1
+1
+1
+1
+DROP TABLE t1;
diff -Nrup a/mysql-test/t/key.test b/mysql-test/t/key.test
--- a/mysql-test/t/key.test 2007-06-06 21:48:08 +04:00
+++ b/mysql-test/t/key.test 2007-10-20 21:48:13 +04:00
@@ -501,3 +501,26 @@ ORDER BY c.b, c.d
;
DROP TABLE t1, t2;
+
+#
+# Bug #31148: bool close_thread_table(THD*, TABLE**): Assertion
+# `table->key_read == 0' failed.
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT PRIMARY KEY AUTO_INCREMENT);
+
+INSERT INTO t1 VALUES (), (), ();
+
+SELECT 1 AS c1
+FROM t1
+ORDER BY (
+ SELECT 1 AS c2
+ FROM t1
+ GROUP BY GREATEST(LAST_INSERT_ID(), t1.a) ASC
+ LIMIT 1);
+
+DROP TABLE t1;
diff -Nrup a/sql/sql_select.cc b/sql/sql_select.cc
--- a/sql/sql_select.cc 2007-10-19 02:57:41 +04:00
+++ b/sql/sql_select.cc 2007-10-20 21:48:13 +04:00
@@ -6651,7 +6651,14 @@ void JOIN::cleanup(bool full)
for (tab= join_tab, end= tab+tables; tab != end; tab++)
{
if (tab->table)
- tab->table->file->ha_index_or_rnd_end();
+ {
+ if (tab->table->key_read)
+ {
+ tab->table->key_read= 0;
+ tab->table->file->extra(HA_EXTRA_NO_KEYREAD);
+ }
+ tab->table->file->ha_index_or_rnd_end();
+ }
}
}
}
| Thread |
|---|
| • bk commit into 5.1 tree (anozdrin:1.2595) BUG#31148 | Alexander Nozdrin | 20 Oct |