List:Commits« Previous MessageNext Message »
From:Christopher Powers Date:October 23 2008 3:24am
Subject:bzr push into mysql-6.0-falcon-team branch (cpowers:2876 to 2878) Bug#40265
View as plain text  
 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

 2877 Christopher Powers	2008-10-22
      Bug#40265, "Falcon: Concurrent online DROP INDEX of the same key causes MySQL
assertion"
      
      Improve handling of concurrent online drop index of the same key.
modified:
  storage/falcon/StorageTable.cpp
  storage/falcon/StorageTable.h
  storage/falcon/StorageTableShare.cpp
  storage/falcon/StorageTableShare.h
  storage/falcon/ha_falcon.cpp
  storage/falcon/ha_falcon.h

 2876 Hakan Kuecuekyilmaz	2008-10-22 [merge]
      Merged:
          mysql-6.0 --> mysql-6.0-falcon --> mysql-6.0-falcon-team
modified:
  .bzrignore
  include/errmsg.h
  libmysql/errmsg.c
  libmysql/libmysql.c
  libmysqld/libmysqld.c
  mysql-test/r/create.result
  mysql-test/r/log_tables.result
  mysql-test/r/mysql.result
  mysql-test/r/partition.result
  mysql-test/r/partition_innodb.result
  mysql-test/r/plugin.result
  mysql-test/r/sp.result
  mysql-test/r/storage_engine_basic.result
  mysql-test/r/variables.result
  mysql-test/suite/falcon/r/falcon_bugs.result
  mysql-test/suite/falcon/t/falcon_bugs.test
  mysql-test/t/sp.test
  mysys/my_largepage.c
  scripts/make_win_bin_dist
  sql-common/client.c
  sql/backup/backup_info.cc
  sql/backup/backup_info.h
  sql/backup/backup_kernel.h
  sql/backup/backup_test.cc
  sql/backup/error.h
  sql/backup/kernel.cc
  sql/backup/logger.cc
  sql/backup/logger.h
  sql/log.cc
  sql/mysql_priv.h
  sql/mysqld.cc
  sql/share/errmsg.txt
  sql/si_objects.cc
  sql/si_objects.h
  sql/sql_class.cc
  sql/sql_table.cc
  storage/falcon/NNode.h
  storage/falcon/StorageVersion.h
  storage/falcon/Types.h
  storage/falcon/ha_falcon.cpp
  storage/falcon/plug.in
  support-files/my-huge.cnf.sh
  support-files/my-large.cnf.sh
  support-files/my-medium.cnf.sh
  support-files/my-small.cnf.sh
  support-files/mysql.spec.sh
  tests/mysql_client_test.c

=== modified file 'storage/falcon/StorageTable.cpp'
--- a/storage/falcon/StorageTable.cpp	2008-10-14 13:00:31 +0000
+++ b/storage/falcon/StorageTable.cpp	2008-10-22 20:44:09 +0000
@@ -146,9 +146,9 @@ int StorageTable::createIndex(StorageInd
 	return share->createIndex(storageConnection, indexDesc, sql);
 }
 
-int StorageTable::dropIndex(StorageIndexDesc *indexDesc, const char *sql)
+int StorageTable::dropIndex(StorageIndexDesc *indexDesc, const char *sql, bool online)
 {
-	return share->dropIndex(storageConnection, indexDesc, sql);
+	return share->dropIndex(storageConnection, indexDesc, sql, online);
 }
 
 int StorageTable::next(int recordNumber, bool lockForUpdate)

=== modified file 'storage/falcon/StorageTable.h'
--- a/storage/falcon/StorageTable.h	2008-08-22 06:47:40 +0000
+++ b/storage/falcon/StorageTable.h	2008-10-22 20:44:09 +0000
@@ -95,7 +95,7 @@ public:
 	
 	virtual int		updateRow(int recordNumber);
 	virtual int		createIndex(StorageIndexDesc *indexDesc, const char *sql);
-	virtual int		dropIndex(StorageIndexDesc *indexDesc, const char *sql);
+	virtual int		dropIndex(StorageIndexDesc *indexDesc, const char *sql, bool online);
 	virtual const unsigned char* getEncoding(int fieldIndex);
 	virtual const char*			 getName(void);
 	virtual const char*			 getSchemaName(void);

