From: Date: July 4 2007 7:57pm Subject: bk commit into 6.0-falcon tree (jas:1.2588) List-Archive: http://lists.mysql.com/commits/30318 Message-Id: <20070704175714.A2AB4381C0F@fluffy.netfrastructure.com> Below is the list of changes that have just been committed into a local 6.0-falcon repository of jas. When jas 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-07-04 13:57:07-04:00, jas@stripped +3 -0 Work in progress. storage/falcon/SerialLog.cpp@stripped, 2007-07-04 13:57:01-04:00, jas@stripped +22 -1 Work in progress. storage/falcon/SerialLogControl.cpp@stripped, 2007-07-04 13:57:01-04:00, jas@stripped +5 -0 Work in progress. storage/falcon/SerialLogWindow.cpp@stripped, 2007-07-04 13:57:01-04:00, jas@stripped +8 -3 Work in progress. # 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: fluffy.netfrastructure.com # Root: /home/mysql/mysql-5.1-falcon --- 1.94/storage/falcon/SerialLog.cpp 2007-07-04 13:57:14 -04:00 +++ 1.95/storage/falcon/SerialLog.cpp 2007-07-04 13:57:14 -04:00 @@ -430,6 +430,7 @@ writeBlock->blockNumber = nextBlockNumber++; writeBlock->creationTime = (uint32) creationTime; writeBlock->length = (int) (writePtr - (UCHAR*) writeBlock); + ASSERT(writeWindow->validate(writeBlock)); lastReadBlock = writeBlock->readBlockNumber = getReadBlock(); ASSERT(writeWindow->validate(writeBlock)); @@ -513,7 +514,9 @@ writeBlock->blockNumber = nextBlockNumber++; writeBlock->creationTime = (uint32) creationTime; writeBlock->length = (int) (writePtr - (UCHAR*) writeBlock); + ASSERT(writeWindow->validate(writeBlock)); lastReadBlock = writeBlock->readBlockNumber = getReadBlock(); + ASSERT(writeWindow->validate(writeBlock)); // Keep track of what needs to be written @@ -524,6 +527,7 @@ if (!forceNewWindow && (writeBlock = writeWindow->nextAvailableBlock(writeBlock))) { + ASSERT(flushWindow->validate(flushBlock)); writePtr = writeBlock->data; writeBlock->blockNumber = nextBlockNumber; writeBlock->readBlockNumber = lastReadBlock; @@ -531,6 +535,7 @@ writeBlock->length = (int) (writePtr - (UCHAR*) writeBlock); writeWindow->currentLength = (int) (writePtr - writeWindow->buffer); writeWindow->lastBlockNumber = writeBlock->blockNumber; + ASSERT(writeWindow->validate(writeBlock)); ASSERT(flushWindow->validate(flushBlock)); } else @@ -567,6 +572,7 @@ void SerialLog::createNewWindow(void) { ASSERT(syncWrite.ourExclusiveLock()); + ASSERT(!writeBlock || writeWindow->validate(writeBlock)); // We need a new window. Start by purging any unused windows @@ -595,8 +601,11 @@ writeWindow->deactivateWindow(); writeWindow = allocWindow(file, fileOffset); + writeWindow->firstBlockNumber = nextBlockNumber; + writeWindow->lastBlockNumber = nextBlockNumber; initializeWriteBlock(writeWindow->firstBlock()); writeWindow->firstBlockNumber = writeBlock->blockNumber; + ASSERT(writeWindow->validate(writeBlock)); } void SerialLog::shutdown() @@ -619,6 +628,9 @@ void SerialLog::putData(uint32 length, const UCHAR *data) { + ASSERT(syncWrite.ourExclusiveLock()); + ASSERT(writeWindow->validate(writePtr)); + if ((writePtr + length) < writeWarningTrack) { memcpy(writePtr, data, length); @@ -626,6 +638,8 @@ writeBlock->length = (int) (writePtr - (UCHAR*) writeBlock); writeWindow->currentLength = (int) (writePtr - writeWindow->buffer); ASSERT(writePtr < writeWindow->warningTrack); + ASSERT(writeWindow->validate(writeBlock)); + ASSERT(writeWindow->validate(writePtr)); return; } @@ -633,18 +647,22 @@ // Data didn't fit in block -- find out how much didn't fit, then flush the rest // Note: the record code is going to be overwritten by an srlEnd byte. + SerialLogWindow *flushWindow = writeWindow; + SerialLogBlock *flushBlock = writeBlock; int tailLength = (int) (writePtr - recordStart); UCHAR recordCode = *recordStart; writeBlock->length = (int) (recordStart - (UCHAR*) writeBlock); + ASSERT(writeWindow->validate(writeBlock)); writePtr = recordStart; - //flush(true, 0, NULL); overflowFlush(); ASSERT(writeWindow->validate(writeBlock)); + ASSERT(flushWindow->validate(flushBlock)); while (writePtr + length + tailLength >= writeWarningTrack) { overflowFlush(); ASSERT(writeWindow->validate(writeBlock)); + ASSERT(flushWindow->validate(flushBlock)); } putVersion(); @@ -671,6 +689,7 @@ recordStart = writeBlock->data; ASSERT(writeWindow->validate(writePtr)); ASSERT(writeWindow->validate(writeBlock)); + ASSERT(flushWindow->validate(flushBlock)); } void SerialLog::startRecord() @@ -922,6 +941,7 @@ void SerialLog::initializeWriteBlock(SerialLogBlock *block) { + ASSERT(syncWrite.ourExclusiveLock()); writeBlock = block; writePtr = writeBlock->data; writeBlock->blockNumber = nextBlockNumber; @@ -929,6 +949,7 @@ writeBlock->length = (int) (writePtr - (UCHAR*) writeBlock); writeWindow->setLastBlock(writeBlock); writeWarningTrack = writeWindow->warningTrack; + ASSERT(writeWindow->validate(writeBlock)); } --- 1.41/storage/falcon/SerialLogControl.cpp 2007-07-04 13:57:14 -04:00 +++ 1.42/storage/falcon/SerialLogControl.cpp 2007-07-04 13:57:14 -04:00 @@ -167,6 +167,11 @@ void SerialLogControl::setWindow(SerialLogWindow *window, SerialLogBlock *block, int offset) { + ASSERT(window->validate(block)); + SerialLogWindow *priorWindow = inputWindow; + SerialLogBlock *priorBlock = inputBlock; + ASSERT(!priorWindow || priorWindow->validate(priorBlock)); + if (inputWindow != window) { if (inputWindow) --- 1.28/storage/falcon/SerialLogWindow.cpp 2007-07-04 13:57:14 -04:00 +++ 1.29/storage/falcon/SerialLogWindow.cpp 2007-07-04 13:57:14 -04:00 @@ -180,9 +180,12 @@ SerialLogBlock *nextBlk = NEXT_BLOCK(block); if (nextBlk < (SerialLogBlock*) (buffer + currentLength) && - nextBlk->creationTime == log->creationTime && - nextBlk->blockNumber == block->blockNumber + 1) + nextBlk->creationTime == log->creationTime && + nextBlk->blockNumber == block->blockNumber + 1) + { + ASSERT(validate(nextBlk)); return nextBlk; + } return NULL; } @@ -291,7 +294,9 @@ { ASSERT((UCHAR*) block >= buffer && (UCHAR*) block < buffer + bufferLength); ASSERT((UCHAR*) block + block->length < buffer + bufferLength); - + ASSERT(block->blockNumber >= firstBlockNumber); + ASSERT(block->blockNumber <= lastBlockNumber); + return true; }