Below is the list of changes that have just been committed into a local
5.0 repository of mhansson. When mhansson 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, 2008-03-19 14:32:28+01:00, mhansson@riffraff.(none) +3 -0
Bug#34529: Crash on complex Falcon I_S select after ALTER .. PARTITION BY
When swapping out heap I_S tables to disk, this is done after plan refinement.
Thus, READ_RECORD::file will still point to the (deleted) heap handler at start
of execution. This causes segmentation fault if join buffering is used and the
query is a star query where the result is found to be empty before accessing
some table. In this case that table has not been initialized (i.e. had its
READ_RECORD re-initialized) before the cleanup routine tries to close the handler.
Fixed by updating READ_RECORD::file when changing handler.
mysql-test/r/information_schema.result@stripped, 2008-03-19 14:32:27+01:00, mhansson@riffraff.(none) +10 -0
Bug#34529: Test result.
mysql-test/t/information_schema.test@stripped, 2008-03-19 14:32:27+01:00, mhansson@riffraff.(none) +21 -0
Bug#34529: Test case.
sql/sql_show.cc@stripped, 2008-03-19 14:32:27+01:00, mhansson@riffraff.(none) +2 -0
Bug#34529: The fix.
diff -Nrup a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
--- a/mysql-test/r/information_schema.result 2007-10-29 11:45:33 +01:00
+++ b/mysql-test/r/information_schema.result 2008-03-19 14:32:27 +01:00
@@ -1422,3 +1422,13 @@ show fields from information_schema.tabl
ERROR 42S02: Unknown table 'table_names' in information_schema
show keys from information_schema.table_names;
ERROR 42S02: Unknown table 'table_names' in information_schema
+USE information_schema;
+SET max_heap_table_size = 16384;
+CREATE TABLE test.t1( a INT );
+SELECT *
+FROM tables ta
+JOIN collations co ON ( co.collation_name = ta.table_catalog )
+JOIN character_sets cs ON ( cs.character_set_name = ta.table_catalog );
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT COLLATION_NAME CHARACTER_SET_NAME ID IS_DEFAULT IS_COMPILED SORTLEN CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN
+DROP TABLE test.t1;
+SET max_heap_table_size = DEFAULT;
diff -Nrup a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
--- a/mysql-test/t/information_schema.test 2007-10-29 11:45:33 +01:00
+++ b/mysql-test/t/information_schema.test 2008-03-19 14:32:27 +01:00
@@ -1118,3 +1118,24 @@ show fields from information_schema.tabl
--error 1109
show keys from information_schema.table_names;
+#
+# Bug#34529: Crash on complex Falcon I_S select after ALTER .. PARTITION BY
+#
+USE information_schema;
+SET max_heap_table_size = 16384;
+
+CREATE TABLE test.t1( a INT );
+
+# What we need to create here is a bit of a corner case:
+# We need a star query with information_schema tables, where the first
+# branch of the star join produces zero rows, so that reading of the
+# second branch never happens. At the same time we have to make sure
+# that data for at least the last table is swapped from MEMORY/HEAP to
+# MyISAM. This and only this triggers the bug.
+SELECT *
+FROM tables ta
+JOIN collations co ON ( co.collation_name = ta.table_catalog )
+JOIN character_sets cs ON ( cs.character_set_name = ta.table_catalog );
+
+DROP TABLE test.t1;
+SET max_heap_table_size = DEFAULT;
diff -Nrup a/sql/sql_show.cc b/sql/sql_show.cc
--- a/sql/sql_show.cc 2007-12-17 09:12:06 +01:00
+++ b/sql/sql_show.cc 2008-03-19 14:32:27 +01:00
@@ -4073,9 +4073,11 @@ bool get_schema_tables_result(JOIN *join
{
result= 1;
join->error= 1;
+ tab->read_record.file= table_list->table->file;
table_list->schema_table_state= executed_place;
break;
}
+ tab->read_record.file= table_list->table->file;
table_list->schema_table_state= executed_place;
}
}