List:Commits« Previous MessageNext Message »
From:U-ROWVWADEjas Date:June 13 2007 6:20pm
Subject:bk commit into 6.0-falcon tree (jas:1.2568)
View as plain text  
Below is the list of changes that have just been committed into a local
6.0-falcon repository of . When  does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-06-13 14:20:08-04:00, jas@rowvwade. +1 -0
  Recover from lost tip page.

  storage/falcon/PageInventoryPage.cpp@stripped, 2007-06-13 14:20:01-04:00, jas@rowvwade. +22 -5
    Recover from lost tip page.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jas
# Host:	rowvwade.
# Root:	D:/MySQL/mysql-5.1-falcon

--- 1.15/storage/falcon/PageInventoryPage.cpp	2007-06-13 14:20:29 -04:00
+++ 1.16/storage/falcon/PageInventoryPage.cpp	2007-06-13 14:20:29 -04:00
@@ -30,6 +30,7 @@
 #include "SectionPage.h"
 #include "Transaction.h"
 #include "Log.h"
+#include "SQLError.h"
 
 //#define STOP_PAGE	98
 
@@ -130,12 +131,12 @@
 	else
 		pip = pip * dbb->pagesPerPip - 1;
 
-	Bdb *bdb = dbb->fetchPage (pip, PAGE_inventory, Exclusive);
+	Bdb *bdb = dbb->fetchPage(pip, PAGE_inventory, Exclusive);
 	PageInventoryPage *page = (PageInventoryPage*) bdb->buffer;
 	bdb->mark(transId);
-	page->freePages [n / PIP_BITS] |= MASK (n % PIP_BITS);
+	page->freePages[n / PIP_BITS] |= MASK (n % PIP_BITS);
 	bdb->release();
-	dbb->lastPageAllocated = MIN (pageNumber - 1, dbb->lastPageAllocated);
+	dbb->lastPageAllocated = MIN(pageNumber - 1, dbb->lastPageAllocated);
 }
 
 void PageInventoryPage::markPageInUse(Dbb *dbb, int32 pageNumber, TransId transId)
@@ -332,14 +333,29 @@
 {
 	for (int32 pip = dbb->lastPageAllocated / dbb->pagesPerPip;; ++pip)
 		{
-		Bdb *bdb = dbb->fetchPage (
+		Bdb *bdb = dbb->trialFetch(
 						(pip == 0) ? PIP_PAGE : pip * dbb->pagesPerPip - 1,
 						 PAGE_inventory, Shared);
+		
+		if (!bdb)
+			{
+			Log::log("Recoverying from lost page inventory page %d", pip);			
+			--pip;
+			
+			if (pip == 0)
+				throw SQLError(DATABASE_CORRUPTION, "Transaction inventory page not found");
+
+			bdb = dbb->trialFetch(pip * dbb->pagesPerPip - 1, PAGE_inventory, Exclusive);
+			bdb->mark(NO_TRANSACTION);
+			PageInventoryPage *page = (PageInventoryPage*) bdb->buffer;
+			page->freePages[dbb->pipSlots - 1] |= MASK(PIP_BITS - 1);
+			}
+
 		PageInventoryPage *page = (PageInventoryPage*) bdb->buffer;
 		int32 mask;
 		
 		for (int slot = dbb->pipSlots - 1; slot >= 0; --slot)
-			if ((mask = page->freePages [slot]) != -1)
+			if ((mask = page->freePages[slot]) != -1)
 				for (int n = PIP_BITS - 1; n >= 0; --n)
 					if (!(mask & MASK (n)))
 						{
@@ -349,6 +365,7 @@
 							goto nextPip;
 							
 						bdb->release();
+						
 						return pageNumber + 1;
 						}
 						
Thread
bk commit into 6.0-falcon tree (jas:1.2568)U-ROWVWADEjas13 Jun