From: Date: August 26 2008 6:48am Subject: bzr push into mysql-6.0-falcon branch (klewis:2799 to 2800) Bug#39025 List-Archive: http://lists.mysql.com/commits/52519 X-Bug: 39025 Message-Id: <200808260448.m7Q4m2EJ031602@mail.mysql.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 2800 Kevin Lewis 2008-08-25 Bug#39025 Wrte pages to the serial log in this order; 1) The new right page first, 2) then the previously existing left page (which is now half full), 3) then the parent page modified: storage/falcon/Index2RootPage.cpp storage/falcon/IndexRootPage.cpp 2799 Kevin Lewis 2008-08-25 Use consistent naming for syncActive and syncCommitted When both are used, allow syncActive to unlock when it is no longer needed. TransactionManager::validateDependencies was locking the syncCommitted instead of syncActive. But validateDependencies is not currently called anywhere! modified: storage/falcon/TransactionManager.cpp === modified file 'storage/falcon/Index2RootPage.cpp' --- a/storage/falcon/Index2RootPage.cpp 2008-03-27 06:09:29 +0000 +++ b/storage/falcon/Index2RootPage.cpp 2008-08-25 22:09:13 +0000 @@ -518,9 +518,9 @@ bool Index2RootPage::splitIndexPage(Dbb leftPage->parentPage = bdb->pageNumber; splitPage->parentPage = bdb->pageNumber; - Index2Page::logIndexPage(bdb, transId); Index2Page::logIndexPage(splitBdb, transId); Index2Page::logIndexPage(leftBdb, transId); + Index2Page::logIndexPage(bdb, transId); splitBdb->release(REL_HISTORY); leftBdb->release(REL_HISTORY); === modified file 'storage/falcon/IndexRootPage.cpp' --- a/storage/falcon/IndexRootPage.cpp 2008-05-14 18:39:57 +0000 +++ b/storage/falcon/IndexRootPage.cpp 2008-08-25 22:09:13 +0000 @@ -552,12 +552,16 @@ bool IndexRootPage::splitIndexPage(Dbb * page->addNode(dbb, &dummy, END_LEVEL); page->addNode(dbb, &leftKey, leftBdb->pageNumber); page->addNode(dbb, &splitKey, splitBdb->pageNumber); - + leftPage->parentPage = bdb->pageNumber; splitPage->parentPage = bdb->pageNumber; - IndexPage::logIndexPage(bdb, transId); + + // the order of adding these to the serial log is important. + // Recovery must write them in this order incase recovery itself crashes. + IndexPage::logIndexPage(splitBdb, transId); IndexPage::logIndexPage(leftBdb, transId); + IndexPage::logIndexPage(bdb, transId); /*** IndexPage::printPage(bdb, false); === modified file 'storage/falcon/TransactionManager.cpp' --- a/storage/falcon/TransactionManager.cpp 2008-08-14 12:08:37 +0000 +++ b/storage/falcon/TransactionManager.cpp 2008-08-25 21:51:46 +0000 @@ -74,26 +74,25 @@ TransId TransactionManager::findOldestAc { Sync syncCommitted(&committedTransactions.syncObject, "TransactionManager::findOldestActive(1)"); syncCommitted.lock(Shared); - TransId oldestActive = transactionSequence; + TransId oldestCommitted = transactionSequence; for (Transaction *trans = committedTransactions.first; trans; trans = trans->next) - oldestActive = MIN(trans->transactionId, oldestActive); + oldestCommitted = MIN(trans->transactionId, oldestCommitted); syncCommitted.unlock(); - Sync sync(&activeTransactions.syncObject, "TransactionManager::findOldestActive(2)"); - sync.lock(Shared); + Transaction *oldest = findOldest(); if (oldest) { - //Log::debug("Oldest transaction %d, oldest ancestor %d, oldest committed %d\n", oldest->transactionId, oldest->oldestActive, oldestActive); - - return MIN(oldest->oldestActive, oldestActive); + //Log::debug("Oldest transaction %d, oldest ancestor %d, oldest committed %d\n", oldest->transactionId, oldest->oldestActive, oldestCommitted); + + return MIN(oldest->oldestActive, oldestCommitted); } //Log::debug("No active, current %d, oldest committed %d\n", transactionSequence, oldestActive); - return oldestActive; + return oldestCommitted; } Transaction* TransactionManager::findOldest(void) @@ -247,16 +246,20 @@ void TransactionManager::rollbackByXid(i void TransactionManager::print(void) { - Sync sync (&activeTransactions.syncObject, "TransactionManager::print(1)"); - sync.lock (Exclusive); - Sync committedTrans (&committedTransactions.syncObject, "TransactionManager::print(2)"); - committedTrans.lock (Exclusive); + Sync syncActive (&activeTransactions.syncObject, "TransactionManager::print(1)"); + syncActive.lock (Exclusive); + + Sync syncCommitted (&committedTransactions.syncObject, "TransactionManager::print(2)"); + syncCommitted.lock (Exclusive); + Transaction *transaction; Log::debug("Active Transaction:\n"); for (transaction = activeTransactions.first; transaction; transaction = transaction->next) transaction->print(); - + + syncActive.unlock(); + Log::debug("Committed Transaction:\n"); for (transaction = committedTransactions.first; transaction; transaction = transaction->next) @@ -266,15 +269,19 @@ void TransactionManager::print(void) void TransactionManager::getTransactionInfo(InfoTable* infoTable) { - Sync sync (&activeTransactions.syncObject, "TransactionManager::getTransactionInfo(1)"); - sync.lock (Exclusive); - Sync committedTrans (&committedTransactions.syncObject, "TransactionManager::getTransactionInfo(2)"); - committedTrans.lock (Exclusive); + Sync syncActive (&activeTransactions.syncObject, "TransactionManager::getTransactionInfo(2)"); + syncActive.lock (Exclusive); + + Sync syncCommitted (&committedTransactions.syncObject, "TransactionManager::getTransactionInfo(1)"); + syncCommitted.lock (Exclusive); + Transaction *transaction; for (transaction = activeTransactions.first; transaction; transaction = transaction->next) transaction->getInfo(infoTable); - + + syncActive.unlock(); + for (transaction = committedTransactions.first; transaction; transaction = transaction->next) transaction->getInfo(infoTable); } @@ -307,10 +314,12 @@ void TransactionManager::purgeTransactio void TransactionManager::getSummaryInfo(InfoTable* infoTable) { - Sync sync (&activeTransactions.syncObject, "TransactionManager::getSummaryInfo(1)"); - sync.lock (Exclusive); - Sync committedTrans (&committedTransactions.syncObject, "TransactionManager::getSummaryInfo(2)"); - committedTrans.lock (Exclusive); + Sync syncActive (&activeTransactions.syncObject, "TransactionManager::getSummaryInfo(2)"); + syncActive.lock (Exclusive); + + Sync syncCommitted (&committedTransactions.syncObject, "TransactionManager::getSummaryInfo(1)"); + syncCommitted.lock (Exclusive); + int numberCommitted = committed; int numberRolledBack = rolledBack; int numberActive = 0; @@ -327,14 +336,14 @@ void TransactionManager::getSummaryInfo( if (transaction->state == Committed) ++numberPendingCommit; } + syncActive.unlock(); for (transaction = committedTransactions.first; transaction; transaction = transaction->next) if (transaction->writePending) ++numberPendingCompletion; - committedTrans.unlock(); - sync.unlock(); - + syncCommitted.unlock(); + int n = 0; infoTable->putInt(n++, numberCommitted); infoTable->putInt(n++, numberRolledBack); @@ -402,15 +411,16 @@ void TransactionManager::expungeTransact Transaction* TransactionManager::findTransaction(TransId transactionId) { - Sync syncActiveTrans(&activeTransactions.syncObject, "TransactionManager::findTransaction(1)"); - syncActiveTrans.lock(Shared); + Sync syncActive(&activeTransactions.syncObject, "TransactionManager::findTransaction(1)"); + syncActive.lock(Shared); Transaction *transaction; for (transaction = activeTransactions.first; transaction; transaction = transaction->next) if (transaction->transactionId == transactionId) return transaction; - syncActiveTrans.unlock(); + syncActive.unlock(); + Sync syncCommitted(&committedTransactions.syncObject, "TransactionManager::findTransaction(2)"); syncCommitted.lock(Shared); @@ -418,20 +428,21 @@ Transaction* TransactionManager::findTra if (transaction->transactionId == transactionId) return transaction; - return NULL; + return NULL; } void TransactionManager::validateDependencies(void) { - Sync sync(&committedTransactions.syncObject, "TransactionManager::validateDepedendencies(1)"); - sync.lock(Shared); + Sync syncActive(&activeTransactions.syncObject, "TransactionManager::validateDepedendencies(1)"); + syncActive.lock(Shared); Transaction *transaction; for (transaction = activeTransactions.first; transaction; transaction = transaction->next) if (transaction->isActive()) transaction->validateDependencies(false); - sync.unlock(); + syncActive.unlock(); + Sync syncCommitted(&committedTransactions.syncObject, "TransactionManager::validateDepedendencies(2)"); syncCommitted.lock(Shared);