List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:February 3 2009 2:19pm
Subject:bzr commit into mysql-5.1-telco-6.3 branch (jonas:2830)
View as plain text  
#At file:///home/jonas/src/telco-6.3/

 2830 Jonas Oreland	2009-02-03 [merge]
      merge 62 to 63
modified:
  mysql-test/r/partition_mgm.result
  mysql-test/suite/parts/r/partition_auto_increment_ndb.result
  mysql-test/t/partition_mgm.test
  sql/sql_partition.cc

=== modified file 'mysql-test/r/partition_mgm.result'
--- a/mysql-test/r/partition_mgm.result	2008-12-10 08:06:58 +0000
+++ b/mysql-test/r/partition_mgm.result	2009-02-03 14:17:59 +0000
@@ -5,6 +5,11 @@ PARTITION BY HASH (a)
 PARTITIONS 1;
 INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
 ALTER TABLE t1 REORGANIZE PARTITION;
+ERROR HY000: REORGANISE PARTITION without parameters can only be used on auto-partitioned tables using HASH PARTITIONs
+ALTER ONLINE TABLE t1 REORGANIZE PARTITION;
+ERROR HY000: REORGANISE PARTITION without parameters can only be used on auto-partitioned tables using HASH PARTITIONs
+ALTER OFFLINE TABLE t1 REORGANIZE PARTITION;
+ERROR HY000: REORGANISE PARTITION without parameters can only be used on auto-partitioned tables using HASH PARTITIONs
 DROP TABLE t1;
 create table t1 (a int)
 partition by range (a)

=== modified file 'mysql-test/suite/parts/r/partition_auto_increment_ndb.result'
--- a/mysql-test/suite/parts/r/partition_auto_increment_ndb.result	2008-11-05 20:13:54 +0000
+++ b/mysql-test/suite/parts/r/partition_auto_increment_ndb.result	2009-02-03 14:17:59 +0000
@@ -122,7 +122,7 @@ INSERT INTO t1 VALUES (NULL);
 DELETE FROM t1 WHERE c1 >= 100;
 OPTIMIZE TABLE t1;
 Table	Op	Msg_type	Msg_text
-test.t1	optimize	note	The storage engine for the table doesn't support optimize
+test.t1	optimize	status	OK
 SHOW CREATE TABLE t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
@@ -389,7 +389,7 @@ INSERT INTO t1 VALUES (NULL);
 DELETE FROM t1 WHERE c1 >= 100;
 OPTIMIZE TABLE t1;
 Table	Op	Msg_type	Msg_text
-test.t1	optimize	note	The storage engine for the table doesn't support optimize
+test.t1	optimize	status	OK
 SHOW CREATE TABLE t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (

=== modified file 'mysql-test/t/partition_mgm.test'
--- a/mysql-test/t/partition_mgm.test	2008-12-10 08:06:58 +0000
+++ b/mysql-test/t/partition_mgm.test	2009-02-03 14:17:59 +0000
@@ -11,7 +11,12 @@ ENGINE MYISAM
 PARTITION BY HASH (a)
 PARTITIONS 1;
 INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
+--error ER_REORG_NO_PARAM_ERROR
 ALTER TABLE t1 REORGANIZE PARTITION;
+--error ER_REORG_NO_PARAM_ERROR
+ALTER ONLINE TABLE t1 REORGANIZE PARTITION;
+--error ER_REORG_NO_PARAM_ERROR
+ALTER OFFLINE TABLE t1 REORGANIZE PARTITION;
 DROP TABLE t1;
 
 #

=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc	2009-01-19 10:49:56 +0000
+++ b/sql/sql_partition.cc	2009-02-03 14:19:14 +0000
@@ -4207,43 +4207,25 @@ uint prep_alter_part_table(THD *thd, TAB
     }
     if (alter_info->flags & ALTER_TABLE_REORG)
     {
-      uint new_part_no, curr_part_no;
+      DBUG_ASSERT(table->s->db_type()->partition_flags);
+      /* 'ALTER TABLE t REORG PARTITION' only allowed with auto partition */
       if (tab_part_info->part_type != HASH_PARTITION ||
-          tab_part_info->use_default_no_partitions)
+          !tab_part_info->use_default_no_partitions ||
+          (table->s->db_type()->partition_flags &&
+           !(table->s->db_type()->partition_flags() & HA_USE_AUTO_PARTITION)))
       {
         my_error(ER_REORG_NO_PARAM_ERROR, MYF(0));
         DBUG_RETURN(TRUE);
       }
-      new_part_no= table->file->get_default_no_partitions(create_info);
-      curr_part_no= tab_part_info->no_parts;
-      if (new_part_no == curr_part_no)
-      {
-        /*
-          No change is needed, we will have the same number of partitions
-          after the change as before. Thus we can reply ok immediately
-          without any changes at all.
-        */
-        *fast_alter_partition= TRUE;
-        DBUG_RETURN(FALSE);
-      }
-      else if (new_part_no > curr_part_no)
-      {
-        /*
-          We will add more partitions, we use the ADD PARTITION without
-          setting the flag for no default number of partitions
-        */
-        alter_info->flags|= ALTER_ADD_PARTITION;
-        thd->work_part_info->no_parts= new_part_no - curr_part_no;
-      }
-      else
-      {
-        /*
-          We will remove hash partitions, we use the COALESCE PARTITION
-          without setting the flag for no default number of partitions
-        */
-        alter_info->flags|= ALTER_COALESCE_PARTITION;
-        alter_info->no_parts= curr_part_no - new_part_no;
-      }
+      DBUG_ASSERT(!alt_part_info ||
+                  alt_part_info->part_type == NOT_A_PARTITION);
+      /*
+        This is really a table operation, handled by native engines.
+        NDB can handle this fast/online. Skip the partitioning path.
+      */
+      if (alt_part_info)
+        thd->work_part_info= NULL;
+      DBUG_RETURN(FALSE);
     }
     if (table->s->db_type()->alter_partition_flags &&
         (!(flags= table->s->db_type()->alter_partition_flags())))

Thread
bzr commit into mysql-5.1-telco-6.3 branch (jonas:2830)Jonas Oreland3 Feb