Maybe you should change the local talbespaceid variables to
recordTableSpaceId in order to preserve the naming convention for Falcon
variables.
Other than that, OK to push
Vladislav Vaintroub wrote:
> #At file:///G:/bzr/mysql-6.0-falcon-team/
>
> 2912 Vladislav Vaintroub 2008-11-14
> Bug#39789 : Falcon recovery failure after several CREATE + DROP TABLESPACE
>
> The problem in this specific situation was removal of datafiles in
> SRLDropTable
> space::redo(),even if tablespace with the same datafile path in use by another
>
> tablespace instance.
>
> The fix reimplements create/dropTablespace handling in recovery in
> a manner consistent with the rest of Falcon recovery.
>
> - pass1(check) of recovery collects information about what tablespaces
> are dropped at the end
>
> - pass2 and redo skip any reference to dropped tablespace
> (except for SRLDropTableSpace record)
>
> - tablespace (not marked as dropped) are created during
> pass2 of recovery
>
> - tablspaces marked as dropped are "redropped" in phase2 of recovery
> i.e removed from memory structures (hashtables and lists).
> Datafile that is possibly left over in previous session is deleted
> as well.
>
> This patch moves tableSpaceId from classes derived from SerialLogRecord
> to the parent class, for technical reasons - it is much simpler to check
> if log record should be skipped in different recovery phases.
> modified:
> storage/falcon/PageInventoryPage.cpp
> storage/falcon/SRLBlobDelete.h
> storage/falcon/SRLBlobUpdate.h
> storage/falcon/SRLCreateIndex.h
> storage/falcon/SRLCreateSection.h
> storage/falcon/SRLCreateTableSpace.cpp
> storage/falcon/SRLCreateTableSpace.h
> storage/falcon/SRLData.h
> storage/falcon/SRLDelete.h
> storage/falcon/SRLDeleteIndex.cpp
> storage/falcon/SRLDeleteIndex.h
> storage/falcon/SRLDropTableSpace.cpp
> storage/falcon/SRLDropTableSpace.h
> storage/falcon/SRLFreePage.h
> storage/falcon/SRLIndexAdd.h
> storage/falcon/SRLIndexDelete.h
> storage/falcon/SRLIndexPage.h
> storage/falcon/SRLInversionPage.h
> storage/falcon/SRLOverflowPages.h
> storage/falcon/SRLRecordLocator.h
> storage/falcon/SRLRecordStub.h
> storage/falcon/SRLSectionLine.h
> storage/falcon/SRLSectionPage.h
> storage/falcon/SRLSectionPromotion.h
> storage/falcon/SRLSequencePage.h
> storage/falcon/SRLUpdateBlob.h
> storage/falcon/SRLUpdateIndex.h
> storage/falcon/SRLUpdateRecords.cpp
> storage/falcon/SRLUpdateRecords.h
> storage/falcon/SerialLog.cpp
> storage/falcon/SerialLog.h
> storage/falcon/SerialLogRecord.cpp
> storage/falcon/SerialLogRecord.h
>
> per-file messages:
> storage/falcon/PageInventoryPage.cpp
> Check no page allocations are done in phase2 of recovery
> storage/falcon/SRLBlobDelete.h
> moved tableSpaceId to parent class
> storage/falcon/SRLBlobUpdate.h
> moved tableSpaceId to parent class
> storage/falcon/SRLCreateIndex.h
> moved tableSpaceId to parent class
> storage/falcon/SRLCreateSection.h
> moved tableSpaceId to parent class
> storage/falcon/SRLCreateTableSpace.cpp
> create tablespace in phase2 of recovery
> storage/falcon/SRLCreateTableSpace.h
> moved tableSpaceId to parent class
> storage/falcon/SRLData.h
> moved tableSpaceId to parent class
> storage/falcon/SRLDelete.h
> moved tableSpaceId to parent class
> storage/falcon/SRLDeleteIndex.cpp
> Move redoing deleteIndex to SRLDeleteIndex::redo() from pass1()
> storage/falcon/SRLDeleteIndex.h
> moved tableSpaceId to parent class
> storage/falcon/SRLDropTableSpace.cpp
> expunge tablespace in pass2, not in redo
> storage/falcon/SRLDropTableSpace.h
> moved tableSpaceId to parent class
> storage/falcon/SRLFreePage.h
> moved tableSpaceId to parent class
> storage/falcon/SRLIndexAdd.h
> moved tableSpaceId to parent class
> storage/falcon/SRLIndexDelete.h
> moved tableSpaceId to parent class
> storage/falcon/SRLIndexPage.h
> moved tableSpaceId to parent class
> storage/falcon/SRLInversionPage.h
> moved tableSpaceId to parent class
> storage/falcon/SRLOverflowPages.h
> moved tableSpaceId to parent class
> storage/falcon/SRLRecordLocator.h
> moved tableSpaceId to parent class
> storage/falcon/SRLRecordStub.h
> moved tableSpaceId to parent class
> storage/falcon/SRLSectionLine.h
> moved tableSpaceId to parent class
> storage/falcon/SRLSectionPage.h
> moved tableSpaceId to parent class
> storage/falcon/SRLSectionPromotion.h
> moved tableSpaceId to parent class
> storage/falcon/SRLSequencePage.h
> moved tableSpaceId to parent class
> storage/falcon/SRLUpdateBlob.h
> moved tableSpaceId to parent class
> storage/falcon/SRLUpdateIndex.h
> moved tableSpaceId to parent class
> storage/falcon/SRLUpdateRecords.cpp
> skip updates to tablespaces that are dropped.
>
> rename local tableSpaceId variables to lowercase tablespaceid,
> to avoid confusion with class member
> storage/falcon/SRLUpdateRecords.h
> moved tableSpaceId to parent class
> storage/falcon/SerialLog.cpp
> skip records referencing dropped tablespaces in phase2 and redo of recovery
> storage/falcon/SerialLogRecord.cpp
> Initialize tableSpaceId in constructor
> storage/falcon/SerialLogRecord.h
> new class member tableSpaceId, moved here from derived classes
> === modified file 'storage/falcon/PageInventoryPage.cpp'
> --- a/storage/falcon/PageInventoryPage.cpp 2008-06-17 17:41:54 +0000
> +++ b/storage/falcon/PageInventoryPage.cpp 2008-11-14 02:30:11 +0000
> @@ -31,6 +31,8 @@
> #include "Transaction.h"
> #include "Log.h"
> #include "SQLError.h"
> +#include "SerialLog.h"
> +#include "Database.h"
>
> #ifdef _DEBUG
> #undef THIS_FILE
> @@ -80,6 +82,8 @@ Bdb* PageInventoryPage::createInventoryP
>
> Bdb* PageInventoryPage::allocPage(Dbb * dbb, PageType pageType, TransId transId)
> {
> + SerialLog *serialLog = dbb->database->serialLog;
> + ASSERT(!(serialLog->recovering && (serialLog->recoveryPhase ==2)));
> for (int32 pip = dbb->lastPageAllocated / dbb->pagesPerPip;; ++pip)
> {
> int32 pipPageNumber = (pip == 0) ? PIP_PAGE : pip * dbb->pagesPerPip - 1;
>
> === modified file 'storage/falcon/SRLBlobDelete.h'
> --- a/storage/falcon/SRLBlobDelete.h 2007-09-20 15:44:25 +0000
> +++ b/storage/falcon/SRLBlobDelete.h 2008-11-14 02:30:11 +0000
> @@ -29,8 +29,7 @@ public:
> void pass2(void);
> void redo(void);
> void print(void);
> -
> - int tableSpaceId;
> +
> int32 locatorPage;
> int locatorLine;
> int32 dataPage;
>
> === modified file 'storage/falcon/SRLBlobUpdate.h'
> --- a/storage/falcon/SRLBlobUpdate.h 2007-09-20 15:44:25 +0000
> +++ b/storage/falcon/SRLBlobUpdate.h 2008-11-14 02:30:11 +0000
> @@ -39,7 +39,6 @@ public:
> virtual void pass2(void);
> virtual void redo(void);
>
> - int tableSpaceId;
> int32 sectionId;
> int32 locatorPage;
> int locatorLine;
>
> === modified file 'storage/falcon/SRLCreateIndex.h'
> --- a/storage/falcon/SRLCreateIndex.h 2007-09-20 15:44:25 +0000
> +++ b/storage/falcon/SRLCreateIndex.h 2008-11-14 02:30:11 +0000
> @@ -38,7 +38,6 @@ public:
> virtual void read();
> virtual void commit(void);
>
> - int tableSpaceId;
> int32 indexId;
> int indexVersion;
> };
>
> === modified file 'storage/falcon/SRLCreateSection.h'
> --- a/storage/falcon/SRLCreateSection.h 2007-09-20 15:44:25 +0000
> +++ b/storage/falcon/SRLCreateSection.h 2008-11-14 02:30:11 +0000
> @@ -39,7 +39,6 @@ public:
> SRLCreateSection();
> virtual ~SRLCreateSection();
>
> - int tableSpaceId;
> int sectionId;
> };
>
>
> === modified file 'storage/falcon/SRLCreateTableSpace.cpp'
> --- a/storage/falcon/SRLCreateTableSpace.cpp 2008-07-17 13:52:17 +0000
> +++ b/storage/falcon/SRLCreateTableSpace.cpp 2008-11-14 02:30:11 +0000
> @@ -85,14 +85,14 @@ void SRLCreateTableSpace::read()
>
> void SRLCreateTableSpace::pass1()
> {
> - TableSpaceInit tsInit;
> - tsInit.comment = comment;
> - log->database->tableSpaceManager->redoCreateTableSpace(tableSpaceId,
> nameLength, name, filenameLength, filename, type, &tsInit);
> +
> }
>
> void SRLCreateTableSpace::pass2()
> {
> -
> + TableSpaceInit tsInit;
> + tsInit.comment = comment;
> + log->database->tableSpaceManager->redoCreateTableSpace(tableSpaceId,
> nameLength, name, filenameLength, filename, type, &tsInit);
> }
>
> void SRLCreateTableSpace::commit()
>
> === modified file 'storage/falcon/SRLCreateTableSpace.h'
> --- a/storage/falcon/SRLCreateTableSpace.h 2008-07-17 13:52:17 +0000
> +++ b/storage/falcon/SRLCreateTableSpace.h 2008-11-14 02:30:11 +0000
> @@ -44,7 +44,6 @@ public:
>
> const char *name;
> const char *filename;
> - int tableSpaceId;
> int nameLength;
> int filenameLength;
> int type;
>
> === modified file 'storage/falcon/SRLData.h'
> --- a/storage/falcon/SRLData.h 2007-10-16 19:40:17 +0000
> +++ b/storage/falcon/SRLData.h 2008-11-14 02:30:11 +0000
> @@ -44,7 +44,6 @@ public:
>
> void append(Dbb *dbb, Transaction *transaction, int32 sectionId, int32 recordId,
> Stream *stream);
>
> - int tableSpaceId;
> int32 sectionId;
> int32 recordId;
> int32 length;
>
> === modified file 'storage/falcon/SRLDelete.h'
> --- a/storage/falcon/SRLDelete.h 2007-09-20 15:44:25 +0000
> +++ b/storage/falcon/SRLDelete.h 2008-11-14 02:30:11 +0000
> @@ -40,7 +40,6 @@ public:
> SRLDelete();
> virtual ~SRLDelete();
>
> - int tableSpaceId;
> int32 sectionId;
> int32 recordId;
> int32 length;
>
> === modified file 'storage/falcon/SRLDeleteIndex.cpp'
> --- a/storage/falcon/SRLDeleteIndex.cpp 2008-07-15 18:57:27 +0000
> +++ b/storage/falcon/SRLDeleteIndex.cpp 2008-11-14 02:30:11 +0000
> @@ -72,8 +72,14 @@ void SRLDeleteIndex::read()
> void SRLDeleteIndex::pass1()
> {
> log->bumpIndexIncarnation(indexId, tableSpaceId, objDeleted);
> - Dbb *dbb = log->findDbb(tableSpaceId);
> +}
> +
> +void SRLDeleteIndex::redo()
> +{
> + if (!log->bumpIndexIncarnation(indexId, tableSpaceId, objDeleted))
> + return;
>
> + Dbb *dbb = log->findDbb(tableSpaceId);
> if (!dbb)
> return;
>
> @@ -92,12 +98,6 @@ void SRLDeleteIndex::pass1()
> }
> }
>
> -void SRLDeleteIndex::redo()
> -{
> - if (!log->bumpIndexIncarnation(indexId, tableSpaceId, objDeleted))
> - return;
> -}
> -
> void SRLDeleteIndex::print()
> {
> logPrint("Delete Index %d\n", indexId);
>
> === modified file 'storage/falcon/SRLDeleteIndex.h'
> --- a/storage/falcon/SRLDeleteIndex.h 2007-09-20 15:44:25 +0000
> +++ b/storage/falcon/SRLDeleteIndex.h 2008-11-14 02:30:11 +0000
> @@ -38,7 +38,6 @@ public:
> void append(Dbb *dbb, TransId transId, int indexId, int idxVersion);
> void print();
>
> - int tableSpaceId;
> int32 indexId;
> int indexVersion;
> };
>
> === modified file 'storage/falcon/SRLDropTableSpace.cpp'
> --- a/storage/falcon/SRLDropTableSpace.cpp 2008-06-08 22:12:35 +0000
> +++ b/storage/falcon/SRLDropTableSpace.cpp 2008-11-14 02:30:11 +0000
> @@ -63,14 +63,16 @@ void SRLDropTableSpace::read()
> transactionId = 0;
> }
>
> +
> void SRLDropTableSpace::pass1()
> {
> -
> + log->setTableSpaceDropped(tableSpaceId);
> }
>
> void SRLDropTableSpace::pass2()
> {
>
> + log->tableSpaceManager->expungeTableSpace(tableSpaceId);
> }
>
> void SRLDropTableSpace::commit()
> @@ -80,5 +82,4 @@ void SRLDropTableSpace::commit()
>
> void SRLDropTableSpace::redo()
> {
> - log->tableSpaceManager->expungeTableSpace(tableSpaceId);
> }
>
> === modified file 'storage/falcon/SRLDropTableSpace.h'
> --- a/storage/falcon/SRLDropTableSpace.h 2007-09-20 15:44:25 +0000
> +++ b/storage/falcon/SRLDropTableSpace.h 2008-11-14 02:30:11 +0000
> @@ -42,7 +42,6 @@ public:
> virtual void read();
> void append (TableSpace *tableSpace, Transaction *transaction);
>
> - int tableSpaceId;
> };
>
> #endif //
> !defined(AFX_SRLDROPTABLESPACE_H__3A416C47_6B8F_49CC_9471_B9F75D024B12__INCLUDED_)
>
> === modified file 'storage/falcon/SRLFreePage.h'
> --- a/storage/falcon/SRLFreePage.h 2007-09-20 15:44:25 +0000
> +++ b/storage/falcon/SRLFreePage.h 2008-11-14 02:30:11 +0000
> @@ -41,7 +41,6 @@ public:
>
> void append (Dbb *dbb, int32 pageNumber);
>
> - int tableSpaceId;
> int32 pageNumber;
> int incarnation;
> };
>
> === modified file 'storage/falcon/SRLIndexAdd.h'
> --- a/storage/falcon/SRLIndexAdd.h 2007-09-20 15:44:25 +0000
> +++ b/storage/falcon/SRLIndexAdd.h 2008-11-14 02:30:11 +0000
> @@ -39,7 +39,6 @@ public:
> SRLIndexAdd();
> virtual ~SRLIndexAdd();
>
> - int tableSpaceId;
> int32 indexId;
> int32 recordId;
> int32 length;
>
> === modified file 'storage/falcon/SRLIndexDelete.h'
> --- a/storage/falcon/SRLIndexDelete.h 2007-09-20 15:44:25 +0000
> +++ b/storage/falcon/SRLIndexDelete.h 2008-11-14 02:30:11 +0000
> @@ -38,7 +38,6 @@ public:
> SRLIndexDelete();
> virtual ~SRLIndexDelete();
>
> - int tableSpaceId;
> int32 indexId;
> int32 recordId;
> int32 length;
>
> === modified file 'storage/falcon/SRLIndexPage.h'
> --- a/storage/falcon/SRLIndexPage.h 2008-02-13 18:45:15 +0000
> +++ b/storage/falcon/SRLIndexPage.h 2008-11-14 02:30:11 +0000
> @@ -38,7 +38,6 @@ public:
> SRLIndexPage();
> virtual ~SRLIndexPage();
>
> - int tableSpaceId;
> int indexVersion;
> int32 pageNumber;
> int32 parent;
>
> === modified file 'storage/falcon/SRLInversionPage.h'
> --- a/storage/falcon/SRLInversionPage.h 2007-09-20 15:44:25 +0000
> +++ b/storage/falcon/SRLInversionPage.h 2008-11-14 02:30:11 +0000
> @@ -38,7 +38,6 @@ public:
> SRLInversionPage();
> virtual ~SRLInversionPage();
>
> - int tableSpaceId;
> int32 pageNumber;
> int32 parent;
> int32 prior;
>
> === modified file 'storage/falcon/SRLOverflowPages.h'
> --- a/storage/falcon/SRLOverflowPages.h 2007-09-20 15:44:25 +0000
> +++ b/storage/falcon/SRLOverflowPages.h 2008-11-14 02:30:11 +0000
> @@ -32,7 +32,6 @@ public:
> virtual void redo(void);
> virtual void print(void);
>
> - int tableSpaceId;
> int dataLength;
> const UCHAR* data;
> };
>
> === modified file 'storage/falcon/SRLRecordLocator.h'
> --- a/storage/falcon/SRLRecordLocator.h 2007-09-20 15:44:25 +0000
> +++ b/storage/falcon/SRLRecordLocator.h 2008-11-14 02:30:11 +0000
> @@ -39,7 +39,6 @@ public:
> SRLRecordLocator();
> virtual ~SRLRecordLocator();
>
> - int tableSpaceId;
> int sectionId;
> int sequence;
> int32 pageNumber;
>
> === modified file 'storage/falcon/SRLRecordStub.h'
> --- a/storage/falcon/SRLRecordStub.h 2007-09-20 15:44:25 +0000
> +++ b/storage/falcon/SRLRecordStub.h 2008-11-14 02:30:11 +0000
> @@ -37,7 +37,6 @@ public:
> SRLRecordStub();
> virtual ~SRLRecordStub();
>
> - int tableSpaceId;
> int32 sectionId;
> int32 recordId;
>
>
> === modified file 'storage/falcon/SRLSectionLine.h'
> --- a/storage/falcon/SRLSectionLine.h 2007-09-20 15:44:25 +0000
> +++ b/storage/falcon/SRLSectionLine.h 2008-11-14 02:30:11 +0000
> @@ -31,7 +31,6 @@ public:
> virtual void redo(void);
> virtual void print(void);
>
> - int tableSpaceId;
> int32 pageNumber;
> int32 dataPageNumber;
> };
>
> === modified file 'storage/falcon/SRLSectionPage.h'
> --- a/storage/falcon/SRLSectionPage.h 2007-09-20 15:44:25 +0000
> +++ b/storage/falcon/SRLSectionPage.h 2008-11-14 02:30:11 +0000
> @@ -38,7 +38,6 @@ public:
> SRLSectionPage();
> virtual ~SRLSectionPage();
>
> - int tableSpaceId;
> int32 parentPage;
> int32 pageNumber;
> int sectionSlot;
>
> === modified file 'storage/falcon/SRLSectionPromotion.h'
> --- a/storage/falcon/SRLSectionPromotion.h 2007-09-20 15:44:25 +0000
> +++ b/storage/falcon/SRLSectionPromotion.h 2008-11-14 02:30:11 +0000
> @@ -30,7 +30,6 @@ public:
> virtual void pass2(void);
> virtual void redo(void);
>
> - int tableSpaceId;
> int sectionId;
> int length;
> int32 rootPageNumber;
>
> === modified file 'storage/falcon/SRLSequencePage.h'
> --- a/storage/falcon/SRLSequencePage.h 2007-09-20 15:44:25 +0000
> +++ b/storage/falcon/SRLSequencePage.h 2008-11-14 02:30:11 +0000
> @@ -30,7 +30,6 @@ public:
> virtual void redo(void);
>
> int pageSequence;
> - int tableSpaceId;
> int32 pageNumber;
> virtual void print(void);
> };
>
> === modified file 'storage/falcon/SRLUpdateBlob.h'
> --- a/storage/falcon/SRLUpdateBlob.h 2007-10-16 19:40:17 +0000
> +++ b/storage/falcon/SRLUpdateBlob.h 2008-11-14 02:30:11 +0000
> @@ -35,7 +35,6 @@ public:
>
> const UCHAR *data;
> int recordNumber;
> - int tableSpaceId;
> int length;
> int sectionId;
> };
>
> === modified file 'storage/falcon/SRLUpdateIndex.h'
> --- a/storage/falcon/SRLUpdateIndex.h 2007-09-20 15:44:25 +0000
> +++ b/storage/falcon/SRLUpdateIndex.h 2008-11-14 02:30:11 +0000
> @@ -39,7 +39,6 @@ public:
> void append(DeferredIndex* deferredIndex);
> void thaw(DeferredIndex* deferredIndex);
>
> - int tableSpaceId;
> int indexId;
> const UCHAR *data;
> const UCHAR *ptr;
>
> === modified file 'storage/falcon/SRLUpdateRecords.cpp'
> --- a/storage/falcon/SRLUpdateRecords.cpp 2008-11-09 01:44:58 +0000
> +++ b/storage/falcon/SRLUpdateRecords.cpp 2008-11-14 02:30:11 +0000
> @@ -84,10 +84,10 @@ int SRLUpdateRecords::thaw(RecordVersion
> // Get section id, record id and data length written. Input pointer will be at
> // beginning of record data.
>
> - int tableSpaceId = 0;
> + int tablespaceid = 0;
>
> if (control->version >= srlVersion8)
> - tableSpaceId = control->getInt();
> + tablespaceid = control->getInt();
>
> control->getInt(); // sectionId
> int recordNumber = control->getInt();
> @@ -179,7 +179,7 @@ void SRLUpdateRecords::append(Transactio
> break;
>
> Table *table = record->format->table;
> - tableSpaceId = table->dbb->tableSpaceId;
> + int tablespaceid = table->dbb->tableSpaceId;
> Stream stream;
>
> // A non-zero virtual offset indicates that the record was previously
> @@ -227,7 +227,7 @@ void SRLUpdateRecords::append(Transactio
> // Ensure record fits within current window
>
> if (log->writePtr +
> - byteCount(tableSpaceId) +
> + byteCount(tablespaceid) +
> byteCount(table->dataSectionId) +
> byteCount(record->recordNumber) +
> byteCount(stream.totalLength) + stream.totalLength >= end)
> @@ -240,9 +240,9 @@ void SRLUpdateRecords::append(Transactio
>
> record->setVirtualOffset(log->writeWindow->currentLength +
> log->writeWindow->virtualOffset);
> uint32 sectionId = table->dataSectionId;
> - log->updateSectionUseVector(sectionId, tableSpaceId, 1);
> + log->updateSectionUseVector(sectionId, tablespaceid, 1);
>
> - putInt(tableSpaceId);
> + putInt(tablespaceid);
> putInt(record->getPriorVersion() ? sectionId : -(int) sectionId - 1);
> putInt(record->recordNumber);
> putStream(&stream);
> @@ -303,23 +303,25 @@ void SRLUpdateRecords::redo(void)
> if (transaction->state == sltCommitted)
> for (const UCHAR *p = data, *end = data + dataLength; p < end;)
> {
> + int tablespaceid;
> if (control->version >= srlVersion8)
> - tableSpaceId = getInt(&p);
> + tablespaceid = getInt(&p);
> else
> - tableSpaceId = 0;
> + tablespaceid = 0;
>
> int id = getInt(&p);
> uint sectionId = (id >= 0) ? id : -id - 1;
> int recordNumber = getInt(&p);
> int length = getInt(&p);
> - log->updateSectionUseVector(sectionId, tableSpaceId, -1);
> + log->updateSectionUseVector(sectionId, tablespaceid, -1);
>
> if (log->traceRecord && recordNumber == log->traceRecord)
> print();
>
> - if (log->bumpSectionIncarnation(sectionId, tableSpaceId, objInUse))
> + if (log->bumpSectionIncarnation(sectionId, tablespaceid, objInUse)
> + && (!log->isTableSpaceDropped(tablespaceid)))
> {
> - Dbb *dbb = log->getDbb(tableSpaceId);
> + Dbb *dbb = log->getDbb(tablespaceid);
>
> if (length)
> {
> @@ -346,16 +348,20 @@ void SRLUpdateRecords::pass1(void)
>
> for (const UCHAR *p = data, *end = data + dataLength; p < end;)
> {
> + int tablespaceid;
> if (control->version >= srlVersion8)
> - tableSpaceId = getInt(&p);
> + tablespaceid = getInt(&p);
> else
> - tableSpaceId = 0;
> -
> + tablespaceid = 0;
> +
> int id = getInt(&p);
> uint sectionId = (id >= 0) ? id : -id - 1;
> getInt(&p); // recordNumber
> int length = getInt(&p);
> - log->bumpSectionIncarnation(sectionId, tableSpaceId, objInUse);
> +
> + if (!log->isTableSpaceDropped(tablespaceid))
> + log->bumpSectionIncarnation(sectionId, tablespaceid, objInUse);
> +
> p += length;
> }
> }
> @@ -380,20 +386,21 @@ void SRLUpdateRecords::commit(void)
>
> for (const UCHAR *p = data, *end = data + dataLength; p < end;)
> {
> + int tablespaceid;
> if (control->version >= srlVersion8)
> - tableSpaceId = getInt(&p);
> + tablespaceid = getInt(&p);
> else
> - tableSpaceId = 0;
> + tablespaceid = 0;
>
> int id = getInt(&p);
> uint sectionId = (id >= 0) ? id : -id - 1;
> int recordNumber = getInt(&p);
> int length = getInt(&p);
> - log->updateSectionUseVector(sectionId, tableSpaceId, -1);
> + log->updateSectionUseVector(sectionId, tablespaceid, -1);
>
> - if (log->isSectionActive(sectionId, tableSpaceId))
> + if (log->isSectionActive(sectionId, tablespaceid))
> {
> - Dbb *dbb = log->getDbb(tableSpaceId);
> + Dbb *dbb = log->getDbb(tablespaceid);
>
> if (length)
> {
> @@ -415,10 +422,11 @@ void SRLUpdateRecords::print(void)
>
> for (const UCHAR *p = data, *end = data + dataLength; p < end;)
> {
> + int tablespaceid;
> if (control->version >= srlVersion8)
> - tableSpaceId = getInt(&p);
> + tablespaceid = getInt(&p);
> else
> - tableSpaceId = 0;
> + tablespaceid = 0;
>
> int id = getInt(&p);
> uint sectionId = (id >= 0) ? id : -id - 1;
> @@ -426,7 +434,7 @@ void SRLUpdateRecords::print(void)
> int length = getInt(&p);
> char temp[40];
> Log::debug(" rec %d, len %d to section %d/%d %s\n",
> - recordNumber, length, sectionId, tableSpaceId, format(length, p, sizeof(temp),
> temp));
> + recordNumber, length, sectionId, tablespaceid, format(length, p, sizeof(temp),
> temp));
> p += length;
> }
> }
>
> === modified file 'storage/falcon/SRLUpdateRecords.h'
> --- a/storage/falcon/SRLUpdateRecords.h 2008-02-14 21:06:10 +0000
> +++ b/storage/falcon/SRLUpdateRecords.h 2008-11-14 02:30:11 +0000
> @@ -37,7 +37,6 @@ public:
> int thaw(RecordVersion *record, bool *thawed);
>
> const UCHAR *data;
> - int tableSpaceId;
> int savepointId;
> int dataLength;
> };
>
> === modified file 'storage/falcon/SerialLog.cpp'
> --- a/storage/falcon/SerialLog.cpp 2008-10-30 00:22:54 +0000
> +++ b/storage/falcon/SerialLog.cpp 2008-11-14 02:30:11 +0000
> @@ -344,7 +344,8 @@ void SerialLog::recover()
> // Next, make a second pass to reallocate any necessary pages
>
> while ( (record = control.nextRecord()) )
> - record->pass2();
> + if (!isTableSpaceDropped(record->tableSpaceId) || record->type ==
> srlDropTableSpace)
> + record->pass2();
>
> recoveryPages->reset();
> recoveryIndexes->reset();
> @@ -362,8 +363,10 @@ void SerialLog::recover()
> // Make a third pass doing things
>
> while ( (record = control.nextRecord()) )
> - record->redo();
> -
> + if (!isTableSpaceDropped(record->tableSpaceId))
> + record->redo();
> +
> +
> for (SerialLogTransaction *action, **ptr = &running.first; (action = *ptr);)
> if (action->completedRecovery())
> {
> @@ -400,6 +403,7 @@ void SerialLog::recover()
> recoveryPages = NULL;
> recoveryIndexes = NULL;
> recoverySections = NULL;
> + droppedTablespaces.clear();
>
> for (window = firstWindow; window; window = window->next)
> if (!(window->inUse == 0 || window == writeWindow))
> @@ -1150,7 +1154,7 @@ bool SerialLog::bumpPageIncarnation(int3
>
> bool ret = recoveryPages->bumpIncarnation(pageNumber, tableSpaceId, state,
> pass1);
>
> - if (ret && pass1)
> + if (ret && recoveryPhase==2)
> {
> Dbb *dbb = getDbb(tableSpaceId);
> dbb->reallocPage(pageNumber);
> @@ -1285,6 +1289,18 @@ void SerialLog::setIndexInactive(int id,
> recoveryIndexes->setInactive(id, tableSpaceId);
> }
>
> +void SerialLog::setTableSpaceDropped(int tableSpaceId)
> +{
> + ASSERT(recovering);
> + droppedTablespaces.set(tableSpaceId);
> +}
> +
> +bool SerialLog::isTableSpaceDropped(int tableSpaceId)
> +{
> + ASSERT(recovering);
> + return droppedTablespaces.isSet(tableSpaceId);
> +}
> +
> bool SerialLog::sectionInUse(int sectionId, int tableSpaceId)
> {
> TableSpaceInfo *info = getTableSpaceInfo(tableSpaceId);
> @@ -1461,6 +1477,7 @@ void SerialLog::printWindows(void)
>
> Dbb* SerialLog::getDbb(int tableSpaceId)
> {
> + ASSERT(recoveryPhase != 1);
> if (tableSpaceId == 0)
> return defaultDbb;
>
> @@ -1469,6 +1486,7 @@ Dbb* SerialLog::getDbb(int tableSpaceId)
>
> Dbb* SerialLog::findDbb(int tableSpaceId)
> {
> + ASSERT(recoveryPhase != 1);
> if (tableSpaceId == 0)
> return defaultDbb;
>
>
> === modified file 'storage/falcon/SerialLog.h'
> --- a/storage/falcon/SerialLog.h 2008-10-20 21:28:11 +0000
> +++ b/storage/falcon/SerialLog.h 2008-11-14 02:30:11 +0000
> @@ -29,6 +29,7 @@
> #include "Stack.h"
> #include "DenseArray.h"
> #include "Queue.h"
> +#include "Bitmap.h"
>
> static const unsigned int altLogFlag = 0x80000000;
> static const int srlSignature = 123456789;
> @@ -126,6 +127,8 @@ public:
> void setSectionInactive(int id, int tableSpaceId);
> void setIndexActive(int id, int tableSpaceId);
> void setIndexInactive(int id, int tableSpaceId);
> + void setTableSpaceDropped(int tableSpaceId);
> + bool isTableSpaceDropped(int tableSpaceId);
> void updateSectionUseVector(uint sectionId, int tableSpaceId, int delta);
> void updateIndexUseVector(uint indexId, int tableSpaceId, int delta);
> bool sectionInUse(int sectionId, int tableSpaceId);
> @@ -170,6 +173,7 @@ public:
> RecoveryObjects *recoveryPages;
> RecoveryObjects *recoverySections;
> RecoveryObjects *recoveryIndexes;
> + Bitmap droppedTablespaces;
> Dbb *defaultDbb;
> Gopher *gophers;
> Thread *srlQueue;
>
> === modified file 'storage/falcon/SerialLogRecord.cpp'
> --- a/storage/falcon/SerialLogRecord.cpp 2008-11-11 22:33:27 +0000
> +++ b/storage/falcon/SerialLogRecord.cpp 2008-11-14 02:30:11 +0000
> @@ -100,6 +100,7 @@ int init()
> SerialLogRecord::SerialLogRecord()
> {
> transactionId = 0;
> + tableSpaceId = 0;
> type = 0;
> }
>
> @@ -268,6 +269,8 @@ SerialLogTransaction* SerialLogRecord::g
> return transaction;
> }
>
> +
> +
> void SerialLogRecord::pass1()
> {
>
> @@ -323,3 +326,4 @@ void SerialLogRecord::logPrint(const cha
> else
> printf("Log %s", temp);
> }
> +
>
> === modified file 'storage/falcon/SerialLogRecord.h'
> --- a/storage/falcon/SerialLogRecord.h 2008-11-11 22:33:27 +0000
> +++ b/storage/falcon/SerialLogRecord.h 2008-11-14 02:30:11 +0000
> @@ -111,6 +111,7 @@ public:
> SerialLog *log;
> SerialLogControl *control;
> TransId transactionId;
> + int tableSpaceId;
> UCHAR type;
> };
>
>
>