From: Date: November 20 2008 6:06pm Subject: bzr commit into mysql-6.0-falcon-team branch (klewis:2914) Bug#40893 List-Archive: http://lists.mysql.com/commits/59418 X-Bug: 40893 Message-Id: <200811201706.mAKH61lw010832@mail.mysql.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit #At file:///C:/Work/bzr/Merge/mysql-6.0-falcon-team/ 2914 Kevin Lewis 2008-11-20 Code cleanup and a comment change related to Bug#40893 modified: storage/falcon/Configuration.cpp storage/falcon/Database.cpp storage/falcon/IO.cpp storage/falcon/IndexRootPage.cpp storage/falcon/IndexWalker.cpp storage/falcon/Log.h storage/falcon/SerialLog.cpp storage/falcon/SerialLogRecord.cpp storage/falcon/Table.cpp storage/falcon/Transaction.cpp per-file messages: storage/falcon/Configuration.cpp This code calculated the scavenge threshold and floor incorrectly, but is not compiled into the nornal Falcon engine. So there was no bug. Just code cleanup. Thanks to Kelly for spotting this. storage/falcon/Database.cpp cleanup storage/falcon/IO.cpp cleanup storage/falcon/IndexRootPage.cpp cleanup storage/falcon/IndexWalker.cpp cleanup storage/falcon/Log.h cleanup storage/falcon/SerialLog.cpp The extra check for an assigned writeblock catches a race condition I saw only once during testing. I may happen more in future code when the scavenger is a separate thread. storage/falcon/SerialLogRecord.cpp cleanup storage/falcon/Table.cpp comment change related to Bug#40893 and other cleanup storage/falcon/Transaction.cpp cleanup === modified file 'storage/falcon/Configuration.cpp' --- a/storage/falcon/Configuration.cpp 2008-10-22 12:01:16 +0000 +++ b/storage/falcon/Configuration.cpp 2008-11-20 17:05:50 +0000 @@ -144,8 +144,8 @@ Configuration::Configuration(const char recordMemoryMax = getMemorySize(RECORD_MEMORY_UPPER); recordScavengeThresholdPct = 67; recordScavengeFloorPct = 33; - recordScavengeThreshold = (recordMemoryMax * 100) / recordScavengeThresholdPct; - recordScavengeFloor = (recordMemoryMax * 100) / recordScavengeFloorPct; + recordScavengeThreshold = (recordMemoryMax * recordScavengeThresholdPct) / 100; + recordScavengeFloor = (recordMemoryMax * recordScavengeFloorPct) / 100; serialLogWindows = 10; // same as SRL_MIN_WINDOWS allocationExtent = 10; pageCacheSize = getMemorySize(PAGE_CACHE_MEMORY); === modified file 'storage/falcon/Database.cpp' --- a/storage/falcon/Database.cpp 2008-10-29 23:25:13 +0000 +++ b/storage/falcon/Database.cpp 2008-11-20 17:05:50 +0000 @@ -279,20 +279,20 @@ static const char *createDomains = "create table Domains (" "domainName varchar (128) not null," "schema varchar (128) not null," - "dataType int," - "length int," - "scale int," - "remarks text," + "dataType int," + "length int," + "scale int," + "remarks text," "primary key (domainName, schema));"; //static const char *createOds3Domains = // "create table Domains (" // "domainName varchar (128) not null," // "schema varchar (128) not null," -// "dataType int," -// "length int," -// "scale int," -// "remarks text," +// "dataType int," +// "length int," +// "scale int," +// "remarks text," // "primary key (domainName, schema));"; static const char *createView_tables = @@ -1944,7 +1944,7 @@ const char* Database::getString(const ch void Database::upgradeSystemTables() { Sync syncDDL(&syncSysDDL, "Database::upgradeSystemTables"); - syncDDL.lock(Shared); + syncDDL.lock(Exclusive); for (const char **tableName = changedTables; *tableName; ++tableName) { === modified file 'storage/falcon/IO.cpp' --- a/storage/falcon/IO.cpp 2008-10-31 00:29:13 +0000 +++ b/storage/falcon/IO.cpp 2008-11-20 17:05:50 +0000 @@ -946,4 +946,3 @@ uint16 IO::computeChecksum(Page *page, s return (uint16) sum; } - === modified file 'storage/falcon/IndexRootPage.cpp' --- a/storage/falcon/IndexRootPage.cpp 2008-10-31 15:42:42 +0000 +++ b/storage/falcon/IndexRootPage.cpp 2008-11-20 17:05:50 +0000 @@ -184,7 +184,7 @@ bool IndexRootPage::addIndexEntry(Dbb * } /* Node didn't fit. Split the page and propogate the - split upward. Sooner or laster we'll go back and re-try + split upward. Sooner or later we'll go back and re-try the original insertion */ if (splitIndexPage (dbb, indexId, bdb, transId, result, key, recordNumber)) === modified file 'storage/falcon/IndexWalker.cpp' --- a/storage/falcon/IndexWalker.cpp 2008-07-29 11:12:34 +0000 +++ b/storage/falcon/IndexWalker.cpp 2008-11-20 17:05:50 +0000 @@ -136,17 +136,15 @@ Record* IndexWalker::getValidatedRecord( else if (recordId == lastRecordNumber) return NULL; - - // Fetch record. If it doesn't exist, that's ok. - + Record *candidate = table->fetch(recordId); if (!candidate) return NULL; - + // Get the correct version. If this is select for update, get a lock record - + Record *record = (lockForUpdate) ? table->fetchForUpdate(transaction, candidate, true) : candidate->fetchVersion(transaction); === modified file 'storage/falcon/Log.h' --- a/storage/falcon/Log.h 2008-11-13 13:27:13 +0000 +++ b/storage/falcon/Log.h 2008-11-20 17:05:50 +0000 @@ -46,7 +46,7 @@ typedef void (Listener) (int, const char struct LogListener { int mask; - Listener *listener; + Listener *listener; void *arg; LogListener *next; }; === modified file 'storage/falcon/SerialLog.cpp' --- a/storage/falcon/SerialLog.cpp 2008-11-19 17:00:02 +0000 +++ b/storage/falcon/SerialLog.cpp 2008-11-20 17:05:50 +0000 @@ -1339,7 +1339,7 @@ void SerialLog::setPhysicalBlock(TransId void SerialLog::reportStatistics(void) { - if (!Log::isActive(LogInfo)) + if (!Log::isActive(LogInfo) || !writeBlock) return; Sync sync(&pending.syncObject, "SerialLog::reportStatistics"); === modified file 'storage/falcon/SerialLogRecord.cpp' --- a/storage/falcon/SerialLogRecord.cpp 2008-11-14 02:30:11 +0000 +++ b/storage/falcon/SerialLogRecord.cpp 2008-11-20 17:05:50 +0000 @@ -269,8 +269,6 @@ SerialLogTransaction* SerialLogRecord::g return transaction; } - - void SerialLogRecord::pass1() { @@ -326,4 +324,3 @@ void SerialLogRecord::logPrint(const cha else printf("Log %s", temp); } - === modified file 'storage/falcon/Table.cpp' --- a/storage/falcon/Table.cpp 2008-11-20 05:32:18 +0000 +++ b/storage/falcon/Table.cpp 2008-11-20 17:05:50 +0000 @@ -2553,7 +2553,7 @@ bool Table::checkUniqueRecordVersion(int if (!dup->hasRecord()) { - // If the record is locked or being unlocked keep looking for a dup. + // If the record is a lock record, keep looking for a dup. if (dup->state == recLock) continue; // Next record version. @@ -3158,8 +3158,6 @@ void Table::update(Transaction * transac attachment->preUpdate(this, record); END_FOR; - - //updateInversion(record, transaction); scavenge.lock(Shared); @@ -3191,18 +3189,18 @@ void Table::update(Transaction * transac if (updated) { transaction->removeRecord(record); - + if (!insert(oldRecord, record, record->recordNumber)) Log::debug("record backout failed after failed update\n"); } - + garbageCollect(record, oldRecord, transaction, true); - + if (record) { if (record->getPriorVersion()) record->getPriorVersion()->setSuperceded(false); - + if (record->state == recLock) record->deleteData(); === modified file 'storage/falcon/Transaction.cpp' --- a/storage/falcon/Transaction.cpp 2008-11-20 05:32:18 +0000 +++ b/storage/falcon/Transaction.cpp 2008-11-20 17:05:50 +0000 @@ -1225,7 +1225,7 @@ void Transaction::releaseSavepoints(void void Transaction::rollbackSavepoint(int savePointId) { //validateRecords(); - Sync sync(&syncSavepoints, "Transaction::rollbackSavepoints"); + Sync sync(&syncSavepoints, "Transaction::rollbackSavepoint"); SavePoint *savePoint; // System transactions require an exclusive lock for concurrent access