2771 Christopher Powers 2009-08-25
Bug#46670 "ALTER TABLE crashes in StorageTableShare::haveIndexes()"
Rewrote StorageTableShare::haveIndexes() to more effectively check for
the need to remap Falcon indexes
modified:
storage/falcon/StorageTableShare.cpp
storage/falcon/StorageTableShare.h
storage/falcon/ha_falcon.cpp
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
2769 Kevin Lewis 2009-08-25 [merge]
merge
modified:
storage/falcon/IndexRootPage.cpp
=== 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 03:45:23 +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;
}
}
@@ -457,16 +462,18 @@ void StorageTableShare::deleteIndexes()
indexes = indexDesc->next;
delete indexDesc;
}
+
+ indexCount = 0;
}
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 +574,26 @@ int StorageTableShare::getIndexId(const
return -1;
}
-int StorageTableShare::haveIndexes(int indexCount)
+int StorageTableShare::remapNeeded(int numIndexes)
{
- if (!indexes)
+ // Server and Falcon mismatch
+
+ if (numIndexes != indexCount)
+ return true;
+
+ // Neither server nor Falcon have indexes
+
+ if (!indexes && numIndexes == 0)
return false;
- return true;
+ // Both server and Falcon have indexes
- // Assume ::indexes is locked
-
- /***
- int n = 0;
- for (StorageIndexDesc *indexDesc = indexes; indexDesc; indexDesc = indexDesc->next, n++)
- {
- if (!indexDesc->index)
- return false;
- }
-
- return (n == indexCount);
- ***/
+ if (indexes && numIndexes > 0)
+ return false;
+
+ // Index count is inconsistent with index state
+
+ return true;
}
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 03:45:23 +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 remapNeeded(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 03:45:23 +0000
@@ -2739,7 +2739,7 @@ int StorageInterface::setIndexes(TABLE *
{
int ret = 0;
- if (!srvTable)
+ if (!srvTable || !storageShare->remapNeeded(srvTable->s->keys))
return ret;
storageShare->lockIndexes(true);
| Thread |
|---|
| • bzr push into mysql branch (christopher.powers:2769 to 2771) Bug#46670 | Christopher Powers | 26 Aug |