From: Date: October 16 2008 4:53am Subject: bzr commit into mysql-6.0-falcon-team branch (klewis:2867) List-Archive: http://lists.mysql.com/commits/56326 Message-Id: <200810160253.m9G2regS004853@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/ 2867 Kevin Lewis 2008-10-15 Various code cleanup changes. modified: storage/falcon/Dbb.cpp storage/falcon/DeferredIndex.cpp storage/falcon/DeferredIndex.h storage/falcon/DeferredIndexWalker.cpp storage/falcon/Index.cpp storage/falcon/SRLUpdateIndex.cpp storage/falcon/SRLUpdateRecords.cpp storage/falcon/Scavenger.cpp storage/falcon/Scavenger.h storage/falcon/SerialLogFile.cpp storage/falcon/StorageDatabase.cpp storage/falcon/StorageDatabase.h storage/falcon/Table.cpp storage/falcon/Table.h storage/falcon/Transaction.cpp storage/falcon/TransactionManager.cpp storage/falcon/WalkDeferred.cpp storage/falcon/ha_falcon.cpp storage/falcon/ha_falcon.h per-file messages: storage/falcon/Dbb.cpp white space cleanup storage/falcon/DeferredIndex.cpp Clarify comment. storage/falcon/DeferredIndex.h Use release, not releaseRef, which is more common. storage/falcon/DeferredIndexWalker.cpp Use release, not releaseRef, which is more common. storage/falcon/Index.cpp Add comented references that should be used for completeness, even though it now workes without them. storage/falcon/SRLUpdateIndex.cpp Code cleanup storage/falcon/SRLUpdateRecords.cpp Transaction::chilledBytes was never incremented. storage/falcon/Scavenger.cpp name change storage/falcon/Scavenger.h name change storage/falcon/SerialLogFile.cpp white space storage/falcon/StorageDatabase.cpp Comment out an unused function. May be used in the future. storage/falcon/StorageDatabase.h Comment out an unused function. May be used in the future. storage/falcon/Table.cpp comment out an unused function. May be used in the future. storage/falcon/Table.h comment out an unused function. May be used in the future. storage/falcon/Transaction.cpp Clarify a syncOjbject name storage/falcon/TransactionManager.cpp Clarify comment storage/falcon/WalkDeferred.cpp Use release, not releaseRef, which is more common. storage/falcon/ha_falcon.cpp white space storage/falcon/ha_falcon.h white space === modified file 'storage/falcon/Dbb.cpp' --- a/storage/falcon/Dbb.cpp 2008-08-07 21:11:55 +0000 +++ b/storage/falcon/Dbb.cpp 2008-10-16 02:53:35 +0000 @@ -668,10 +668,10 @@ void Dbb::validate(int optionMask) Validation validation (this, optionMask); validation.inUse ((int32) HEADER_PAGE, "HeaderPage"); PageInventoryPage::validate (this, &validation); - + if (inversion) inversion->validate (&validation); - + Section::validateIndexes (this, &validation); Section::validateSections (this, &validation); PageInventoryPage::validateInventory (this, &validation); === modified file 'storage/falcon/DeferredIndex.cpp' --- a/storage/falcon/DeferredIndex.cpp 2008-10-04 00:10:34 +0000 +++ b/storage/falcon/DeferredIndex.cpp 2008-10-16 02:53:35 +0000 @@ -819,7 +819,7 @@ void DeferredIndex::scanIndex(IndexKey * void DeferredIndex::detachIndex(void) { Sync sync(&syncObject, "DeferredIndex::detachIndex"); - sync.lock(Exclusive); // was Shared + sync.lock(Exclusive); // Do not change while index is in use. index = NULL; } @@ -882,8 +882,10 @@ void DeferredIndex::addRef() INTERLOCKED_INCREMENT (useCount); } -void DeferredIndex::releaseRef() +void DeferredIndex::release() { + ASSERT(useCount > 0); + if (INTERLOCKED_DECREMENT(useCount) == 0) delete this; } === modified file 'storage/falcon/DeferredIndex.h' --- a/storage/falcon/DeferredIndex.h 2008-07-25 18:07:24 +0000 +++ b/storage/falcon/DeferredIndex.h 2008-10-16 02:53:35 +0000 @@ -100,6 +100,8 @@ public: void initializeSpace(void); DINode* findMaxValue(void); DINode* findMinValue(void); + void addRef(); + void release(); SyncObject syncObject; volatile INTERLOCK_TYPE useCount; @@ -124,8 +126,6 @@ public: uint64 virtualOffset; // virtual offset into the serial log where this DI was flushed. uint64 virtualOffsetAtEnd; SerialLogWindow *window; - void addRef(); - void releaseRef(); }; #endif === modified file 'storage/falcon/DeferredIndexWalker.cpp' --- a/storage/falcon/DeferredIndexWalker.cpp 2008-09-10 19:51:03 +0000 +++ b/storage/falcon/DeferredIndexWalker.cpp 2008-10-16 02:53:35 +0000 @@ -96,7 +96,7 @@ void DeferredIndexWalker::initialize(Def DeferredIndexWalker::~DeferredIndexWalker(void) { if (deferredIndex) - deferredIndex->releaseRef(); + deferredIndex->release(); } DINode* DeferredIndexWalker::next(void) === modified file 'storage/falcon/Index.cpp' --- a/storage/falcon/Index.cpp 2008-08-19 03:33:01 +0000 +++ b/storage/falcon/Index.cpp 2008-10-16 02:53:35 +0000 @@ -123,6 +123,7 @@ Index::~Index() { ASSERT(deferredIndex->index == this); deferredIndex->detachIndex(); +// deferredIndex->release(); not currently refCounted; } } @@ -277,6 +278,7 @@ DeferredIndex *Index::getDeferredIndex(T deferredIndex = new DeferredIndex(this, transaction); sync.lock(Exclusive); deferredIndexes.append(deferredIndex); +// deferredIndex->addRef() not currently refCounted; sync.unlock(); transaction->add(deferredIndex); @@ -843,6 +845,7 @@ void Index::detachDeferredIndex(Deferred Sync sync(&deferredIndexes.syncObject, "Index::detachDeferredIndex(1)"); sync.lock(Exclusive); deferredIndexes.remove(deferredIndex); +// deferredIndex->release(); not currently refCounted; sync.unlock(); if ( (database->configuration->useDeferredIndexHash) === modified file 'storage/falcon/SRLUpdateIndex.cpp' --- a/storage/falcon/SRLUpdateIndex.cpp 2008-10-04 00:10:34 +0000 +++ b/storage/falcon/SRLUpdateIndex.cpp 2008-10-16 02:53:35 +0000 @@ -40,25 +40,19 @@ SRLUpdateIndex::~SRLUpdateIndex(void) void SRLUpdateIndex::append(DeferredIndex* deferredIndex) { - uint indexId; - int idxVersion; - int tableSpaceId; - - Sync syncDI(&deferredIndex->syncObject, "SRLUpdateIndex::append"); + Sync syncDI(&deferredIndex->syncObject, "SRLUpdateIndex::append(DI)"); syncDI.lock(Shared); if (!deferredIndex->index) return; - else - { - indexId = deferredIndex->index->indexId; - idxVersion = deferredIndex->index->indexVersion; - tableSpaceId = deferredIndex->index->dbb->tableSpaceId; - } + + uint indexId = deferredIndex->index->indexId; + int idxVersion = deferredIndex->index->indexVersion; + int tableSpaceId = deferredIndex->index->dbb->tableSpaceId; syncDI.unlock(); - Sync syncIndexes(&log->syncIndexes, "SRLUpdateIndex::append(1)"); + Sync syncIndexes(&log->syncIndexes, "SRLUpdateIndex::append(Indexes)"); syncIndexes.lock(Shared); Transaction *transaction = deferredIndex->transaction; === modified file 'storage/falcon/SRLUpdateRecords.cpp' --- a/storage/falcon/SRLUpdateRecords.cpp 2008-08-27 07:08:18 +0000 +++ b/storage/falcon/SRLUpdateRecords.cpp 2008-10-16 02:53:35 +0000 @@ -247,6 +247,7 @@ void SRLUpdateRecords::append(Transactio log->chilledRecords += chilledRecordsWindow; log->chilledBytes += chilledBytesWindow; transaction->chilledRecords += chilledRecordsWindow; + transaction->chilledBytes += chilledBytesWindow; windowNumber = (uint32)log->writeWindow->virtualOffset / SRL_WINDOW_SIZE; } } // next window === modified file 'storage/falcon/Scavenger.cpp' --- a/storage/falcon/Scavenger.cpp 2007-09-20 15:44:25 +0000 +++ b/storage/falcon/Scavenger.cpp 2008-10-16 02:53:35 +0000 @@ -32,10 +32,10 @@ // Construction/Destruction ////////////////////////////////////////////////////////////////////// -Scavenger::Scavenger (Database *db, ScavengeType scavengeType, const char *schedule) : Schedule (schedule) +Scavenger::Scavenger (Database *db, ScavengerType scavengerType, const char *schedule) : Schedule (schedule) { database = db; - type = scavengeType; + type = scavengerType; } Scavenger::~Scavenger() === modified file 'storage/falcon/Scavenger.h' --- a/storage/falcon/Scavenger.h 2007-09-20 15:44:25 +0000 +++ b/storage/falcon/Scavenger.h 2008-10-16 02:53:35 +0000 @@ -26,7 +26,7 @@ #include "Schedule.h" -enum ScavengeType { +enum ScavengerType { scvRecords, scvJava, }; @@ -38,13 +38,13 @@ class Scavenger : public Schedule public: virtual void execute (Scheduler *scheduler); void scavenge(); - Scavenger(Database *db, ScavengeType scavengeType, const char *schedule); + Scavenger(Database *db, ScavengerType scavengerType, const char *schedule); protected: virtual ~Scavenger(); Database *database; - ScavengeType type; + ScavengerType type; }; #endif // !defined(AFX_SCAVENGER_H__9E139FC3_1F3E_11D3_AB74_0000C01D2301__INCLUDED_) === modified file 'storage/falcon/SerialLogFile.cpp' --- a/storage/falcon/SerialLogFile.cpp 2008-10-14 13:00:31 +0000 +++ b/storage/falcon/SerialLogFile.cpp 2008-10-16 02:53:35 +0000 @@ -128,7 +128,7 @@ void SerialLogFile::open(JString filenam if (create) - handle = ::open(filename, O_RDWR | O_BINARY | O_CREAT|O_EXCL, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); + handle = ::open(filename, O_RDWR | O_BINARY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); else handle = ::open(filename, O_RDWR | O_BINARY); === modified file 'storage/falcon/StorageDatabase.cpp' --- a/storage/falcon/StorageDatabase.cpp 2008-08-18 20:17:15 +0000 +++ b/storage/falcon/StorageDatabase.cpp 2008-10-16 02:53:35 +0000 @@ -491,7 +491,7 @@ int StorageDatabase::nextIndexed(Storage return record->recordNumber; } - +/* RecordVersion* StorageDatabase::lockRecord(StorageConnection* storageConnection, Table *table, Record* record) { try @@ -505,7 +505,7 @@ RecordVersion* StorageDatabase::lockReco return NULL; } } - +*/ int StorageDatabase::savepointSet(Connection* connection) { Transaction *transaction = connection->getTransaction(); === modified file 'storage/falcon/StorageDatabase.h' --- a/storage/falcon/StorageDatabase.h 2008-08-18 05:45:29 +0000 +++ b/storage/falcon/StorageDatabase.h 2008-10-16 02:53:35 +0000 @@ -81,7 +81,7 @@ public: int nextIndexed(StorageTable *storageTable, void* recordBitmap, int recordNumber, bool lockForUpdate); int nextIndexed(StorageTable* storageTable, IndexWalker* indexWalker, bool lockForUpdate); int fetch(StorageConnection* storageConnection, StorageTable* storageTable, int recordNumber, bool lockForUpdate); - RecordVersion* lockRecord(StorageConnection* storageConnection, Table *table, Record* record); +// RecordVersion* lockRecord(StorageConnection* storageConnection, Table *table, Record* record); int updateRow(StorageConnection* storageConnection, Table* table, Record *oldRecord, Stream* stream); int getSegmentValue(StorageSegment* segment, const UCHAR* ptr, Value* value, Field *field); === modified file 'storage/falcon/Table.cpp' --- a/storage/falcon/Table.cpp 2008-10-16 02:40:08 +0000 +++ b/storage/falcon/Table.cpp 2008-10-16 02:53:35 +0000 @@ -3379,7 +3379,7 @@ void Table::waitForWriteComplete() { database->waitForWriteComplete(this); } - +/* RecordVersion* Table::lockRecord(Record* record, Transaction* transaction) { Record *current = fetch(record->recordNumber); @@ -3426,7 +3426,7 @@ RecordVersion* Table::lockRecord(Record* } return recordVersion; -} +} */ void Table::unlockRecord(int recordNumber) { === modified file 'storage/falcon/Table.h' --- a/storage/falcon/Table.h 2008-10-16 02:40:08 +0000 +++ b/storage/falcon/Table.h 2008-10-16 02:53:35 +0000 @@ -205,7 +205,7 @@ public: void inventoryRecords(RecordScavenge* recordScavenge); Format* getCurrentFormat(void); Record* fetchForUpdate(Transaction* transaction, Record* record, bool usingIndex); - RecordVersion* lockRecord(Record* record, Transaction* transaction); +// RecordVersion* lockRecord(Record* record, Transaction* transaction); void unlockRecord(int recordNumber); void unlockRecord(RecordVersion* record, bool remove); === modified file 'storage/falcon/Transaction.cpp' --- a/storage/falcon/Transaction.cpp 2008-10-10 18:42:44 +0000 +++ b/storage/falcon/Transaction.cpp 2008-10-16 02:53:35 +0000 @@ -397,7 +397,7 @@ void Transaction::rollback() // Rollback pending record versions from newest to oldest in case // there are multiple record versions on a prior record chain - Sync syncRec(&syncRecords, "Transaction::rollback(1.5)"); + Sync syncRec(&syncRecords, "Transaction::rollback(records)"); syncRec.lock(Exclusive); while (firstRecord) @@ -451,7 +451,7 @@ void Transaction::rollback() xidLength = 0; } - Sync syncActiveTransactions (&transactionManager->activeTransactions.syncObject, "Transaction::rollback(2)"); + Sync syncActiveTransactions (&transactionManager->activeTransactions.syncObject, "Transaction::rollback(active)"); syncActiveTransactions.lock (Exclusive); ++transactionManager->rolledBack; @@ -1494,7 +1494,7 @@ void Transaction::releaseDeferredIndexes ASSERT(deferredIndex->transaction == this); deferredIndexes = deferredIndex->nextInTransaction; deferredIndex->detachTransaction(); - deferredIndex->releaseRef(); + deferredIndex->release(); deferredIndexCount--; } } @@ -1510,7 +1510,7 @@ void Transaction::releaseDeferredIndexes { *ptr = deferredIndex->nextInTransaction; deferredIndex->detachTransaction(); - deferredIndex->releaseRef(); + deferredIndex->release(); --deferredIndexCount; } else === modified file 'storage/falcon/TransactionManager.cpp' --- a/storage/falcon/TransactionManager.cpp 2008-08-25 21:51:46 +0000 +++ b/storage/falcon/TransactionManager.cpp 2008-10-16 02:53:35 +0000 @@ -291,7 +291,7 @@ void TransactionManager::purgeTransactio Sync syncCommitted(&committedTransactions.syncObject, "Transaction::purgeTransactions"); syncCommitted.lock(Exclusive); - // And, while we're at it, check for any fully mature transactions to ditch + // Check for any fully mature transactions to ditch for (Transaction *transaction, *next = committedTransactions.first; (transaction = next);) { === modified file 'storage/falcon/WalkDeferred.cpp' --- a/storage/falcon/WalkDeferred.cpp 2008-07-25 18:07:24 +0000 +++ b/storage/falcon/WalkDeferred.cpp 2008-10-16 02:53:35 +0000 @@ -26,7 +26,7 @@ WalkDeferred::WalkDeferred(DeferredIndex WalkDeferred::~WalkDeferred(void) { - deferredIndex->releaseRef(); + deferredIndex->release(); } Record* WalkDeferred::getNext(bool lockForUpdate) === modified file 'storage/falcon/ha_falcon.cpp' --- a/storage/falcon/ha_falcon.cpp 2008-10-14 13:00:31 +0000 +++ b/storage/falcon/ha_falcon.cpp 2008-10-16 02:53:35 +0000 @@ -1277,7 +1277,7 @@ int StorageInterface::start_consistent_s { DBUG_ENTER("StorageInterface::start_consistent_snapshot"); int ret = storageHandler->startTransaction(thd, TRANSACTION_CONSISTENT_READ); - if (!ret) + if (!ret) trans_register_ha(thd, true, hton); DBUG_RETURN(ret); === modified file 'storage/falcon/ha_falcon.h' --- a/storage/falcon/ha_falcon.h 2008-09-16 17:58:49 +0000 +++ b/storage/falcon/ha_falcon.h 2008-10-16 02:53:35 +0000 @@ -176,12 +176,12 @@ public: StorageConnection* storageConnection; StorageTable* storageTable; StorageTableShare* storageShare; - Field **fieldMap; + Field **fieldMap; const char* errorText; THR_LOCK_DATA lockData; // MySQL lock THD *mySqlThread; - TABLE_SHARE *share; - uint recordLength; + TABLE_SHARE *share; + uint recordLength; int lastRecord; int nextRecord; int indexErrorId; @@ -189,12 +189,12 @@ public: int maxFields; StorageBlob *activeBlobs; StorageBlob *freeBlobs; - bool haveStartKey; - bool haveEndKey; - bool tableLocked; - bool tempTable; - bool lockForUpdate; - bool indexOrder; + bool haveStartKey; + bool haveEndKey; + bool tableLocked; + bool tempTable; + bool lockForUpdate; + bool indexOrder; key_range startKey; key_range endKey; uint64 insertCount;