List:Commits« Previous MessageNext Message »
From:Olav Sandstaa Date:December 1 2008 2:26pm
Subject:bzr commit into mysql-6.0-falcon-team branch (olav:2738) WL#4654
View as plain text  
#At file:///home/os136802/mysql/develop/repo/falcon-ann/ based on revid:olav@stripped

 2738 Olav Sandstaa	2008-12-01
      WL#4654 New transaction dependency manager for Falcon
      
      Implements a new dependency manager for Falcon that uses start and commit events for transactions
      for determining the relative state between transactions and for determining whne transaction can
      be removed. 
      
      The old dependency manager is removed. This eliminates the states array and the dependency counter
      from each transaction.
modified:
  storage/falcon/Transaction.cpp
  storage/falcon/Transaction.h
  storage/falcon/TransactionManager.cpp
  storage/falcon/TransactionManager.h

per-file messages:
  storage/falcon/Transaction.cpp
    Replaces the us of the states array and the dependency counter with the new start and commit events for tracking dependencies/relative state between transactions.
    
    Optimizations for read-only transactions have been removed or disabled.
    
    Removed code for old dependency manager.
  storage/falcon/Transaction.h
    Add a new datatype for transistion events and adds start and commit event to the transaction. Removes the old states array and the dependency counter.
  storage/falcon/TransactionManager.cpp
    New dependency manager: Generates and assignsstart events for new transactions. Use the new start and commit events for determining when transactions can be deleted.
    
    Optimizations for read-only transactions have been removed.
    
    Code for the old dependency manger has been removed.
  storage/falcon/TransactionManager.h
    Added transition event sequence counter. This is used for creating unique increasing start and commit events for transactions.
=== modified file 'storage/falcon/Transaction.cpp'

