List:Commits« Previous MessageNext Message »
From:Vladislav Vaintroub Date:January 26 2009 4:01pm
Subject:bzr commit into mysql-6.0-falcon-team branch (vvaintroub:2974)
Bug#42060
View as plain text  
#At file:///G:/bzr/pip/ based on revid:vvaintroub@stripped

 2974 Vladislav Vaintroub	2009-01-26
      Bug#42060 : Crash in recovery with the message - wrong page type, expected 8 got 0
      The crash happens when recovery finds a page that is supposed to be PageInventoryPage
      but the page is empty(zeroed)
      
      Cause:
      Prior to crash, inventory page was created but it was not written to disk.
      But, another page with larger page number was flushed. as a result, inventory page
      is filled with zeroes.
      
      Fix:
      Log creation of the inventory pages. On recovery, recreate then if they are zeroed.
added:
  storage/falcon/SRLInventoryPage.cpp
  storage/falcon/SRLInventoryPage.h
modified:
  storage/falcon/CMakeLists.txt
  storage/falcon/Makefile.am
  storage/falcon/PageInventoryPage.cpp
  storage/falcon/SRLVersion.h
  storage/falcon/SerialLogControl.cpp
  storage/falcon/SerialLogControl.h
  storage/falcon/SerialLogRecord.h

per-file messages:
  storage/falcon/CMakeLists.txt
    New files SRLInventoryPage.cpp  and SRLInventoryPage.h
  storage/falcon/Makefile.am
    New files SRLInventoryPage.cpp  and SRLInventoryPage.h
  storage/falcon/PageInventoryPage.cpp
    Log creation of inventory page. recovery will recreate it if it was not flushed
    on checkpoint
  storage/falcon/SRLInventoryPage.cpp
    new log record type SRLInventoryPage to
    track creation of inventory pages
  storage/falcon/SRLInventoryPage.h
    new log record type SRLInventoryPage to
    track creation of inventory pages
  storage/falcon/SRLVersion.h
    Increment the serial log version (new log record type)
  storage/falcon/SerialLogControl.cpp
    new log record type SRLInventoryPage
  storage/falcon/SerialLogControl.h
    new log record type SRLInventoryPage
  storage/falcon/SerialLogRecord.h
    new log Record type SRLInventoryPage
