Commit 5664784f authored by unknown's avatar unknown

Bug #16775: DROP TABLE of subpartitioned table can fail if default engine

used. The problem is that the actual engine was not stored in the .par
file, causing confusion when the default engine was changed. Now the
actual storage engine is stored for subpartitions, as was intended.


mysql-test/r/partition.result:
  Add new results
mysql-test/t/partition.test:
  Add new regression test, marker for end of 5.1 tests
sql/ha_partition.cc:
  Record correct engine type for subpartition parts, and fix use of
  constant for .par extension instead of ha_par_ext variable.
parent c02246c4
...@@ -278,3 +278,11 @@ partition p1 values in (14) ...@@ -278,3 +278,11 @@ partition p1 values in (14)
insert into t1 values (10,1); insert into t1 values (10,1);
ERROR HY000: Table has no partition for value 11 ERROR HY000: Table has no partition for value 11
drop table t1; drop table t1;
set session storage_engine= 'memory';
create table t1 (f_int1 int(11) default null) engine = memory
partition by range (f_int1) subpartition by hash (f_int1)
(partition part1 values less than (1000)
(subpartition subpart11 engine = memory));
set session storage_engine='myisam';
drop table t1;
End of 5.1 tests
...@@ -353,3 +353,15 @@ insert into t1 values (10,1); ...@@ -353,3 +353,15 @@ insert into t1 values (10,1);
drop table t1; drop table t1;
#
# Bug #16775: Wrong engine type stored for subpartition
#
set session storage_engine= 'memory';
create table t1 (f_int1 int(11) default null) engine = memory
partition by range (f_int1) subpartition by hash (f_int1)
(partition part1 values less than (1000)
(subpartition subpart11 engine = memory));
set session storage_engine='myisam';
drop table t1;
--echo End of 5.1 tests
...@@ -1937,7 +1937,8 @@ bool ha_partition::create_handler_file(const char *name) ...@@ -1937,7 +1937,8 @@ bool ha_partition::create_handler_file(const char *name)
name_buffer_ptr+= name_add(name_buffer_ptr, name_buffer_ptr+= name_add(name_buffer_ptr,
part_name, part_name,
subpart_name); subpart_name);
*engine_array= (uchar) ha_legacy_type(part_elem->engine_type); *engine_array= (uchar) ha_legacy_type(subpart_elem->engine_type);
DBUG_PRINT("info", ("engine: %u", *engine_array));
engine_array++; engine_array++;
} }
} }
...@@ -1954,7 +1955,7 @@ bool ha_partition::create_handler_file(const char *name) ...@@ -1954,7 +1955,7 @@ bool ha_partition::create_handler_file(const char *name)
Create and write and close file Create and write and close file
to be used at open, delete_table and rename_table to be used at open, delete_table and rename_table
*/ */
fn_format(file_name, name, "", ".par", MY_APPEND_EXT); fn_format(file_name, name, "", ha_par_ext, MY_APPEND_EXT);
if ((file= my_create(file_name, CREATE_MODE, O_RDWR | O_TRUNC, if ((file= my_create(file_name, CREATE_MODE, O_RDWR | O_TRUNC,
MYF(MY_WME))) >= 0) MYF(MY_WME))) >= 0)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment