2889 Kevin Lewis 2008-10-29
WL#4573 - During recovery, check that each page fetched is marked
as inUse on its pageInventory page, report and fix any that are
not marked.
In theory, this check will never find anything, but in practice, if something
goes wrong, it will notify us of the problem and possibly avoid a recovery
failure.
modified:
storage/falcon/Cache.cpp
storage/falcon/Cache.h
storage/falcon/Dbb.cpp
storage/falcon/Dbb.h
storage/falcon/SerialLog.cpp
=== modified file 'storage/falcon/Cache.cpp'
--- a/storage/falcon/Cache.cpp 2008-10-23 07:58:38 +0000
+++ b/storage/falcon/Cache.cpp 2008-10-30 00:22:54 +0000
@@ -102,6 +102,7 @@ Cache::Cache(Database *db, int pageSz, i
ioThreads = new Thread*[numberIoThreads];
memset(ioThreads, 0, numberIoThreads * sizeof(ioThreads[0]));
flushing = false;
+ recovering = false;
try
{
@@ -221,6 +222,15 @@ Bdb* Cache::fetchPage(Dbb *dbb, int32 pa
#endif
ASSERT (pageNumber >= 0);
+
+ if (recovering && pageType != PAGE_inventory &&
+ !PageInventoryPage::isPageInUse (dbb, pageNumber))
+ {
+ Log::debug ("During recovery, fetched page %d tablespace %d type %d marked free in PIP\n",
+ pageNumber, dbb->tableSpaceId, pageType);
+ PageInventoryPage::markPageInUse(dbb, pageNumber, 0);
+ }
+
int slot = pageNumber % hashSize;
LockType actual = lockType;
Sync sync (&syncObject, "Cache::fetchPage");
=== modified file 'storage/falcon/Cache.h'
--- a/storage/falcon/Cache.h 2008-10-02 22:15:11 +0000
+++ b/storage/falcon/Cache.h 2008-10-30 00:22:54 +0000
@@ -81,6 +81,7 @@ public:
int numberBuffers;
bool panicShutdown;
bool flushing;
+ bool recovering;
protected:
Bdb* findBuffer (Dbb *dbb, int pageNumber, LockType lockType);
=== modified file 'storage/falcon/Dbb.cpp'
--- a/storage/falcon/Dbb.cpp 2008-10-16 02:53:35 +0000
+++ b/storage/falcon/Dbb.cpp 2008-10-30 00:22:54 +0000
@@ -1397,3 +1397,8 @@ void Dbb::updateSerialLogBlockSize(void)
header->serialLogBlockSize = database->serialLogBlockSize;
bdb->release(REL_HISTORY);
}
+
+void Dbb::setCacheRecovering(bool state)
+{
+ cache->recovering = state;
+}
=== modified file 'storage/falcon/Dbb.h'
--- a/storage/falcon/Dbb.h 2008-07-24 08:45:03 +0000
+++ b/storage/falcon/Dbb.h 2008-10-30 00:22:54 +0000
@@ -184,6 +184,7 @@ public:
void printPage(Bdb* bdb);
void updateBlob(Section *blobSection, int recordNumber, Stream* blob, Transaction* transaction);
void updateSerialLogBlockSize(void);
+ void setCacheRecovering(bool state);
Cache *cache;
Database *database;
=== modified file 'storage/falcon/SerialLog.cpp'
--- a/storage/falcon/SerialLog.cpp 2008-10-20 21:28:11 +0000
+++ b/storage/falcon/SerialLog.cpp 2008-10-30 00:22:54 +0000
@@ -217,7 +217,9 @@ void SerialLog::recover()
sync.lock(Exclusive);
recovering = true;
recoveryPhase = 0; // Find last block and recovery block
-
+
+ defaultDbb->setCacheRecovering(true);
+
// See if either or both files have valid blocks
SerialLogWindow *window1 = allocWindow(file1, 0);
@@ -414,7 +416,8 @@ void SerialLog::recover()
info->sectionUseVector.zap();
info->indexUseVector.zap();
}
-
+
+ defaultDbb->setCacheRecovering(false);
Log::log("Recovery complete\n");
recoveryPhase = 0; // Find last lock and recovery block
}
| Thread |
|---|
| • bzr push into mysql-6.0-falcon-team branch (klewis:2889) WL#4573 | Kevin Lewis | 30 Oct |