=== modified file 'storage/falcon/Transaction.cpp'
--- a/storage/falcon/Transaction.cpp	2008-11-20 17:05:50 +0000
+++ b/storage/falcon/Transaction.cpp	2008-12-01 14:26:41 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 MySQL AB
+/* Copyright (C) 2006 MySQL AB, 2008 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
@@ -49,6 +49,10 @@
 
 extern uint		falcon_lock_wait_timeout;
 
+extern volatile int Talloc;   // These are temporary for debug tracing
+extern volatile int Tdelete;  // of number of allocated transaction objects.
+
+
 static const char *stateNames [] = {
 	"Active",
 	"Limbo",
@@ -78,8 +82,8 @@
 
 Transaction::Transaction(Connection *cnct, TransId seq)
 {
-	states = NULL;
-	statesAllocated = 0;
+	Talloc++;
+
 	savePoints = NULL;
 	freeSavePoints = NULL;
 	useCount = 1;
@@ -90,7 +94,6 @@
 	syncSavepoints.setName("Transaction::syncSavepoints");
 	firstRecord = NULL;
 	lastRecord = NULL;
-	dependencies = 0;
 	initialize(cnct, seq);
 }
 
@@ -101,7 +104,6 @@
 	ASSERT(savePoints == NULL);
 	ASSERT(freeSavePoints == NULL);
 	ASSERT(firstRecord == NULL);
-	ASSERT(dependencies == 0);
 	connection = cnct;
 	isolationLevel = connection->isolationLevel;
 	mySqlThreadId = connection->mySqlThreadId;
@@ -109,6 +111,8 @@
 	TransactionManager *transactionManager = database->transactionManager;
 	systemTransaction = database->systemConnection == connection;
 	transactionId = seq;
+	startEvent = 0;
+	commitEvent = 0;
 	chillPoint = &firstRecord;
 	commitTriggers = false;
 	hasUpdates = false;
@@ -132,7 +136,6 @@
 	debugThawedRecords = 0;
 	debugThawedBytes = 0;
 	committedRecords = 0;
-	numberStates = 0;
 	blockedBy = 0;
 	deletedRecords = 0;
 	inList = true;
@@ -160,46 +163,13 @@
 	syncIsActive.lock(NULL, Exclusive);
 	Transaction *oldest = transactionManager->findOldest();
 	oldestActive = (oldest) ? oldest->transactionId : transactionId;
-	int count = transactionManager->activeTransactions.count;
-	
-	if (count > statesAllocated)
-		{
-		delete [] states;
-		statesAllocated = count;
-		states = new TransState[statesAllocated];
-		}
-
-	if (count)
-		for (Transaction *transaction = transactionManager->activeTransactions.first; transaction; transaction = transaction->next)
-			if (transaction->isActive() && 
-				 !transaction->systemTransaction &&
-				 transaction->transactionId < transactionId)
-				{
-				Sync syncDependency(&transaction->syncObject, "Transaction::initialize(2)");
-				syncDependency.lock(Shared);
-
-				if (transaction->isActive() && 
-					 !transaction->systemTransaction &&
-					 transaction->transactionId < transactionId)
-					{
-					transaction->addRef();
-					INTERLOCKED_INCREMENT(transaction->dependencies);
-					TransState *state = states + numberStates;
-					state->transaction = transaction;
-					state->transactionId = transaction->transactionId;
-					state->state = transaction->state;
-					++numberStates;
-					ASSERT(transaction->transactionId == state->transactionId);
-					}
-				}
-
 	state = Active;
 }
 
 Transaction::~Transaction()
 {
-	ASSERT(dependencies == 0);
-	
+	Tdelete++;
+
 	if (state == Active)
 		{
 		Log::debug("Deleting apparently active transaction %d\n", transactionId);
@@ -212,7 +182,6 @@
 	if (inList)
 		database->transactionManager->removeTransaction(this);
 
-	delete [] states;
 	delete [] xid;
 	delete backloggedRecords;
 	chillPoint = &firstRecord;
@@ -241,12 +210,15 @@
 
 	releaseSavepoints();
 
-	if (!hasUpdates)
-		{
-		commitNoUpdates();
-		
-		return;
-		}
+	// NOTE: temporary disabled the optimization for read only transactions.
+	// This will be included in a follow up patch
+
+	//if (!hasUpdates)
+	//	{
+	//	commitNoUpdates();
+	//	
+	//	return;
+	//	}
 
 	TransactionManager *transactionManager = database->transactionManager;
 	addRef();
@@ -275,7 +247,13 @@
 	if (hasLocks)
 		releaseRecordLocks();
 
-	database->serialLog->preCommit(this);
+	// NOTE: The if test can be removed when the handling of read-only
+	// transactions has been re-implemented
+
+	if (hasUpdates)
+		database->serialLog->preCommit(this);
+	else 
+		writePending = false;
 
 	Sync syncRec(&syncRecords,"Transaction::commit(1.5)");
 	syncRec.lock(Shared);
@@ -297,7 +275,6 @@
 	}
 	syncRec.unlock();
 
-	releaseDependencies();
 	database->flushInversion(this);
 
 	// Transfer transaction from active list to committed list, set committed state
@@ -308,6 +285,10 @@
 	syncActiveTransactions.lock(Exclusive);
 	syncCommitted.lock(Exclusive);
 
+	// Set the commit transition event for this transaction
+
+    commitEvent = INTERLOCKED_INCREMENT(transactionManager->transitionEventSequence);
+
 	transactionManager->activeTransactions.remove(this);
 	transactionManager->committedTransactions.append(this);
 	state = Committed;
@@ -324,9 +305,16 @@
 	xidLength = 0;
 	
 	// If there's no reason to stick around, just go away
-	
-	if ((dependencies == 0) && !writePending)
-		commitRecords();
+
+	// NOTE: This call to commitRecords() is temporarily commented out.
+	// A call to commitRecords() are taken care of in
+	// TransactionManager::purgeTransactions().
+	// It is likely that this call will be totally removed in one of the
+	// next patches as I do not think it is ever called here due to 
+	// still having pending writes - but I will investigate this further
+
+	//if ((dependencies == 0) && !writePending)
+	//  commitRecords();
 
 	connection = NULL;
 	
@@ -338,6 +326,9 @@
 
 void Transaction::commitNoUpdates(void)
 {
+	// NOTE: This method is not in use by the new dependency manager.
+	// It will be re-enabled in a follow-up patch
+
 	TransactionManager *transactionManager = database->transactionManager;
 	addRef();
 	ASSERT(!deferredIndexes);
@@ -352,7 +343,6 @@
 
 	Sync syncActiveTransactions(&transactionManager->activeTransactions.syncObject, "Transaction::commitNoUpdates(2)");
 	syncActiveTransactions.lock(Shared);
-	releaseDependencies();
 
 	if (xid)
 		{
@@ -363,10 +353,7 @@
 	
 	Sync sync(&syncObject, "Transaction::commitNoUpdates(3)");
 	sync.lock(Exclusive);
-	
-	if (dependencies)
-		transactionManager->expungeTransaction(this);
-	
+
 	// If there's no reason to stick around, just go away
 	
 	connection = NULL;
@@ -441,7 +428,6 @@
 
 	ASSERT(writePending);
 	writePending = false;
-	releaseDependencies();
 	
 	if (hasUpdates)
 		database->serialLog->preCommit(this);
@@ -458,11 +444,7 @@
 	Sync syncActiveTransactions (&transactionManager->activeTransactions.syncObject, "Transaction::rollback(active)");
 	syncActiveTransactions.lock (Exclusive);
 	++transactionManager->rolledBack;
-	
-	while (dependencies)
-		transactionManager->expungeTransaction(this);
-		
-	ASSERT(dependencies == 0);
+
 	inList = false;
 	transactionManager->activeTransactions.remove(this);
 	syncActiveTransactions.unlock();
@@ -472,20 +454,6 @@
 }
 
 
-void Transaction::expungeTransaction(Transaction * transaction)
-{
-	ASSERT(states != NULL || numberStates == 0);
-	
-	for (TransState *s = states, *end = s + numberStates; s < end; ++s)
-		if (s->transaction == transaction)
-			{
-			if (COMPARE_EXCHANGE_POINTER(&s->transaction, transaction, NULL))
-				transaction->releaseDependency();
-
-			break;
-			}
-}
-
 void Transaction::prepare(int xidLen, const UCHAR *xidPtr)
 {
 	if (state != Active)
@@ -750,11 +718,11 @@
 	if (transId > transactionId)
 		return false;
 
-	// If the transaction was active when we started, use it's state at that point
+	// If the transaction committed after we started then it should not
+	// be visible to us
 
-	for (int n = 0; n < numberStates; ++n)
-		if (states [n].transactionId == transId)
-			return false;
+	if (transaction->commitEvent > startEvent)
+		return false;
 
 	return true;
 }
@@ -790,26 +758,6 @@
 	return false;
 }
 
-void Transaction::releaseDependencies()
-{
-	if (!numberStates)
-		return;
-
-	for (TransState *state = states, *end = states + numberStates; state < end; ++state)
-		{
-		Transaction *transaction = state->transaction;
-
-		if (transaction)
-			{
-			if (COMPARE_EXCHANGE_POINTER(&state->transaction, transaction, NULL))
-				{
-				ASSERT(transaction->transactionId == state->transactionId || transaction->transactionId == 0);
-				ASSERT(transaction->state != Initializing);
-				transaction->releaseDependency();
-				}
-			}
-		}
-}
 
 /*
  *  Transaction is fully mature and about to go away.
@@ -852,6 +800,14 @@
 
 State Transaction::getRelativeState(Record* record, uint32 flags)
 {
+	// If this is a Record object it has no assosiated transaction
+	// and is always visible
+	
+	if (!record->isVersion())
+		{
+		return CommittedVisible;
+		}
+
 	blockingRecord = record;
 	State state = getRelativeState(record->getTransaction(), record->getTransactionId(), flags);
 	blockingRecord = NULL;
@@ -880,14 +836,22 @@
 			// If the transaction is no longer around, and the record is,
 			// then it must be committed.
 
+			// Check if the transaction started after us.
+			// With the old dependency manager this test might have been
+			// hit but with the new dependency manager this will never 
+			// happen. Still leave it in until further evaluation.
+
 			if (transactionId < transId)
 				return CommittedInvisible;
 
 			// Be sure it was not active when we started.
 
-			for (int n = 0; n < numberStates; ++n)
-				if (states [n].transactionId == transId)
-					return CommittedInvisible;
+			// The dependency manager ensures that transactions that were
+			// active at the time this transaction started will not be
+			// deleted at least not until also we are committed.
+			// Since the transaction pointer is NULL here,
+			// the transaction is not deleted and hence was not active at
+			// the time we started.
 			}
 
 		return CommittedVisible;
@@ -962,9 +926,17 @@
 	ASSERT(writePending);
 	ASSERT(state == Committed);
 	releaseDeferredIndexes();
-	
-	if (dependencies == 0)
-		commitRecords();
+
+	// NOTE: This call to commitRecords() is temporarily commented out.
+	// A call to commitRecords() are taken care of in
+	// TransactionManager::purgeTransactions().
+	// We might want to include a call to commitRecords() her but in 
+	// order to perform the "dependencies == 0" check with the new
+	// dependency manager we should probably have to do a shared lock
+	// on the activelist. Need to experiment with this a bit.
+
+	//if (dependencies == 0)
+	//	commitRecords();
 
 //	Log::log(LogXARecovery, "%d: WriteComplete %sTransaction %d\n", 
 // 	database->deltaTime, (systemTransaction ? "System " : ""),  transactionId);
@@ -1371,9 +1343,9 @@
 
 void Transaction::print(void)
 {
-	Log::debug("  %p Id %d, state %d, updates %d, wrtPend %d, states %d, dependencies %d, records %d\n",
+	Log::debug("  %p Id %d, state %d, updates %d, wrtPend %d, records %d\n",
 			this, transactionId, state, hasUpdates, writePending, 
-			numberStates, dependencies, firstRecord != NULL);
+			firstRecord != NULL);
 }
 
 void Transaction::printBlocking(int level)
@@ -1439,7 +1411,12 @@
 
 void Transaction::getInfo(InfoTable* infoTable)
 {
-	if (!(state == Available && dependencies == 0))
+	// NOTE: The field for number of dependencies will be removed in
+	// a follow-up patch.
+	// Need to decide if we want to include the startEvent and endEvent
+	// in this table.
+
+	if (!(state == Available))
 		{
 		int n = 0;
 		infoTable->putString(n++, stateNames[state]);
@@ -1447,7 +1424,7 @@
 		infoTable->putInt(n++, transactionId);
 		infoTable->putInt(n++, hasUpdates);
 		infoTable->putInt(n++, writePending);
-		infoTable->putInt(n++, dependencies);
+		infoTable->putInt(n++, 0);  // Number of dependencies, will be removed
 		infoTable->putInt(n++, oldestActive);
 		infoTable->putInt(n++, firstRecord != NULL);
 		infoTable->putInt(n++, (waitingFor) ? waitingFor->transactionId : 0);
@@ -1464,17 +1441,6 @@
 		}
 }
 
-void Transaction::releaseDependency(void)
-{
-	ASSERT(useCount >= 2);
-	ASSERT(dependencies > 0);
-	INTERLOCKED_DECREMENT(dependencies);
-
-	if ((dependencies == 0) && !writePending && firstRecord)
-		commitRecords();
-	releaseCommittedTransaction();
-}
-
 void Transaction::fullyCommitted(void)
 {
 	ASSERT(inList);
@@ -1490,20 +1456,21 @@
 {
 	release();
 
-	if ((useCount == 1) && (state == Committed) && (dependencies == 0) && !writePending)
-		if (COMPARE_EXCHANGE(&inList, (INTERLOCK_TYPE) true, (INTERLOCK_TYPE) false))
-			database->transactionManager->removeCommittedTransaction(this);
-}
-
-void Transaction::validateDependencies(bool noDependencies)
-{
-	for (TransState *state = states, *end = states + numberStates; state < end; ++state)
-		if (state->transaction)
-			{
-			ASSERT(!noDependencies);
-			ASSERT(state->transaction->transactionId == state->transactionId);
-			}
-}
+	// NOTE: This is commented out due to in order to replacing the
+	// "dependencies == 0" test we have to lock the active transaction list.
+	// This should have no effect on Falcon due to that the if test will
+	// never evaluate to true when called from Transaction::fullyCommitted().
+	// Only when called from Transaction::releaseDependency() (which now is
+	// deleted) would the if test occasionally be true.
+	// The "removeCommittedTransaction" funcionality will be taken care
+	// of by TransactionManager::purgeTransaction.
+	// This code will likely be removed by a follow-up patch.
+
+	//if ((useCount == 1) && (state == Committed) && (dependencies == 0) && !writePending)
+	//	if (COMPARE_EXCHANGE(&inList, (INTERLOCK_TYPE) true, (INTERLOCK_TYPE) false))
+	//		database->transactionManager->removeCommittedTransaction(this);
+}
+
 
 void Transaction::printBlockage(void)
 {

=== modified file 'storage/falcon/Transaction.h'
--- a/storage/falcon/Transaction.h	2008-10-02 23:20:47 +0000
+++ b/storage/falcon/Transaction.h	2008-12-01 14:26:41 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 MySQL AB
+/* Copyright (C) 2006 MySQL AB, 2008 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
@@ -43,6 +43,8 @@
 class InfoTable;
 class Thread;
 
+typedef TransId TransEvent; // Used for the two transition events
+
 // Transaction States
 
 enum State {
@@ -90,9 +92,7 @@
 	void		removeRecordNoLock (RecordVersion *record);
 	void		removeRecord(RecordVersion *record);
 	void		removeRecord (RecordVersion *record, RecordVersion **ptr);
-	void		expungeTransaction (Transaction *transaction);
 	void		commitRecords();
-	void		releaseDependencies();
 	bool		visible (Transaction *transaction, TransId transId, int forWhat);
 	bool		needToLock(Record* record);
 	void		addRecord (RecordVersion *record);
@@ -108,7 +108,6 @@
 	void		truncateTable(Table* table);
 	bool		hasRecords(Table* table);
 	void		writeComplete(void);
-	void		releaseDependency(void);
 	int			createSavepoint();
 	void		releaseSavepoint(int savepointId);
 	void		releaseSavepoints(void);
@@ -127,7 +126,6 @@
 	void		fullyCommitted(void);
 	void		releaseCommittedTransaction(void);
 	void		commitNoUpdates(void);
-	void		validateDependencies(bool noDependencies);
 	void		validateRecords(void);
 	void		printBlocking(int level);
 	void		releaseDeferredIndexes(void);
@@ -144,6 +142,8 @@
 	TransId			transactionId;
 	TransId			oldestActive;
 	TransId			blockedBy;
+	TransEvent      startEvent;
+	TransEvent      commitEvent;
 	int				curSavePointId;
 	Transaction		*next;			// next in database
 	Transaction		*prior;			// next in database
@@ -157,12 +157,10 @@
 	Bitmap			*backloggedRecords;
 	time_t			startTime;
 	int				deferredIndexCount;
-	int				statesAllocated;
 	int				isolationLevel;
 	int				xidLength;
 	int				mySqlThreadId;
 	UCHAR			*xid;
-	TransState		*states;
 	bool			commitTriggers;
 	bool			systemTransaction;
 	bool			hasUpdates;
@@ -187,9 +185,7 @@
 	RecordVersion	**chillPoint;		// points to a pointer to the first non-chilled record
 	int				scanIndexCount;
 
-	volatile int			numberStates;
 	volatile INTERLOCK_TYPE	state;
-	volatile INTERLOCK_TYPE	dependencies;
 	volatile INTERLOCK_TYPE	useCount;
 	volatile INTERLOCK_TYPE	inList;
 

=== modified file 'storage/falcon/TransactionManager.cpp'
--- a/storage/falcon/TransactionManager.cpp	2008-10-24 10:20:10 +0000
+++ b/storage/falcon/TransactionManager.cpp	2008-12-01 14:26:41 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 MySQL AB
+/* Copyright (C) 2006 MySQL AB, 2008 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
@@ -15,6 +15,8 @@
 
 
 #include <memory.h>
+#include <stdio.h>     // Temporarily, will be removed before falcon-team tree
+#include <limits.h>
 #include "Engine.h"
 #include "TransactionManager.h"
 #include "Transaction.h"
@@ -30,12 +32,16 @@
 #include "Thread.h"
 
 static const int EXTRA_TRANSACTIONS = 10;
+static const TransEvent TRANS_EVENT_MAX = UINT_MAX;
 
 #ifdef _DEBUG
 #undef THIS_FILE
 static const char THIS_FILE[]=__FILE__;
 #endif
 
+volatile int Talloc = 0;  // Temp. will be removed. Used for tracing
+volatile int Tdelete = 0; // new and delete of trans objects.
+
 //////////////////////////////////////////////////////////////////////
 // Construction/Destruction
 //////////////////////////////////////////////////////////////////////
@@ -45,6 +51,7 @@
 {
 	database = db;
 	transactionSequence = 1;
+	transitionEventSequence = 1;
 	committed = 0;
 	rolledBack = 0;
 	priorCommitted = 0;
@@ -111,46 +118,15 @@
 Transaction* TransactionManager::startTransaction(Connection* connection)
 {
 	Sync sync (&activeTransactions.syncObject, "TransactionManager::startTransaction");
-	sync.lock (Shared);
-	Transaction *transaction;
-
-	for (transaction = activeTransactions.first; transaction; transaction = transaction->next)
-		if (transaction->state == Available && transaction->dependencies == 0)
-			if (COMPARE_EXCHANGE(&transaction->state, Available, Initializing))
-				{
-				// Check again that the dependencies are zero. The transaction
-				// object might have been re-use between the previous if-test
-				// and the actual change of state
-
-				if (transaction->dependencies != 0)
-					{
-					// Return the transaction object back to the list
-
-					transaction->state = Available;
-					}
-				else
-					{
-					ASSERT(transaction->dependencies == 0);
-					transaction->initialize(connection, INTERLOCKED_INCREMENT(transactionSequence));
-
-					return transaction;
-					}
-				}
-
-	sync.unlock();
 	sync.lock(Exclusive);
 
-	transaction = new Transaction (connection, INTERLOCKED_INCREMENT(transactionSequence));
+	Transaction *transaction = new Transaction (connection, INTERLOCKED_INCREMENT(transactionSequence));
+
+	// Assign a start transition event number to the transaction
+
+	transaction->startEvent = INTERLOCKED_INCREMENT(transitionEventSequence);
 	activeTransactions.append(transaction);
 
-	// And, just for yucks, add another 10 Available transactions
-
-	for (int n = 0; n < EXTRA_TRANSACTIONS; ++n)
-		{
-		Transaction *trans = new Transaction(connection, 0);
-		activeTransactions.append(trans);
-		}
-
 	return transaction;
 }
 
@@ -302,30 +278,46 @@
 
 void TransactionManager::purgeTransactions()
 {
+	Sync syncActive(&activeTransactions.syncObject, "TransactionManager::purgeTransaction");
+	syncActive.lock(Shared);
+
 	Sync syncCommitted(&committedTransactions.syncObject, "Transaction::purgeTransactions");
 	syncCommitted.lock(Exclusive);
+
+	fprintf(stderr, "TM::purgeTransactions: active=%d committed=%d alloc=%d delete=%d diff=%d\n", activeTransactions.count, committedTransactions.count, Talloc, Tdelete, (Talloc-Tdelete));
+
+	// Find the start transition event of the oldest active transaction
+
+	TransEvent oldestActive = TRANS_EVENT_MAX;
+
+	if (activeTransactions.first != NULL)
+		{
+		oldestActive = activeTransactions.first->startEvent;
+		}
+	syncActive.unlock();
 	
 	// Check for any fully mature transactions to ditch
-	
-	for (Transaction *transaction, *next = committedTransactions.first; (transaction = next);)
+  
+    Transaction* transaction = committedTransactions.first;
+
+    while ((transaction != NULL) &&
+		   (transaction->state == Committed) &&
+		   (transaction->commitEvent < oldestActive) &&
+		   !transaction->writePending)
 		{
-		next = transaction->next;
+		transaction->commitRecords();
 
-		if ((transaction->state == Committed) && 
-			(transaction->dependencies == 0) && 
-			!transaction->writePending)
+		if (COMPARE_EXCHANGE(&transaction->inList, (INTERLOCK_TYPE) true, (INTERLOCK_TYPE) false))
 			{
-			transaction->commitRecords();
-
-			if (COMPARE_EXCHANGE(&transaction->inList, (INTERLOCK_TYPE) true, (INTERLOCK_TYPE) false))
-				{
-				committedTransactions.remove(transaction);
-				transaction->release();
-				}
+			committedTransactions.remove(transaction);
+			transaction->release();
 			}
+
+		transaction = committedTransactions.first;
 		}
 }
 
+
 void TransactionManager::getSummaryInfo(InfoTable* infoTable)
 {
 	Sync syncActive (&activeTransactions.syncObject, "TransactionManager::getSummaryInfo(2)");
@@ -374,7 +366,6 @@
 	Transaction *transaction;
 	int active = 0;
 	int available = 0;
-	int dependencies = 0;
 	time_t maxTime = 0;
 	
 	for (transaction = activeTransactions.first; transaction; transaction = transaction->next)
@@ -387,9 +378,6 @@
 		else if (transaction->state == Available)
 			{
 			++available;
-			
-			if (transaction->dependencies)
-				++dependencies;
 			}
 			
 	int pendingCleanup = committedTransactions.count;
@@ -399,8 +387,8 @@
 	priorRolledBack = rolledBack;
 	
 	if ((active || numberCommitted || numberRolledBack) && Log::isActive(LogInfo))
-		Log::log (LogInfo, "%d: Transactions: %d committed, %d rolled back, %d active, %d/%d available, %d post-commit, oldest %d seconds\n",
-				  database->deltaTime, numberCommitted, numberRolledBack, active, available, dependencies, pendingCleanup, maxTime);
+		Log::log (LogInfo, "%d: Transactions: %d committed, %d rolled back, %d active, %d available, %d post-commit, oldest %d seconds\n",
+				  database->deltaTime, numberCommitted, numberRolledBack, active, available, pendingCleanup, maxTime);
 }
 
 void TransactionManager::removeCommittedTransaction(Transaction* transaction)
@@ -412,16 +400,6 @@
 	transaction->release();
 }
 
-void TransactionManager::expungeTransaction(Transaction *transaction)
-{
-	Sync syncActiveTrans(&activeTransactions.syncObject, "TransactionManager::removeTransaction");
-	syncActiveTrans.lock(Shared);
-
-	for (Transaction *trans = activeTransactions.first; trans; trans = trans->next)
-		if ((trans->state != Available && trans->state != Initializing))
-			 //&& trans->transactionId > transaction->transactionId)
-			trans->expungeTransaction(transaction);
-}
 
 Transaction* TransactionManager::findTransaction(TransId transactionId)
 {
@@ -445,24 +423,6 @@
 	return NULL;
 }
 
-void TransactionManager::validateDependencies(void)
-{
-	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);
-			
-	syncActive.unlock();
-
-	Sync syncCommitted(&committedTransactions.syncObject, "TransactionManager::validateDepedendencies(2)");
-	syncCommitted.lock(Shared);
-
-	for (transaction = committedTransactions.first; transaction; transaction = transaction->next)
-		transaction->validateDependencies(true);
-}
 
 void TransactionManager::removeTransaction(Transaction* transaction)
 {

=== modified file 'storage/falcon/TransactionManager.h'
--- a/storage/falcon/TransactionManager.h	2008-08-11 13:22:53 +0000
+++ b/storage/falcon/TransactionManager.h	2008-12-01 14:26:41 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 MySQL AB
+/* Copyright (C) 2006 MySQL AB, 2008 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
@@ -44,15 +44,14 @@
 	void			purgeTransactions();
 	void			getSummaryInfo(InfoTable* infoTable);
 	void			reportStatistics(void);
-	void			expungeTransaction(Transaction *transaction);
 	Transaction* 	findTransaction(TransId transactionId);
-	void 			validateDependencies(void);
 	void			removeCommittedTransaction(Transaction* transaction);
 	void			removeTransaction(Transaction* transaction);
 	void			printBlockage(void);
 	void			printBlocking(Transaction* transaction, int level);
 	
 	INTERLOCK_TYPE	transactionSequence;
+	INTERLOCK_TYPE  transitionEventSequence;
 	Database		*database;
 	SyncObject		syncObject;
 	Transaction		*rolledBackTransaction;

Thread
bzr commit into mysql-6.0-falcon-team branch (olav:2738) WL#4654Olav Sandstaa1 Dec