List:Commits« Previous MessageNext Message »
From:Christopher Powers Date:October 23 2008 3:22am
Subject:bzr commit into mysql-6.0-falcon-team branch (cpowers:2878) Bug#40265
View as plain text  
#At file:///home/cpowers/work/dev/dev-09/mysql/

 2878 Christopher Powers	2008-10-22
      Bug#40265, "Falcon: Concurrent online DROP INDEX of the same key causes MySQL
assertion"
      
      Use StorageInterface::alter_table_phase2() to drop index rather than phase1()
      Removed check for primary key in StorageInterface::addIndex() and dropIndex().
modified:
  storage/falcon/ha_falcon.cpp

per-file messages:
  storage/falcon/ha_falcon.cpp
    alter_table_phase1() is intended as the 'prepare to alter' phase, and
alter_table_phase2() is intended to invoke the actual online ALTER.
    Use phase2 instead of phase1 for add/drop index and column.
    
    Removed check for primary key in StorageInterface::addIndex() and dropIndex(). Primary
key support is controlled
    via HA_ADD/DROP_PK_INDEX.
=== modified file 'storage/falcon/ha_falcon.cpp'
--- a/storage/falcon/ha_falcon.cpp	2008-10-22 20:44:09 +0000
+++ b/storage/falcon/ha_falcon.cpp	2008-10-23 01:21:55 +0000
@@ -2153,7 +2153,7 @@ int StorageInterface::check_if_supported
 	HA_ALTER_FLAGS supported;
 	supported = supported | HA_ADD_INDEX | HA_DROP_INDEX | HA_ADD_UNIQUE_INDEX |
HA_DROP_UNIQUE_INDEX;
 						/**
-						| HA_ADD_COLUMN | HA_COLUMN_STORAGE | HA_COLUMN_FORMAT;
+						| HA_ADD_COLUMN | HA_COLUMN_STORAGE | HA_COLUMN_FORMAT | HA_ADD_PK_INDEX |
HA_DROP_PK_INDEX;
 						**/
 	HA_ALTER_FLAGS notSupported = ~(supported);
 	
@@ -2193,9 +2193,21 @@ int StorageInterface::check_if_supported
 	DBUG_RETURN(HA_ALTER_SUPPORTED_NO_LOCK);
 }
 
+// Prepare for online ALTER
+
 int StorageInterface::alter_table_phase1(THD* thd, TABLE* altered_table, HA_CREATE_INFO*
create_info, HA_ALTER_INFO* alter_info, HA_ALTER_FLAGS* alter_flags)
 {
 	DBUG_ENTER("StorageInterface::alter_table_phase1");
+
+	DBUG_RETURN(0);
+}
+
+// Perform the online ALTER
+
+int StorageInterface::alter_table_phase2(THD* thd, TABLE* altered_table, HA_CREATE_INFO*
create_info, HA_ALTER_INFO* alter_info, HA_ALTER_FLAGS* alter_flags)
+{
+	DBUG_ENTER("StorageInterface::alter_table_phase2");
+
 	int ret = 0;
 	
 	if (alter_flags->is_set(HA_ADD_COLUMN))
@@ -2206,16 +2218,11 @@ int StorageInterface::alter_table_phase1
 		
 	if ((alter_flags->is_set(HA_DROP_INDEX) ||
alter_flags->is_set(HA_DROP_UNIQUE_INDEX)) && !ret)
 		ret = dropIndex(thd, altered_table, create_info, alter_info, alter_flags);
-		
+	
 	DBUG_RETURN(ret);
 }
 
-int StorageInterface::alter_table_phase2(THD* thd, TABLE* altered_table, HA_CREATE_INFO*
create_info, HA_ALTER_INFO* alter_info, HA_ALTER_FLAGS* alter_flags)
-{
-	DBUG_ENTER("StorageInterface::alter_table_phase2");
-	
-	DBUG_RETURN(0);
-}
+// Notification that changes are written and table re-opened
 
 int StorageInterface::alter_table_phase3(THD* thd, TABLE* altered_table)
 {
@@ -2277,20 +2284,17 @@ int StorageInterface::addIndex(THD* thd,
 
 	for (unsigned int n = 0; n < alteredTable->s->keys; n++)
 		{
-		if (n != alteredTable->s->primary_key)
-			{
-			KEY *key = alteredTable->key_info + n;
-			KEY *tableEnd = table->key_info + table->s->keys;
-			KEY *tableKey;
+		KEY *key = alteredTable->key_info + n;
+		KEY *tableEnd = table->key_info + table->s->keys;
+		KEY *tableKey;
 			
-			for (tableKey = table->key_info; tableKey < tableEnd; tableKey++)
-				if (!strcmp(tableKey->name, key->name))
-					break;
+		for (tableKey = table->key_info; tableKey < tableEnd; tableKey++)
+			if (!strcmp(tableKey->name, key->name))
+				break;
 					
-			if (tableKey >= tableEnd)
-				if ((ret = createIndex(schemaName, tableName, alteredTable, n)))
-					break;
-			}
+		if (tableKey >= tableEnd)
+			if ((ret = createIndex(schemaName, tableName, alteredTable, n)))
+				break;
 		}
 		
 	// The server indexes may have been reordered, so remap to the Falcon indexes
@@ -2319,20 +2323,17 @@ int StorageInterface::dropIndex(THD* thd
 	
 	for (unsigned int n = 0; n < table->s->keys; n++)
 		{
-		if (n != table->s->primary_key)
-				{
-			KEY *key = table->key_info + n;
-			KEY *alterEnd = alteredTable->key_info + alteredTable->s->keys;
-			KEY *alterKey;
-			
-			for (alterKey = alteredTable->key_info; alterKey < alterEnd; alterKey++)
-				if (!strcmp(alterKey->name, key->name))
-					break;
-
-			if (alterKey >= alterEnd)
-				if ((ret = dropIndex(schemaName, tableName, table, n, true)))
-					break;
-				}
+		KEY *key = table->key_info + n;
+		KEY *alterEnd = alteredTable->key_info + alteredTable->s->keys;
+		KEY *alterKey;
+		
+		for (alterKey = alteredTable->key_info; alterKey < alterEnd; alterKey++)
+			if (!strcmp(alterKey->name, key->name))
+				break;
+
+		if (alterKey >= alterEnd)
+			if ((ret = dropIndex(schemaName, tableName, table, n, true)))
+				break;
 		}
 	
 	// The server indexes have been reordered, so remap to the Falcon indexes

Thread
bzr commit into mysql-6.0-falcon-team branch (cpowers:2878) Bug#40265Christopher Powers23 Oct