=== modified file 'storage/falcon/StorageTableShare.cpp'
--- a/storage/falcon/StorageTableShare.cpp	2008-09-10 04:02:07 +0000
+++ b/storage/falcon/StorageTableShare.cpp	2008-10-22 20:44:09 +0000
@@ -382,7 +382,7 @@ void StorageTableShare::deleteIndex(int 
 			}
 }
 
-int StorageTableShare::dropIndex(StorageConnection *storageConnection, StorageIndexDesc
*indexDesc, const char *sql)
+int StorageTableShare::dropIndex(StorageConnection *storageConnection, StorageIndexDesc
*indexDesc, const char *sql, bool online)
 {
 	if (!table)
 		open();
@@ -397,7 +397,15 @@ int StorageTableShare::dropIndex(Storage
 	
 	int ret = storageDatabase->dropIndex(storageConnection, table, sql);
 	
-	deleteIndex(indexDesc->id);
+	// If index not found during online drop index, do not return an error
+	
+	if (ret == StorageErrorNoIndex && online)
+		ret = 0;
+		
+	// Remove index description from index mapping
+	
+	if (!ret)
+		deleteIndex(indexDesc->id);
 				
 	return ret;
 }

=== modified file 'storage/falcon/StorageTableShare.h'
--- a/storage/falcon/StorageTableShare.h	2008-10-14 13:00:31 +0000
+++ b/storage/falcon/StorageTableShare.h	2008-10-22 20:44:09 +0000
@@ -115,7 +115,7 @@ public:
 	virtual void		lockIndexes(bool exclusiveLock=false);
 	virtual void		unlockIndexes(void);
 	virtual int			createIndex(StorageConnection *storageConnection, StorageIndexDesc
*indexDesc, const char *sql);
-	virtual int			dropIndex(StorageConnection *storageConnection, StorageIndexDesc
*indexDesc, const char *sql);
+	virtual int			dropIndex(StorageConnection *storageConnection, StorageIndexDesc
*indexDesc, const char *sql, bool online);
 	virtual bool		validateIndex(int indexId, StorageIndexDesc *indexTarget);
 	virtual void		deleteIndexes();
 	virtual int			numberIndexes();

=== modified file 'storage/falcon/ha_falcon.cpp'
--- a/storage/falcon/ha_falcon.cpp	2008-10-22 12:01:16 +0000
+++ b/storage/falcon/ha_falcon.cpp	2008-10-23 01:21:55 +0000
@@ -902,7 +902,7 @@ int StorageInterface::createIndex(const 
 	return storageTable->createIndex(&indexDesc, sql);
 }
 
-int StorageInterface::dropIndex(const char *schemaName, const char *tableName, TABLE
*table, int indexId)
+int StorageInterface::dropIndex(const char *schemaName, const char *tableName, TABLE
*table, int indexId, bool online)
 {
 	StorageIndexDesc indexDesc;
 	getKeyDesc(table, indexId, &indexDesc);
@@ -911,7 +911,7 @@ int StorageInterface::dropIndex(const ch
 	gen.gen("drop index %s.\"%s\"", schemaName, indexDesc.name);
 	const char *sql = gen.getString();
 
-	return storageTable->dropIndex(&indexDesc, sql);
+	return storageTable->dropIndex(&indexDesc, sql, online);
 }
 
 #if 0
@@ -1548,6 +1548,7 @@ int StorageInterface::rename_table(const
 
 	ret = storageShare->renameTable(storageConnection, to);
 	
+	if (!ret)
 	remapIndexes(table);
 	
 	storageShare->unlock();
@@ -2152,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);
 	
@@ -2192,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))
@@ -2205,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)
 {
@@ -2276,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
@@ -2318,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;
+		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)))
-					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

=== modified file 'storage/falcon/ha_falcon.h'
--- a/storage/falcon/ha_falcon.h	2008-10-16 02:53:35 +0000
+++ b/storage/falcon/ha_falcon.h	2008-10-22 20:44:09 +0000
@@ -114,7 +114,7 @@ public:
 
 	void			getDemographics(void);
 	int				createIndex(const char *schemaName, const char *tableName, TABLE *table, int
indexId);
-	int				dropIndex(const char *schemaName, const char *tableName, TABLE *table, int
indexId);
+	int				dropIndex(const char *schemaName, const char *tableName, TABLE *table, int
indexId, bool online);
 	void			getKeyDesc(TABLE *table, int indexId, StorageIndexDesc *indexInfo);
 	void			startTransaction(void);
 	bool			threadSwitch(THD *newThread);

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