1 message in com.mysql.lists.internalsbk commit - 5.1 tree (mikael:1.2388) ...
FromSent OnAttachments
Mikael Ronström08 May 2006 13:34 
Subject:bk commit - 5.1 tree (mikael:1.2388) BUG#19140
From:Mikael Ronström (mik@mysql.com)
Date:05/08/2006 01:34:33 PM
List:com.mysql.lists.internals

# This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2006/05/08 21:41:10-04:00 mik@c-870ae253.1238-1-64736c10.cust.bredbandsbolaget.se # BUG#19140: Create index caused crash # # sql/sql_table.cc # 2006/05/08 21:41:04-04:00 mik@c-870ae253.1238-1-64736c10.cust.bredbandsbolaget.se +8 -2 # Editorial changes + added a comment to a path in code I didn't remember myself what it was good for. # # sql/sql_partition.cc # 2006/05/08 21:41:04-04:00 mik@c-870ae253.1238-1-64736c10.cust.bredbandsbolaget.se +2 -2 # Use stack variable, not variable on lex object, caused havoc when doing a create index. # # mysql-test/t/partition.test # 2006/05/08 21:41:04-04:00 mik@c-870ae253.1238-1-64736c10.cust.bredbandsbolaget.se +14 -0 # New test case for bug # # mysql-test/t/ndb_partition_key.test # 2006/05/08 21:41:04-04:00 mik@c-870ae253.1238-1-64736c10.cust.bredbandsbolaget.se +7 -0 # New test case to ensure path in code is tested # # mysql-test/r/partition.result # 2006/05/08 21:41:03-04:00 mik@c-870ae253.1238-1-64736c10.cust.bredbandsbolaget.se +5 -0 # New test case for bug # # mysql-test/r/ndb_partition_key.result # 2006/05/08 21:41:03-04:00 mik@c-870ae253.1238-1-64736c10.cust.bredbandsbolaget.se +4 -0 # New test case to ensure path in code is tested # diff -Nru a/mysql-test/r/ndb_partition_key.result b/mysql-test/r/ndb_partition_key.result --- a/mysql-test/r/ndb_partition_key.result 2006-05-08 21:42:08 -04:00 +++ b/mysql-test/r/ndb_partition_key.result 2006-05-08 21:42:08 -04:00 @@ -197,3 +197,7 @@ PARTITION BY KEY(c3); ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1; DROP TABLE t1; +CREATE TABLE t1 (a int) +PARTITION BY KEY(a) +(PARTITION p0 ENGINE = NDB); +DROP TABLE t1; diff -Nru a/mysql-test/r/partition.result b/mysql-test/r/partition.result --- a/mysql-test/r/partition.result 2006-05-08 21:42:08 -04:00 +++ b/mysql-test/r/partition.result 2006-05-08 21:42:08 -04:00 @@ -886,4 +886,9 @@ 2 3 drop table t1; +create table t1 (a int) engine=memory +partition by key(a); +insert into t1 values (1); +create index inx1 on t1(a); +drop table t1; End of 5.1 tests diff -Nru a/mysql-test/t/ndb_partition_key.test b/mysql-test/t/ndb_partition_key.test --- a/mysql-test/t/ndb_partition_key.test 2006-05-08 21:42:08 -04:00 +++ b/mysql-test/t/ndb_partition_key.test 2006-05-08 21:42:08 -04:00 @@ -196,3 +196,10 @@

ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1; DROP TABLE t1; + +CREATE TABLE t1 (a int) +PARTITION BY KEY(a) +(PARTITION p0 ENGINE = NDB); +DROP TABLE t1; + + diff -Nru a/mysql-test/t/partition.test b/mysql-test/t/partition.test --- a/mysql-test/t/partition.test 2006-05-08 21:42:08 -04:00 +++ b/mysql-test/t/partition.test 2006-05-08 21:42:08 -04:00 @@ -9,6 +9,11 @@ drop table if exists t1; --enable_warnings

+create table t1 (a int) +partition by key(a) +(partition p0 engine = MEMORY); +drop table t1; + # # Partition by key no partition defined => OK # @@ -1007,6 +1012,15 @@ insert into t1 values (null); select auto_increment from information_schema.tables where table_name='t1'; select * from t1; +drop table t1; + +# +# BUG 19140 Partitions: Create index for partitioned table crashes +# +create table t1 (a int) engine=memory +partition by key(a); +insert into t1 values (1); +create index inx1 on t1(a); drop table t1;

--echo End of 5.1 tests diff -Nru a/sql/sql_partition.cc b/sql/sql_partition.cc --- a/sql/sql_partition.cc 2006-05-08 21:42:08 -04:00 +++ b/sql/sql_partition.cc 2006-05-08 21:42:08 -04:00 @@ -4509,7 +4509,7 @@ if (alter_info->flags & ALTER_REMOVE_PARTITIONING) { DBUG_PRINT("info", ("Remove partitioning")); - if (!(thd->lex->create_info.used_fields & HA_CREATE_USED_ENGINE)) + if (!(create_info->used_fields & HA_CREATE_USED_ENGINE)) { DBUG_PRINT("info", ("No explicit engine used")); create_info->db_type= table->part_info->default_engine_type; @@ -4526,7 +4526,7 @@ beneath. */ thd->work_part_info= table->part_info; - if (thd->lex->create_info.used_fields & HA_CREATE_USED_ENGINE && + if (create_info->used_fields & HA_CREATE_USED_ENGINE && create_info->db_type != table->part_info->default_engine_type) { /* diff -Nru a/sql/sql_table.cc b/sql/sql_table.cc --- a/sql/sql_table.cc 2006-05-08 21:42:08 -04:00 +++ b/sql/sql_table.cc 2006-05-08 21:42:08 -04:00 @@ -3105,8 +3105,8 @@ } DBUG_PRINT("info", ("db_type = %d",

ha_legacy_type(part_info->default_engine_type))); - if (part_info->check_partition_info( &engine_type, file, - create_info->max_rows)) + if (part_info->check_partition_info(&engine_type, file, + create_info->max_rows)) goto err; part_info->default_engine_type= engine_type;

@@ -3165,6 +3165,12 @@ } else if (create_info->db_type != engine_type) { + /* + We come here when we don't use a partitioned handler. + Since we use a partitioned table it must be "native partitioned". + We have switched engine from defaults, most likely only specified + engines in partition clauses. + */ delete file; if (!(file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root, engine_type))) {

Mikael Ronstrom, Senior Software Architect MySQL AB, www.mysql.com

Jumpstart your cluster: http://www.mysql.com/consulting/packaged/cluster.html My blog: http://mikaelronstrom.blogspot.com