#At file:///home/hakan/work/mysql/mysql-6.0-falcon-to-merge/ based on revid:hky@stripped
2975 Hakan Kuecuekyilmaz 2009-01-29 [merge]
Merged:
mysql-6.0-falcon-team --> mysql-6.0-falcon.
removed:
storage/falcon/Blob.cpp
storage/falcon/Page.cpp
storage/falcon/SyncWait.cpp
added:
storage/falcon/SRLInventoryPage.cpp
storage/falcon/SRLInventoryPage.h
modified:
mysql-test/mysql-test-run.pl
storage/falcon/CMakeLists.txt
storage/falcon/Connection.cpp
storage/falcon/Database.cpp
storage/falcon/Database.h
storage/falcon/Dbb.cpp
storage/falcon/Dbb.h
storage/falcon/DeferredIndex.cpp
storage/falcon/DeferredIndex.h
storage/falcon/IO.cpp
storage/falcon/Index.cpp
storage/falcon/Makefile.am
storage/falcon/PageInventoryPage.cpp
storage/falcon/RecordLeaf.cpp
storage/falcon/RecordVersion.cpp
storage/falcon/SRLCreateTableSpace.cpp
storage/falcon/SRLVersion.h
storage/falcon/Section.cpp
storage/falcon/SerialLogControl.cpp
storage/falcon/SerialLogControl.h
storage/falcon/SerialLogRecord.h
storage/falcon/StorageHandler.cpp
storage/falcon/StorageVersion.h
storage/falcon/SyncObject.cpp
storage/falcon/Table.cpp
storage/falcon/TableSpaceManager.cpp
storage/falcon/Thread.cpp
storage/falcon/Thread.h
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2009-01-22 15:11:47 +0000
+++ b/mysql-test/mysql-test-run.pl 2009-01-23 20:39:45 +0000
@@ -2316,7 +2316,7 @@ sub setup_vardir() {
mtr_error("The destination for symlink $opt_vardir does not exist")
if ! -d readlink($opt_vardir);
}
- elsif ( $opt_mem )
+ elsif ( ! $glob_win32 && $opt_mem )
{
# Runinng with "var" as a link to some "memory" location, normally tmpfs
mtr_verbose("Creating $opt_mem");
@@ -2345,7 +2345,8 @@ sub setup_vardir() {
mkpath("$opt_vardir/tmp");
mkpath($opt_tmpdir) if $opt_tmpdir ne "$opt_vardir/tmp";
- if ($master->[0]->{'path_sock'} !~ m/^$opt_tmpdir/)
+ # Set up link to master sock if not in var/tmp (not on Windows)
+ if (! $glob_win32 && $master->[0]->{'path_sock'} !~ m/^$opt_tmpdir/)
{
mtr_report("Symlinking $master->[0]->{'path_sock'}");
symlink($master->[0]->{'path_sock'}, "$opt_tmpdir/master.sock");
=== removed file 'storage/falcon/Blob.cpp'
--- a/storage/falcon/Blob.cpp 2007-09-20 15:44:25 +0000
+++ b/storage/falcon/Blob.cpp 1970-01-01 00:00:00 +0000
@@ -1,34 +0,0 @@
-/* Copyright (C) 2006 MySQL AB
-
- 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 */
-
-
-// Blob.cpp: implementation of the Blob class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#include <stdio.h>
-#include <string.h>
-#include "Engine.h"
-#include "Blob.h"
-
-#ifdef _DEBUG
-#undef THIS_FILE
-static const char THIS_FILE[]=__FILE__;
-#endif
-
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
=== 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-28 06:52:48 +0000
@@ -39,7 +39,6 @@ SET(FALCON_SOURCES
BigInteger.cpp
BinaryBlob.cpp
Bitmap.cpp
- Blob.cpp
BlobReference.cpp
Btn.cpp
Cache.cpp
@@ -151,7 +150,6 @@ SET(FALCON_SOURCES
NStat.cpp
NUpdate.cpp
OpSys.cpp
- Page.cpp
PageInventoryPage.cpp
PagePrecedence.cpp
PageWriter.cpp
@@ -242,6 +240,7 @@ SET(FALCON_SOURCES
SRLIndexDelete.cpp
SRLIndexPage.cpp
SRLIndexUpdate.cpp
+ SRLInventoryPage.cpp
SRLInversionPage.cpp
SRLOverflowPages.cpp
SRLPrepare.cpp
@@ -276,7 +275,6 @@ SET(FALCON_SOURCES
SyncHandler.cpp
SyncObject.cpp
SyncTest.cpp
- SyncWait.cpp
Syntax.cpp
TableAttachment.cpp
Table.cpp
@@ -522,6 +520,7 @@ SET(FALCON_SOURCES
SRLIndexAdd.h
SRLIndexDelete.h
SRLIndexPage.h
+ SRLInventoryPage.h
SRLInversionPage.h
SRLIndexUpdate.h
SRLOverflowPages.h
=== modified file 'storage/falcon/Connection.cpp'
--- a/storage/falcon/Connection.cpp 2008-07-24 08:45:03 +0000
+++ b/storage/falcon/Connection.cpp 2009-01-27 17:26:16 +0000
@@ -376,7 +376,6 @@ void Connection::shutdownDatabases()
{
unlink(database);
database->shutdown();
- database->shutdown();
database->release();
}
}
=== modified file 'storage/falcon/Database.cpp'
--- a/storage/falcon/Database.cpp 2009-01-15 20:29:54 +0000
+++ b/storage/falcon/Database.cpp 2009-01-27 17:32:40 +0000
@@ -455,7 +455,9 @@ Database::Database(const char *dbName, C
scheduler = NULL;
internalScheduler = NULL;
scavenger = NULL;
+#ifndef STORAGE_ENGINE
garbageCollector = NULL;
+#endif
sequenceManager = NULL;
repositoryManager = NULL;
sessionManager = NULL;
@@ -522,7 +524,9 @@ void Database::start()
scheduler = new Scheduler(this);
internalScheduler = new Scheduler(this);
scavenger = new Scavenger(this, scvRecords, configuration->scavengeSchedule);
+#ifndef STORAGE_ENGINE
garbageCollector = new Scavenger(this, scvJava, configuration->gcSchedule);
+#endif
sequenceManager = new SequenceManager(this);
repositoryManager = new RepositoryManager(this);
transactionManager = new TransactionManager(this);
@@ -533,7 +537,9 @@ void Database::start()
cardinalityThread = threads->start("Database::cardinalityThreadMain", &Database::cardinalityThreadMain, this);
scavengerThread = threads->start("Database::scavengerThreadMain", &Database::scavengerThreadMain, this);
internalScheduler->addEvent(scavenger);
+#ifndef STORAGE_ENGINE
internalScheduler->addEvent(garbageCollector);
+#endif
internalScheduler->addEvent(serialLog);
pageWriter->start();
cache->setPageWriter(pageWriter);
@@ -585,9 +591,10 @@ Database::~Database()
if (scavenger)
scavenger->release();
+#ifndef STORAGE_ENGINE
if (garbageCollector)
garbageCollector->release();
-
+#endif
if (threads)
{
threads->shutdownAll();
=== modified file 'storage/falcon/Database.h'
--- a/storage/falcon/Database.h 2009-01-15 07:52:32 +0000
+++ b/storage/falcon/Database.h 2009-01-27 17:32:40 +0000
@@ -290,7 +290,9 @@ public:
Scheduler *scheduler;
Scheduler *internalScheduler;
Scavenger *scavenger;
+#ifndef STORAGE_ENGINE
Scavenger *garbageCollector;
+#endif
TemplateManager *templateManager;
ImageManager *imageManager;
SessionManager *sessionManager;
=== modified file 'storage/falcon/Dbb.cpp'
--- a/storage/falcon/Dbb.cpp 2008-12-19 18:45:32 +0000
+++ b/storage/falcon/Dbb.cpp 2009-01-27 20:44:30 +0000
@@ -149,7 +149,7 @@ Dbb::~Dbb()
dbb->close();
}
-Cache* Dbb::create(const char * fileName, int pageSz, int64 cacheSize, FileType fileType, TransId transId, const char *logRoot)
+Cache* Dbb::create(const char * fileName, int pageSz, int64 cacheSize, FileType fileType, TransId transId, const char *logRoot, bool useExistingFile)
{
serialLog = database->serialLog;
odsVersion = ODS_VERSION;
@@ -157,7 +157,11 @@ Cache* Dbb::create(const char * fileName
sequence = 1;
init(pageSz, (int) ((cacheSize + pageSz - 1) / pageSz));
- createFile(fileName);
+ if(useExistingFile)
+ openFile(fileName, false);
+ else
+ createFile(fileName);
+
try
{
Hdr::create(this, fileType, transId, logRoot);
@@ -168,7 +172,8 @@ Cache* Dbb::create(const char * fileName
catch(...)
{
closeFile();
- deleteFile();
+ if(!useExistingFile)
+ deleteFile();
throw;
}
=== modified file 'storage/falcon/Dbb.h'
--- a/storage/falcon/Dbb.h 2008-12-19 18:45:32 +0000
+++ b/storage/falcon/Dbb.h 2009-01-27 20:44:30 +0000
@@ -165,7 +165,9 @@ public:
Bdb* fakePage (int32 pageNumber, PageType pageType, TransId transId);
Bdb* trialFetch(int32 pageNumber, PageType pageType, LockType lockType);
void init(int pageSz, int cacheSize);
- Cache* create (const char *fileName, int pageSize, int64 cacheSize, FileType fileType, TransId transId, const char *logRoot);
+ Cache* create (const char *fileName, int pageSize, int64 cacheSize, FileType fileType, TransId transId, const char *logRoot,
+ bool useExistingFile = false);
+
void validateCache(void);
void logUpdatedRecords(Transaction* transaction, RecordVersion* records, bool chill = false);
void logIndexUpdates(DeferredIndex* deferredIndex);
=== modified file 'storage/falcon/DeferredIndex.cpp'
--- a/storage/falcon/DeferredIndex.cpp 2008-11-14 15:38:44 +0000
+++ b/storage/falcon/DeferredIndex.cpp 2009-01-26 17:29:41 +0000
@@ -843,7 +843,7 @@ void DeferredIndex::detachTransaction(vo
//releaseRef();
}
-void DeferredIndex::chill(Dbb *dbb)
+bool DeferredIndex::chill(Dbb *dbb)
{
Sync sync(&syncObject, "DeferredIndex::chill");
sync.lock(Exclusive);
@@ -852,23 +852,34 @@ void DeferredIndex::chill(Dbb *dbb)
window = dbb->serialLog->setWindowInterest();
dbb->logIndexUpdates(this);
-
- // Free up the space used by this DeferredIndex
-
- freeHunks();
- initializeSpace();
- levels = 0;
- DILeaf *leaf = (DILeaf*) alloc(sizeof(DILeaf));
- leaf->count = 0;
- root = leaf;
- count = 0;
- minValue = NULL;
- maxValue = NULL;
- haveMinValue = true;
- haveMaxValue = true;
-
- Log::log(LogInfo, "%d: Index chill: transaction %ld, index %ld, %ld bytes, address %p, vofs %llx\n",
+
+ if (virtualOffset > 0)
+ {
+ // Virtual offset will be > 0 if chill was successful.
+ // Free up the space used by this DeferredIndex.
+
+ freeHunks();
+ initializeSpace();
+ levels = 0;
+ DILeaf *leaf = (DILeaf*) alloc(sizeof(DILeaf));
+ leaf->count = 0;
+ root = leaf;
+ count = 0;
+ minValue = NULL;
+ maxValue = NULL;
+ haveMinValue = true;
+ haveMaxValue = true;
+
+ Log::log(LogInfo, "%d: Index chill: transaction %ld, index %ld, %ld bytes, address %p, vofs %llx\n",
+ dbb->database->deltaTime, transaction->transactionId, index->indexId, sizeEstimate, this, virtualOffset);
+ }
+ else
+ {
+ Log::log(LogInfo, "%d: Index chill: transaction %ld, index %ld, %ld bytes, address %p, vofs %llx - NOT CHILLED\n",
dbb->database->deltaTime, transaction->transactionId, index->indexId, sizeEstimate, this, virtualOffset);
+ }
+
+ return virtualOffset > 0;
}
DINode* DeferredIndex::findMaxValue(void)
=== modified file 'storage/falcon/DeferredIndex.h'
--- a/storage/falcon/DeferredIndex.h 2008-10-16 02:53:35 +0000
+++ b/storage/falcon/DeferredIndex.h 2009-01-26 17:29:41 +0000
@@ -86,7 +86,7 @@ public:
void detachIndex(void);
void detachTransaction(void);
void scanIndex (IndexKey *lowKey, IndexKey *highKey, int searchFlags, Bitmap *bitmap);
- void chill(Dbb *dbb);
+ bool chill(Dbb *dbb);
int checkTail(uint position, DINode* node);
int checkTail(uint position, IndexKey *indexKey);
=== modified file 'storage/falcon/IO.cpp'
--- a/storage/falcon/IO.cpp 2008-12-18 12:32:24 +0000
+++ b/storage/falcon/IO.cpp 2009-01-27 20:44:30 +0000
@@ -792,6 +792,7 @@ static int winOpen(const char *filename,
switch(GetLastError())
{
case ERROR_ACCESS_DENIED:
+ case ERROR_SHARING_VIOLATION:
errno = EACCES;
break;
case ERROR_FILE_NOT_FOUND:
=== modified file 'storage/falcon/Index.cpp'
--- a/storage/falcon/Index.cpp 2009-01-22 18:52:19 +0000
+++ b/storage/falcon/Index.cpp 2009-01-26 17:34:37 +0000
@@ -28,6 +28,7 @@
#include "Database.h"
#include "Value.h"
#include "Record.h"
+#include "Format.h"
#include "ResultSet.h"
#include "Collation.h"
#include "Sync.h"
@@ -257,12 +258,14 @@ DeferredIndex *Index::getDeferredIndex(T
(type != UniqueIndex) &&
(transaction->scanIndexCount == 0))
{
- if (deferredIndex->sizeEstimate > database->configuration->indexChillThreshold)
+
+ // Scavenge (or chill) this DeferredIndex and get a new one
+
+ if (deferredIndex->count > 0 &&
+ deferredIndex->sizeEstimate > database->configuration->indexChillThreshold)
{
- // Scavenge (or chill) this DeferredIndex and get a new one
- deferredIndex->chill(dbb);
- ASSERT(deferredIndex->virtualOffset);
- deferredIndex = NULL;
+ if (deferredIndex->chill(dbb))
+ deferredIndex = NULL;
}
}
@@ -605,6 +608,9 @@ void Index::update(Record * oldRecord, R
// If there is a duplicate in the old version chain, don't bother with another
+ Sync syncPrior(record->format->table->getSyncPrior(record), "Index::update");
+ syncPrior.lock(Shared);
+
if (duplicateKey (&key, oldRecord))
return;
=== 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-28 06:52:48 +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 \
@@ -213,7 +214,7 @@ falcon_sources= Agent.cpp Alias.cpp \
BDB.cpp \
BigInt.cpp \
BigInteger.cpp \
- BinaryBlob.cpp Bitmap.cpp Blob.cpp \
+ BinaryBlob.cpp Bitmap.cpp \
BlobReference.cpp Btn.cpp Cache.cpp CmdGen.cpp \
CollationCaseless.cpp \
CollationUnknown.cpp \
@@ -278,7 +279,7 @@ falcon_sources= Agent.cpp Alias.cpp \
NInSelectBitmap.cpp NInSelect.cpp NInsert.cpp NMatching.cpp \
NNode.cpp NParameter.cpp NRecordNumber.cpp NRepair.cpp \
NReplace.cpp NSelect.cpp NSelectExpr.cpp NSequence.cpp \
- NStat.cpp NUpdate.cpp OpSys.cpp Page.cpp \
+ NStat.cpp NUpdate.cpp OpSys.cpp \
PageInventoryPage.cpp PagePrecedence.cpp PageWriter.cpp \
Parameter.cpp Parameters.cpp PreparedStatement.cpp \
PrettyPrint.cpp \
@@ -335,6 +336,7 @@ falcon_sources= Agent.cpp Alias.cpp \
SRLIndexDelete.cpp \
SRLIndexPage.cpp \
SRLIndexUpdate.cpp \
+ SRLInventoryPage.cpp \
SRLInversionPage.cpp \
SRLOverflowPages.cpp \
SRLPrepare.cpp \
@@ -369,7 +371,6 @@ falcon_sources= Agent.cpp Alias.cpp \
SyncHandler.cpp \
SyncObject.cpp\
SyncTest.cpp\
- SyncWait.cpp\
Syntax.cpp\
TableAttachment.cpp \
Table.cpp \
=== removed file 'storage/falcon/Page.cpp'
--- a/storage/falcon/Page.cpp 2007-11-24 20:10:33 +0000
+++ b/storage/falcon/Page.cpp 1970-01-01 00:00:00 +0000
@@ -1,38 +0,0 @@
-/* Copyright (C) 2006 MySQL AB
-
- 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 */
-
-// Page.cpp: implementation of the Page class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#include "Engine.h"
-#include "Page.h"
-
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
-/***
-Page::Page()
-{
-
-}
-
-Page::~Page()
-{
-
-}
-***/
-
=== 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-27 20:44:30 +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,10 @@ Bdb* PageInventoryPage::createInventoryP
for (int n = 0; n < dbb->pipSlots; ++n)
page->freePages [n] = -1;
+ if (dbb->database->serialLog && !dbb->database->serialLog->recovering
+ && (pageNumber != PIP_PAGE))
+ dbb->database->serialLog->logControl->inventoryPage.append(dbb, pageNumber);
+
return bdb;
}
=== modified file 'storage/falcon/RecordLeaf.cpp'
--- a/storage/falcon/RecordLeaf.cpp 2009-01-08 09:05:26 +0000
+++ b/storage/falcon/RecordLeaf.cpp 2009-01-27 17:32:40 +0000
@@ -146,7 +146,11 @@ void RecordLeaf::pruneRecords (Table *ta
for (Record *prune = prior; prune; prune = prune->getPriorVersion())
{
- ASSERT(prune->useCount == 1);
+ if (prune->useCount != 1)
+ {
+ prior = NULL;
+ break;
+ }
recordScavenge->recordsPruned++;
recordScavenge->spacePruned += prune->getMemUsage();
}
=== modified file 'storage/falcon/RecordVersion.cpp'
--- a/storage/falcon/RecordVersion.cpp 2009-01-14 22:33:44 +0000
+++ b/storage/falcon/RecordVersion.cpp 2009-01-26 17:43:21 +0000
@@ -317,8 +317,14 @@ Record* RecordVersion::clearPriorVersion
syncPrior.lock(Exclusive);
Record * prior = priorVersion;
- priorVersion = NULL;
- return prior;
+
+ if (prior && prior->useCount == 1)
+ {
+ priorVersion = NULL;
+ return prior;
+ }
+
+ return NULL;
}
void RecordVersion::setPriorVersion(Record *oldVersion)
=== modified file 'storage/falcon/SRLCreateTableSpace.cpp'
--- a/storage/falcon/SRLCreateTableSpace.cpp 2008-11-14 02:30:11 +0000
+++ b/storage/falcon/SRLCreateTableSpace.cpp 2009-01-28 23:57:54 +0000
@@ -90,9 +90,12 @@ void SRLCreateTableSpace::pass1()
void SRLCreateTableSpace::pass2()
{
- TableSpaceInit tsInit;
- tsInit.comment = comment;
- log->database->tableSpaceManager->redoCreateTableSpace(tableSpaceId, nameLength, name, filenameLength, filename, type, &tsInit);
+ if (control->isPostFlush())
+ {
+ TableSpaceInit tsInit;
+ tsInit.comment = comment;
+ log->database->tableSpaceManager->redoCreateTableSpace(tableSpaceId, nameLength, name, filenameLength, filename, type, &tsInit);
+ }
}
void SRLCreateTableSpace::commit()
=== 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-28 23:57:54 +0000
@@ -0,0 +1,63 @@
+/* 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
+void SRLInventoryPage::pass2()
+{
+ if (control->isPostFlush())
+ {
+ Bdb* 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-27 00:03:16 +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
=== 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 18:13:45 +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/Section.cpp'
--- a/storage/falcon/Section.cpp 2008-06-17 17:41:54 +0000
+++ b/storage/falcon/Section.cpp 2009-01-29 14:14:02 +0000
@@ -164,6 +164,10 @@ void Section::createSection(Dbb *dbb, in
if (sections->pages [slot] == 0)
{
+ // If we're in recovery and slot is empty, something went wrong , page must have
+ // been logged and rebuilt already (every allocation is redone)
+ ASSERT (!(dbb->serialLog && dbb->serialLog->recovering));
+
sectionsBdb->mark(transId);
Bdb *sectionBdb = dbb->allocPage(PAGE_sections, transId);
BDB_HISTORY(sectionBdb);
@@ -172,6 +176,11 @@ void Section::createSection(Dbb *dbb, in
sections->pages [slot] = sectionBdb->pageNumber;
SectionPage *page = (SectionPage*) sectionBdb->buffer;
page->section = sectionId;
+
+ // Log allocated page
+ dbb->serialLog->logControl->sectionPage.append(dbb, transId, SECTION_ROOT,
+ sectionBdb->pageNumber, slot, sectionId, 0, 0);
+
sectionBdb->release(REL_HISTORY);
}
@@ -1194,41 +1203,33 @@ bool Section::isCleanupRequired()
}
***/
+
void Section::redoSectionPage(Dbb *dbb, int32 parentPage, int32 pageNumber, int slot, int sectionId, int sequence, int level)
{
- Bdb *bdb = dbb->fetchPage (parentPage, PAGE_any, Exclusive);
+ Bdb *bdb = dbb->fetchPage (parentPage, PAGE_sections, Exclusive);
BDB_HISTORY(bdb);
SectionPage *page = (SectionPage*) bdb->buffer;
- // Unless parent page is already leaf, probe and if necessary rebuild section page
- //if (pageNumber && (page->level > 0 || parentPage == SECTION_ROOT))
- if (pageNumber && (page->level > 0 || page->section == -1))
+ // If page number != 0, we are creating a new section page
+ // Otherwise, the log record comes from deleteSection and we just need to
+ // clear the slot in the parent page
+
+ if (pageNumber != 0)
{
Bdb *sectionBdb = dbb->fakePage(pageNumber, PAGE_any, 0);
BDB_HISTORY(bdb);
SectionPage *sectionPage = (SectionPage*) sectionBdb->buffer;
-
- if (!dbb->trialRead(sectionBdb) ||
- sectionPage->pageType != PAGE_sections ||
- sectionPage->section != sectionId ||
- sectionPage->sequence != sequence ||
- sectionPage->level != level)
- {
- memset(sectionPage, 0, dbb->pageSize);
- //sectionPage->pageType = PAGE_sections;
- sectionBdb->setPageHeader(PAGE_sections);
- sectionPage->section = sectionId;
- sectionPage->sequence = sequence;
- sectionPage->level = level;
- }
+ memset(sectionPage, 0, dbb->pageSize);
+ sectionBdb->setPageHeader(PAGE_sections);
+ sectionPage->section = sectionId;
+ sectionPage->sequence = sequence;
+ sectionPage->level = level;
PageInventoryPage::markPageInUse(dbb, pageNumber, NO_TRANSACTION);
sectionBdb->release(REL_HISTORY);
}
- // Now try to store it in the right place
-
if (page->pages[slot] != pageNumber)
{
bdb->mark(NO_TRANSACTION);
@@ -1243,33 +1244,9 @@ int32 Section::getSectionRoot()
Bdb *bdb = getSectionPage(dbb, SECTION_ROOT, sectionId / dbb->pagesPerSection, Shared, NO_TRANSACTION);
BDB_HISTORY(bdb);
SectionPage *sectionPage = (SectionPage*) bdb->buffer;
- root = sectionPage->pages[sectionId % dbb->pagesPerSection];
+ int slot = sectionId % dbb->pagesPerSection;
+ root = sectionPage->pages[slot];
bdb->release(REL_HISTORY);
-
- if (root == 0)
- {
- if (!dbb->serialLog->recovering)
- throw SQLError(DATABASE_DAMAGED, "Missing section root for section %d/%d\n", sectionId, dbb->tableSpaceId);
-
- // Missing root page -- make a new one
-
- Bdb *sectionBdb = dbb->allocPage(PAGE_sections, NO_TRANSACTION);
- BDB_HISTORY(sectionBdb);
- root = sectionBdb->pageNumber;
- SectionPage *page = (SectionPage*) sectionBdb->buffer;
- page->section = sectionId;
- sectionBdb->release(REL_HISTORY);
-
- // Register new root page
-
- bdb = getSectionPage(dbb, SECTION_ROOT, sectionId / dbb->pagesPerSection, Exclusive, NO_TRANSACTION);
- BDB_HISTORY(bdb);
- sectionPage = (SectionPage*) bdb->buffer;
- sectionPage->pages[sectionId % dbb->pagesPerSection] = root;
- bdb->release(REL_HISTORY);
- }
-
-
return root;
}
=== 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 18:13:45 +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 18:13:45 +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 18:13:45 +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;
=== modified file 'storage/falcon/StorageHandler.cpp'
--- a/storage/falcon/StorageHandler.cpp 2008-12-10 13:25:17 +0000
+++ b/storage/falcon/StorageHandler.cpp 2009-01-27 17:26:16 +0000
@@ -984,7 +984,6 @@ void StorageHandler::initialize(void)
try
{
- defaultDatabase->getOpenConnection();
dictionaryConnection = defaultDatabase->getOpenConnection();
dropTempTables();
dictionaryConnection->commit();
=== modified file 'storage/falcon/StorageVersion.h'
--- a/storage/falcon/StorageVersion.h 2009-01-23 11:13:17 +0000
+++ b/storage/falcon/StorageVersion.h 2009-01-29 15:59:32 +0000
@@ -14,5 +14,5 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#define FALCON_VERSION "T1.4-3"
-#define FALCON_DATE "23 January, 2009"
+#define FALCON_VERSION "T1.4-4"
+#define FALCON_DATE "29 January, 2009"
=== modified file 'storage/falcon/SyncObject.cpp'
--- a/storage/falcon/SyncObject.cpp 2009-01-08 09:05:26 +0000
+++ b/storage/falcon/SyncObject.cpp 2009-01-27 17:32:40 +0000
@@ -621,7 +621,7 @@ void SyncObject::wait(LockType type, Thr
thread->queue = NULL;
thread->lockType = type;
- *ptr = thread;
+ *ptr = thread; // Add this thread to the SyncObject queue
thread->lockGranted = false;
thread->lockPending = sync;
++thread->activeLocks;
=== removed file 'storage/falcon/SyncWait.cpp'
--- a/storage/falcon/SyncWait.cpp 2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SyncWait.cpp 1970-01-01 00:00:00 +0000
@@ -1,26 +0,0 @@
-/* Copyright (C) 2006 MySQL AB
-
- 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 */
-
-// SyncWait.cpp: implementation of the SyncWait class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#include "Engine.h"
-#include "SyncWait.h"
-
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
=== modified file 'storage/falcon/Table.cpp'
--- a/storage/falcon/Table.cpp 2009-01-22 18:40:02 +0000
+++ b/storage/falcon/Table.cpp 2009-01-28 19:19:44 +0000
@@ -2617,12 +2617,14 @@ bool Table::checkUniqueRecordVersion(int
{
if (state == Active)
{
+ dup->addRef();
syncPrior.unlock(); // release lock before wait
syncUnique->unlock(); // release lock before wait
// Wait for that transaction, then restart checkUniqueIndexes()
state = transaction->getRelativeState(dup, WAIT_IF_ACTIVE);
+ dup->release(); // We are done with this now.
if (state != Deadlock)
{
@@ -2798,7 +2800,7 @@ int Table::chartActiveRecords(int *chart
void Table::rebuildIndex(Index *index, Transaction *transaction)
{
index->rebuildIndex(transaction);
- populateIndex(index, transaction);
+ populateIndex(index, transaction);
}
=== modified file 'storage/falcon/TableSpaceManager.cpp'
--- a/storage/falcon/TableSpaceManager.cpp 2009-01-08 17:32:55 +0000
+++ b/storage/falcon/TableSpaceManager.cpp 2009-01-28 14:26:37 +0000
@@ -147,7 +147,7 @@ TableSpace* TableSpaceManager::getTableS
throw SQLError(TABLESPACE_NOT_EXIST_ERROR, "can't find table space \"%s\"", name);
if (!tableSpace->active)
- throw SQLError(RUNTIME_ERROR, "table space \"%s\" is not active", (const char*) tableSpace->name);
+ tableSpace->open();
return tableSpace;
}
@@ -214,27 +214,11 @@ void TableSpaceManager::bootstrap(int se
p = EncodedDataStream::decode(p, &id, true);
p = EncodedDataStream::decode(p, &fileName, true);
p = EncodedDataStream::decode(p, &type, true);
- /***
- p = EncodedDataStream::decode(p, &comment, true);
- TableSpaceInit tsInit;
- tsInit.comment = comment.getString();
- ***/
TableSpace *tableSpace = new TableSpace(database, name.getString(), id.getInt(), fileName.getString(), type.getInt(), NULL);
Log::debug("New table space %s, id %d, type %d, filename %s\n", (const char*) tableSpace->name, tableSpace->tableSpaceId, tableSpace->type, (const char*) tableSpace->filename);
-
- if (tableSpace->type == TABLESPACE_TYPE_TABLESPACE)
- try
- {
- tableSpace->open();
- }
- catch(SQLException& exception)
- {
- Log::log("Couldn't open table space file \"%s\" for tablespace \"%s\": %s\n",
- fileName.getString(), name.getString(), exception.getText());
- }
-
+
add(tableSpace);
stream.clear();
}
@@ -257,7 +241,6 @@ TableSpace* TableSpaceManager::getTableS
throw SQLError(COMPILE_ERROR, "can't find table space %d", id);
if (!tableSpace->active)
- //throw SQLError(RUNTIME_ERROR, "table space \"%s\" is not active", (const char*) tableSpace->name);
tableSpace->open();
return tableSpace;
@@ -396,30 +379,44 @@ void TableSpaceManager::redoCreateTableS
{
Sync sync(&syncObject, "TableSpaceManager::redoCreateTableSpace");
sync.lock(Exclusive);
- TableSpace *tableSpace;
+ TableSpace *tableSpace = NULL;
for (tableSpace = idHash[id % TS_HASH_SIZE]; tableSpace; tableSpace = tableSpace->idCollision)
if (tableSpace->tableSpaceId == id)
- return;
+ {
+ tableSpace->close();
+ break;
+ }
- char buffer[1024];
- memcpy(buffer, name, nameLength);
- buffer[nameLength] = 0;
- char *file = buffer + nameLength + 1;
- memcpy(file, fileName, fileNameLength);
- file[fileNameLength] = 0;
- tableSpace = new TableSpace(database, buffer, id, file, type, tsInit);
- tableSpace->needSave = true;
- add(tableSpace);
+ if (!tableSpace)
+ {
+ char buffer[1024];
+ memcpy(buffer, name, nameLength);
+ buffer[nameLength] = 0;
+ char *file = buffer + nameLength + 1;
+ memcpy(file, fileName, fileNameLength);
+ file[fileNameLength] = 0;
+ tableSpace = new TableSpace(database, buffer, id, file, type, tsInit);
+ tableSpace->needSave = true;
+ add(tableSpace);
+ }
try
{
- tableSpace->open();
+ Dbb *dbb = tableSpace->dbb;
+
+ dbb->create(tableSpace->filename, database->dbb->pageSize, 0, HdrTableSpace,
+ NO_TRANSACTION, "", true);
+ dbb->close();
+
}
catch(SQLException& exception)
{
Log::log("Couldn't open table space file \"%s\" for tablespace \"%s\": %s\n",
- file, buffer, exception.getText());
+ tableSpace->filename.getString(), tableSpace->name.getString(), exception.getText());
+
+ // remove from various hashtables
+ expungeTableSpace(tableSpace->tableSpaceId);
}
}
=== modified file 'storage/falcon/Thread.cpp'
--- a/storage/falcon/Thread.cpp 2008-07-24 08:45:03 +0000
+++ b/storage/falcon/Thread.cpp 2009-01-27 17:32:40 +0000
@@ -107,7 +107,6 @@ void Thread::init(const char *desc)
activeLocks = 0;
locks = NULL;
lockPending = NULL;
- syncWait = NULL;
lockType = None;
defaultTimeZone = NULL;
javaThread = NULL;
@@ -451,12 +450,6 @@ void Thread::print(int level)
LOG_DEBUG ("%*sPending:\n", level * 2, "");
sync->print(level + 1);
}
-
- if (syncWait)
- {
- LOG_DEBUG ("%*sWaiting:\n", level * 2, "");
- syncWait->print(level + 1);
- }
}
***/
=== modified file 'storage/falcon/Thread.h'
--- a/storage/falcon/Thread.h 2008-06-11 18:24:29 +0000
+++ b/storage/falcon/Thread.h 2009-01-27 17:32:40 +0000
@@ -102,7 +102,6 @@ public:
volatile int32 activeLocks;
Sync *locks;
Sync *lockPending;
- SyncWait *syncWait;
bool marked;
int pageMarks;
int eventNumber; // for debugging
| Thread |
|---|
| • bzr commit into mysql-6.0-falcon branch (hky:2975) | Hakan Kuecuekyilmaz | 29 Jan |