List:Commits« Previous MessageNext Message »
From:Mattias Jonsson Date:February 3 2009 6:38am
Subject:bzr commit into mysql-5.1-telco-6.4 branch (mattias.jonsson:3239)
Bug#40389 Bug#41945
View as plain text  
#At file:///Users/mattiasj/clones/bzrroot/mysql-5.1-telco-6.4/ based on revid:tomas.ulin@stripped

 3239 Mattias Jonsson	2009-02-03
      Bug#41945: cluster reorg part on single partition segv in mysqld
      refix of
      Bug #40389: REORGANIZE PARTITION crashes when only using one partition
      
      Problem was a remaining partition info struct that was not cleared,
      resulting in an inconsitent .frm-file
      
      Solution was to only allow REORGANIZE PARTITION on auto partitioned
      native engines, such as NDB, and not trying to do any partitioning
      specific.
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

per-file messages:
  mysql-test/r/partition_mgm.result
    Bug #40389: REORGANIZE PARTITION crashes when only using one partition
    
    Updated test result
  mysql-test/suite/parts/r/partition_auto_increment_ndb.result
    Updated test result, not really a part of this bug.
  mysql-test/t/partition_mgm.test
    Bug #40389: REORGANIZE PARTITION crashes when only using one partition
    
    Updated test
  sql/sql_partition.cc
    Bug#41945: cluster reorg part on single partition segv in mysqld
    
    'ALTER TABLE t REORGANIZE PARTITION' is not a partitioning
    altering call, it should only work directly on the table on
    a auto partitioned native engine (NDB).
    
    Removed the partitioning related code and resetting the work_part_info
    so that it does not leave a incomplete part_info for a later
    create_altered_table.
=== 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 06:38:23 +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 06:38:23 +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 06:38:23 +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 14:40:33 +0000
+++ b/sql/sql_partition.cc	2009-02-03 06:38:23 +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.4 branch (mattias.jonsson:3239)Bug#40389 Bug#41945Mattias Jonsson3 Feb