=== modified file 'storage/falcon/CMakeLists.txt'
--- a/storage/falcon/CMakeLists.txt	2008-10-31 18:02:34 +0000
+++ b/storage/falcon/CMakeLists.txt	2009-01-26 16:01:22 +0000
@@ -242,6 +242,7 @@ SET(FALCON_SOURCES 
 		SRLIndexDelete.cpp
 		SRLIndexPage.cpp
 		SRLIndexUpdate.cpp
+		SRLInventoryPage.cpp
 		SRLInversionPage.cpp
 		SRLOverflowPages.cpp
 		SRLPrepare.cpp 
@@ -522,6 +523,7 @@ SET(FALCON_SOURCES 
 		SRLIndexAdd.h
 		SRLIndexDelete.h
 		SRLIndexPage.h
+		SRLInventoryPage.h
 		SRLInversionPage.h
 		SRLIndexUpdate.h
 		SRLOverflowPages.h

=== modified file 'storage/falcon/Makefile.am'
--- a/storage/falcon/Makefile.am	2008-12-07 13:00:15 +0000
+++ b/storage/falcon/Makefile.am	2009-01-26 16:01:22 +0000
@@ -152,6 +152,7 @@ falcon_headers= Agent.h Alias.h Applicat
 		SRLIndexDelete.h \
 		SRLIndexPage.h \
 		SRLIndexUpdate.h \
+		SRLInventoryPage.h \
 		SRLInversionPage.h \
 		SRLOverflowPages.h \
 		SRLPrepare.h \
@@ -335,6 +336,7 @@ falcon_sources= Agent.cpp Alias.cpp \
 		SRLIndexDelete.cpp \
 		SRLIndexPage.cpp \
 		SRLIndexUpdate.cpp \
+		SRLInventoryPage.cpp \
 		SRLInversionPage.cpp \
 		SRLOverflowPages.cpp \
 		SRLPrepare.cpp \

=== modified file 'storage/falcon/PageInventoryPage.cpp'
--- a/storage/falcon/PageInventoryPage.cpp	2008-11-14 02:30:11 +0000
+++ b/storage/falcon/PageInventoryPage.cpp	2009-01-26 16:01:22 +0000
@@ -33,6 +33,7 @@
 #include "SQLError.h"
 #include "SerialLog.h"
 #include "Database.h"
+#include "SerialLogControl.h"
 
 #ifdef _DEBUG
 #undef THIS_FILE
@@ -77,6 +78,9 @@ Bdb* PageInventoryPage::createInventoryP
 	for (int n = 0; n < dbb->pipSlots; ++n)
 		page->freePages [n] = -1;
 
+	if (dbb->database->serialLog && !dbb->database->serialLog->recovering)
+		dbb->database->serialLog->logControl->inventoryPage.append(dbb, pageNumber);
+
 	return bdb;
 }
 

=== added file 'storage/falcon/SRLInventoryPage.cpp'
--- a/storage/falcon/SRLInventoryPage.cpp	1970-01-01 00:00:00 +0000
+++ b/storage/falcon/SRLInventoryPage.cpp	2009-01-26 16:01:22 +0000
@@ -0,0 +1,87 @@
+/* Copyright 2009 Sun Microsystems, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+*/
+
+#include "Engine.h"
+#include "SRLInventoryPage.h"
+#include "PageInventoryPage.h"
+#include "SerialLogControl.h"
+#include "Dbb.h"
+#include "Bdb.h"
+#include "Page.h"
+#include "Log.h"
+
+// Recreate inventory page if it is zeroed. Zeroed pages are possible
+// in recovery, when the page was created, but not flushed
+void SRLInventoryPage::pass2()
+{
+	Dbb *dbb = log->getDbb(tableSpaceId);
+	Bdb *bdb = dbb->trialFetch(pageNumber, PAGE_any, Exclusive);
+
+	if (bdb)
+		{
+		if (bdb->buffer->pageNumber  == 0 && bdb->buffer->pageType == 0)
+			{
+			// Zeroed page, force recreate
+			bdb->release(REL_HISTORY);
+			bdb = NULL;
+			}
+		else
+			{
+			// Page is not completely zeroed, page number and type must be correctly set
+			ASSERT(bdb->buffer->pageNumber == pageNumber && bdb->buffer->pageType == PAGE_inventory);
+			}
+		}
+
+	if (bdb)
+		{
+		// Got a valid inventory page, nothing to do.
+		bdb->release(REL_HISTORY);
+		return;
+		}
+
+	Log::log("Recreating page inventory (tablespace %d page number  %d)", tableSpaceId, pageNumber);
+	bdb = PageInventoryPage::createInventoryPage(log->getDbb(tableSpaceId), pageNumber, NO_TRANSACTION);
+	bdb->mark(NO_TRANSACTION);
+	bdb->release(REL_HISTORY);
+}
+
+void SRLInventoryPage::print()
+{
+	logPrint("InventoryPage tableSpaceId %d, page %d \n", tableSpaceId, pageNumber);
+}
+
+void SRLInventoryPage::read()
+{
+	tableSpaceId = getInt();
+	pageNumber = getInt();
+}
+
+void SRLInventoryPage::append(Dbb *dbb, int32 pageNumber)
+{
+	START_RECORD(srlInventoryPage, "SRLInventoryPage::append");
+	putInt(dbb->tableSpaceId);
+	putInt(pageNumber);
+	sync.unlock();
+}
+
+SRLInventoryPage::SRLInventoryPage()
+{
+}
+
+SRLInventoryPage::~SRLInventoryPage()
+{
+}
+

=== added file 'storage/falcon/SRLInventoryPage.h'
--- a/storage/falcon/SRLInventoryPage.h	1970-01-01 00:00:00 +0000
+++ b/storage/falcon/SRLInventoryPage.h	2009-01-26 16:01:22 +0000
@@ -0,0 +1,35 @@
+/* Copyright 2009 Sun Microsystems, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+*/
+
+#ifndef SRL_INVENTORY_PAGE_H
+#define SRL_INVENTORY_PAGE_H
+
+#include "SerialLogRecord.h"
+#include "Dbb.h"
+
+class SRLInventoryPage : public SerialLogRecord
+{
+public:
+	virtual void pass2();
+	void print();
+	virtual void read();
+	void append(Dbb *dbb, int32 pageNumber);
+	SRLInventoryPage();
+	virtual ~SRLInventoryPage();
+	int32	pageNumber;
+
+};
+#endif
\ No newline at end of file

=== modified file 'storage/falcon/SRLVersion.h'
--- a/storage/falcon/SRLVersion.h	2008-03-28 22:44:36 +0000
+++ b/storage/falcon/SRLVersion.h	2009-01-26 16:01:22 +0000
@@ -42,7 +42,8 @@ static const int srlVersion12		= 12;	// 
 static const int srlVersion13		= 13;	// Added savepoint id to SRLUpdateRecords		February 14, 2008
 static const int srlVersion14		= 14;	// Added supernodes logging	March 7, 2008
 static const int srlVersion15		= 15;	// Added tablespace parameters to SRLCreateTableSpace	March 27, 2008
-static const int srlCurrentVersion	= srlVersion15;
+static const int srlVersion16		= 16;	// Added SRLInventoryPage January 26, 2009
+static const int srlCurrentVersion	= srlVersion16;
 
 class SRLVersion : public SerialLogRecord  
 {

=== modified file 'storage/falcon/SerialLogControl.cpp'
--- a/storage/falcon/SerialLogControl.cpp	2008-11-11 22:33:27 +0000
+++ b/storage/falcon/SerialLogControl.cpp	2009-01-26 16:01:22 +0000
@@ -171,7 +171,10 @@ SerialLogRecord* SerialLogControl::getRe
 			
 		case srlSavepointRollback:
 			return &savepointRollback;
-			
+		
+		case srlInventoryPage:
+			return &inventoryPage;
+
 		default:
 			ASSERT(false);
 		}

=== modified file 'storage/falcon/SerialLogControl.h'
--- a/storage/falcon/SerialLogControl.h	2008-02-14 21:06:10 +0000
+++ b/storage/falcon/SerialLogControl.h	2009-01-26 16:01:22 +0000
@@ -62,6 +62,7 @@
 #include "SRLUpdateBlob.h"
 #include "SRLSession.h"
 #include "SRLSavepointRollback.h"
+#include "SRLInventoryPage.h"
 
 #define LOW_BYTE_FLAG	0x80
 
@@ -137,6 +138,7 @@ public:
 	SRLUpdateBlob		smallBlob;
 	SRLSession			session;
 	SRLSavepointRollback	savepointRollback;
+	SRLInventoryPage	inventoryPage;
 };
 
 #endif // !defined(AFX_SERIALLOGCONTROL_H__77229761_E146_4AE4_8BBC_2114F6A0FC93__INCLUDED_)

=== modified file 'storage/falcon/SerialLogRecord.h'
--- a/storage/falcon/SerialLogRecord.h	2008-12-19 18:45:32 +0000
+++ b/storage/falcon/SerialLogRecord.h	2009-01-26 16:01:22 +0000
@@ -71,7 +71,8 @@ static const int srlBlobDelete		= 34;
 static const int srlSmallBlob		= 35;
 static const int srlSession			= 36;
 static const int srlSavepointRollback = 37;
-static const int srlMax				= 38;
+static const int srlInventoryPage	= 38;
+static const int srlMax				= 39;
 
 
 class SerialLog;

Thread
bzr commit into mysql-6.0-falcon-team branch (vvaintroub:2974)Bug#42060Vladislav Vaintroub26 Jan
  • Re: bzr commit into mysql-6.0-falcon-team branch (vvaintroub:2974)Bug#42060Kevin Lewis26 Jan