#At file:///home/cpowers/work/dev/dev-09/mysql/
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
per-file messages:
storage/falcon/StorageTable.cpp
Added 'online' param to StorageTable::dropIndex()
storage/falcon/StorageTable.h
Added 'online' param to StorageTable::dropIndex()
storage/falcon/StorageTableShare.cpp
Added 'online' param to StorageTableShare::dropIndex()
If the operation is online and if the error is StorageErrorNoIndex (index not found),
then ignore the error and return.
Also, only update the Falcon/server index mapping if StorageDatabase::dropIndex() was
successful.
storage/falcon/StorageTableShare.h
Added 'online' param to StorageTableShare::dropIndex()
storage/falcon/ha_falcon.cpp
Added 'online' param to StorageInterface::dropIndex()
Pass 'online = true' to StorageTable::dropIndex() from alter_table_phase1().
Only remap Falcon/server indexes if drop index was successful.
storage/falcon/ha_falcon.h
Added 'online' param to StorageInterface::dropIndex()
=== 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-22 20:44:09 +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();
@@ -2329,7 +2330,7 @@ int StorageInterface::dropIndex(THD* thd
break;
if (alterKey >= alterEnd)
- if ((ret = dropIndex(schemaName, tableName, table, n)))
+ if ((ret = dropIndex(schemaName, tableName, table, n, true)))
break;
}
}
=== 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 commit into mysql-6.0-falcon-team branch (cpowers:2877) Bug#40265 | Christopher Powers | 22 Oct |