#At file:///home/cpowers/work/dev/dev-07/mysql/
2770 Christopher Powers 2009-08-25
Bug#44670 "ALTER TABLE crashes in StorageTableShare::haveIndexes()"
Restore call to modified StorageTableShare::haveIndexes() to avoid deadlock.
modified:
storage/falcon/StorageTableShare.cpp
storage/falcon/StorageTableShare.h
storage/falcon/ha_falcon.cpp
per-file messages:
storage/falcon/StorageTableShare.cpp
StorageTableShare - Maintain index count rather than iterate
through ::indexes to determine if the number of indexes
has changed.
storage/falcon/StorageTableShare.h
StorageTableShare - Addex indexCount
storage/falcon/ha_falcon.cpp
StorageInterface::setIndexes()
Restore call to haveIndexes() to avoid deadlocks.
=== modified file 'storage/falcon/StorageTableShare.cpp'
--- a/storage/falcon/StorageTableShare.cpp 2009-08-05 03:09:13 +0000
+++ b/storage/falcon/StorageTableShare.cpp 2009-08-26 02:50:47 +0000
@@ -140,6 +140,7 @@ StorageTableShare::StorageTableShare(Sto
tempTable = tempTbl;
setPath(path);
indexes = NULL;
+ indexCount = 0;
if (tempTable)
tableSpace = TEMPORARY_TABLESPACE;
@@ -378,6 +379,7 @@ void StorageTableShare::addIndex(Storage
}
indexes = indexDesc;
+ indexCount++;
}
}
@@ -394,7 +396,10 @@ void StorageTableShare::deleteIndex(int
if (indexDesc->next)
indexDesc->next->prev = indexDesc->prev;
- delete indexDesc;
+ delete indexDesc;
+
+ if (indexCount > 0)
+ indexCount--;
break;
}
}
@@ -461,12 +466,12 @@ void StorageTableShare::deleteIndexes()
int StorageTableShare::numberIndexes()
{
- int indexCount = 0;
+ int numIndexes = 0;
- for (StorageIndexDesc *indexDesc = indexes; indexDesc; indexDesc = indexDesc->next, indexCount++)
+ for (StorageIndexDesc *indexDesc = indexes; indexDesc; indexDesc = indexDesc->next, numIndexes++)
;
- return indexCount;
+ return numIndexes;
}
int StorageTableShare::renameTable(StorageConnection *storageConnection, const char* newName)
@@ -567,25 +572,12 @@ int StorageTableShare::getIndexId(const
return -1;
}
-int StorageTableShare::haveIndexes(int indexCount)
+int StorageTableShare::haveIndexes(int numIndexes)
{
- if (!indexes)
+ if (!indexes || numIndexes != indexCount)
return false;
return true;
-
- // Assume ::indexes is locked
-
- /***
- int n = 0;
- for (StorageIndexDesc *indexDesc = indexes; indexDesc; indexDesc = indexDesc->next, n++)
- {
- if (!indexDesc->index)
- return false;
- }
-
- return (n == indexCount);
- ***/
}
uint64 StorageTableShare::getSequenceValue(int delta)
=== modified file 'storage/falcon/StorageTableShare.h'
--- a/storage/falcon/StorageTableShare.h 2009-06-28 18:58:38 +0000
+++ b/storage/falcon/StorageTableShare.h 2009-08-26 02:50:47 +0000
@@ -146,7 +146,7 @@ public:
virtual int renameTable(StorageConnection *storageConnection, const char* newName);
virtual uint64 getSequenceValue(int delta);
virtual int setSequenceValue(uint64 value);
- virtual int haveIndexes(int indexCount);
+ virtual int haveIndexes(int numIndexes);
virtual const char* cleanupFieldName(const char* name, char* buffer, int bufferLength, bool doubleQuotes);
virtual void setTablePath(const char* path, bool tempTable);
virtual void registerCollation(const char* collationName, void* arg);
@@ -196,6 +196,7 @@ public:
Sequence *sequence;
Format *format; // format for insertion
bool tempTable;
+ int indexCount;
int getFieldId(const char* fieldName);
};
=== modified file 'storage/falcon/ha_falcon.cpp'
--- a/storage/falcon/ha_falcon.cpp 2009-08-05 23:37:42 +0000
+++ b/storage/falcon/ha_falcon.cpp 2009-08-26 02:50:47 +0000
@@ -2739,7 +2739,7 @@ int StorageInterface::setIndexes(TABLE *
{
int ret = 0;
- if (!srvTable)
+ if (!srvTable || !storageShare->haveIndexes(srvTable->s->keys))
return ret;
storageShare->lockIndexes(true);
| Thread |
|---|
| • bzr commit into mysql-6.0-falcon-team branch (christopher.powers:2770)Bug#44670 | Christopher Powers | 26 Aug |