From: Ann W. Harrison Date: October 17 2008 3:26pm Subject: Review patch for WL4573? List-Archive: http://lists.mysql.com/falcon/41 Message-Id: <48F8AE96.5060003@mysql.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary_(ID_OHe/sQaC0bGZDZghdH+exg)" --Boundary_(ID_OHe/sQaC0bGZDZghdH+exg) Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7BIT This was originally sent to Chris, but I realize that changes should have more than one reviewer ... I've coded and tested the changes described in WL4573. The intention of the patch is to recognize and fix any pages that are fetched during recovery but aren't marked as in use on the PIP. If Falcon fetches a page, it should be in use. Although the patch is in a critical area, it's very simple, and will help us diagnose databases that were accessed by a version of Falcon that had the incorrect cache flush code. The check should be done only during recovery because it will affect performance. Until now, Cache didn't know that recovery was going on, so some code had to be added to Dbb to set a new boolean value in Cache indicating that recovery is in process. Best regards Ann --Boundary_(ID_OHe/sQaC0bGZDZghdH+exg) Content-type: text/plain; name=WL4573.txt Content-transfer-encoding: 7BIT Content-disposition: inline; filename=WL4573.txt === modified file 'storage/falcon/Cache.cpp' --- old/storage/falcon/Cache.cpp 2008-10-02 23:06:04 +0000 +++ new/storage/falcon/Cache.cpp 2008-10-09 18:02:20 +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' --- old/storage/falcon/Cache.h 2008-10-02 22:15:11 +0000 +++ new/storage/falcon/Cache.h 2008-10-09 17:28:43 +0000 @@ -61,6 +61,7 @@ public: void ioThread(void); void shutdownThreads(void); bool continueWrite(Bdb* startingBdb); + bool recovering; static void ioThread(void* arg); === modified file 'storage/falcon/Dbb.cpp' --- old/storage/falcon/Dbb.cpp 2008-08-07 21:11:55 +0000 +++ new/storage/falcon/Dbb.cpp 2008-10-09 17:28:43 +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; +} \ No newline at end of file === modified file 'storage/falcon/Dbb.h' --- old/storage/falcon/Dbb.h 2008-07-24 08:45:03 +0000 +++ new/storage/falcon/Dbb.h 2008-10-09 17:28:43 +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' --- old/storage/falcon/SerialLog.cpp 2008-09-03 22:17:54 +0000 +++ new/storage/falcon/SerialLog.cpp 2008-10-09 17:28:43 +0000 @@ -216,6 +216,8 @@ void SerialLog::recover() Sync sync(&syncWrite, "SerialLog::recover"); sync.lock(Exclusive); recovering = true; + defaultDbb->setCacheRecovering(true); + recoveryPhase = 0; // Find last block and recovery block // See if either or both files have valid blocks @@ -415,6 +417,7 @@ void SerialLog::recover() info->indexUseVector.zap(); } + defaultDbb->setCacheRecovering(false); Log::log("Recovery complete\n"); recoveryPhase = 0; // Find last lock and recovery block } --Boundary_(ID_OHe/sQaC0bGZDZghdH+exg)--