List:Commits« Previous MessageNext Message »
From:U-ROWVWADEjas Date:April 6 2007 9:03pm
Subject:bk commit into 5.1-falcon tree (jas:1.2563)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1-falcon repository of . When  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-04-06 17:02:53-04:00, jas@rowvwade. +7 -0
  When creating a new Transaction, the TransactionManager
  now creates an extra 10 to reduce contention on the
  active transaction list.  Transactions, in turn, now
  need to be born "Available".

  storage/falcon/Database.cpp@stripped, 2007-04-06 17:02:43-04:00, jas@rowvwade. +1 -39
    Prepared obsolete "scavengeTransaction" mechanism.  Also
    deleted some dead code.

  storage/falcon/Database.h@stripped, 2007-04-06 17:02:43-04:00, jas@rowvwade. +2 -6
    Prepared obsolete "scavengeTransaction" mechanism.  Also
    deleted some dead code.

  storage/falcon/SerialLog.cpp@stripped, 2007-04-06 17:02:44-04:00, jas@rowvwade. +1 -1
    Fixed cut and paste error on a Sync declaration.

  storage/falcon/Transaction.cpp@stripped, 2007-04-06 17:02:44-04:00, jas@rowvwade. +13 -7
    When creating a new Transaction, the TransactionManager
    now creates an extra 10 to reduce contention on the
    active transaction list.  Transactions, in turn, now
    need to be born "Available".

  storage/falcon/Transaction.h@stripped, 2007-04-06 17:02:44-04:00, jas@rowvwade. +1 -1
    When creating a new Transaction, the TransactionManager
    now creates an extra 10 to reduce contention on the
    active transaction list.  Transactions, in turn, now
    need to be born "Available".

  storage/falcon/TransactionManager.cpp@stripped, 2007-04-06 17:02:45-04:00, jas@rowvwade. +28 -11
    When creating a new Transaction, the TransactionManager
    now creates an extra 10 to reduce contention on the
    active transaction list.  Transactions, in turn, now
    need to be born "Available".

  storage/falcon/TransactionManager.h@stripped, 2007-04-06 17:02:45-04:00, jas@rowvwade. +2 -1
    Deactivated obsolete scavengeTransactions mechanism.

# 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:	rowvwade.
# Root:	D:/MySQL/mysql-5.1-falcon

--- 1.4/storage/falcon/TransactionManager.cpp	2007-04-06 17:03:10 -04:00
+++ 1.5/storage/falcon/TransactionManager.cpp	2007-04-06 17:03:10 -04:00
@@ -25,6 +25,8 @@
 #include "Database.h"
 #include "Connection.h"
 
+static const int EXTRA_TRANSACTIONS = 10;
+
 #ifdef _DEBUG
 #undef THIS_FILE
 static char THIS_FILE[]=__FILE__;
@@ -52,19 +54,27 @@
 
 TransId TransactionManager::findOldestActive()
 {
-	TransId oldest = transactionSequence;
 	Sync sync (&activeTransactions.syncObject, "TransactionManager::findOldestActive");
 	sync.lock (Shared);
+	Transaction *oldest = findOldest();
+
+	if (oldest)
+		{
+		//oldest->scavenged = false;
 	
-	for (Transaction *transaction = activeTransactions.first; transaction; transaction = transaction->next)
-		if (transaction->isActive())
-			{
-			oldest = transaction->oldestActive;
-			transaction->scavenged = false;
-			break;
-			}
+		return oldest->oldestActive;
+		}
+		
+	return transactionSequence;
+}
 
-	sync.unlock();
+Transaction* TransactionManager::findOldest(void)
+{
+	Transaction *oldest = NULL;
+	
+	for (Transaction *transaction = activeTransactions.first; transaction; transaction = transaction->next)
+		if (transaction->isActive() && (!oldest || transaction->transactionId < oldest->transactionId))
+			oldest = transaction;
 	
 	return oldest;
 }
@@ -84,11 +94,16 @@
 				return transaction;
 				}
 				
-	transaction = new Transaction (connection, transactionSequence++);
 	sync.unlock();
 	sync.lock(Exclusive);
+	transaction = new Transaction (connection, transactionSequence++);
 	activeTransactions.append(transaction);
 
+	// And, just for yucks, add another 10 Available transactions
+	
+	for (int n = 0; n < EXTRA_TRANSACTIONS; ++n)
+		activeTransactions.append(new Transaction(connection, 0));
+	
 	return transaction;	
 }
 
@@ -115,6 +130,7 @@
 	return false;
 }
 
+/***
 void TransactionManager::scavengeRecords(int threshold)
 {
 	Sync sync (&activeTransactions.syncObject, "TransactionManager::scavengeRecord");
@@ -125,7 +141,7 @@
 		again = false;
 		
 		for (Transaction *transaction = activeTransactions.first; transaction; transaction = transaction->next)
-			if (transaction != database->systemConnection->transaction && transaction->isActive() &&!transaction->scavenged)
+			if (transaction != database->systemConnection->transaction && transaction->isActive() && !transaction->scavenged)
 				{
 				transaction->addRef();
 				sync.unlock();
@@ -137,6 +153,7 @@
 				}
 		}
 }
+***/
 
 void TransactionManager::commitByXid(int xidLength, const UCHAR* xid)
 {

--- 1.4/storage/falcon/TransactionManager.h	2007-04-06 17:03:10 -04:00
+++ 1.5/storage/falcon/TransactionManager.h	2007-04-06 17:03:10 -04:00
@@ -35,7 +35,7 @@
 	Transaction*	startTransaction(Connection* connection);
 	void			dropTable(Table* table, Transaction* transaction);
 	bool			hasUncommittedRecords(Table* table, Transaction* transaction);
-	void			scavengeRecords(int threshold);
+	//void			scavengeRecords(int threshold);
 	
 	TransId			transactionSequence;
 	Database		*database;
@@ -45,6 +45,7 @@
 	void commitByXid(int xidLength, const UCHAR* xid);
 	void rollbackByXid(int xidLength, const UCHAR* xid);
 	void print(void);
+	Transaction* findOldest(void);
 };
 
 #endif

--- 1.51/storage/falcon/Database.cpp	2007-04-06 17:03:10 -04:00
+++ 1.52/storage/falcon/Database.cpp	2007-04-06 17:03:10 -04:00
@@ -1167,13 +1167,6 @@
 	dbb->deleteIndex (indexId, indexVersion, TRANSACTION_ID(transaction));
 }
 
-/***
-void Database::scanIndex(int32 indexId, int indexVersion, IndexKey* lowKey, IndexKey* highKey, bool partial, Bitmap *bitmap)
-{
-	dbb->scanIndex (indexId, indexVersion, lowKey, highKey, partial, bitmap);
-}
-***/
-
 void Database::setDebug()
 {
 	dbb->setDebug();
@@ -1646,7 +1639,7 @@
 		ageGroupSizes [n] = ageGroupSizes [n - 1];
 
 	ageGroupSizes [0] = 0;
-	transactionManager->scavengeRecords(threshold);
+	//transactionManager->scavengeRecords(threshold);
 }
 
 void Database::printRecordMemory(int64 threshold, int64 total)
@@ -1992,13 +1985,6 @@
 	dbb->rollback(transaction->transactionId, transaction->hasUpdates);
 }
 
-/***
-void Database::prepare(Transaction *transaction)
-{
-	dbb->prepareTransaction(transaction->transactionId);
-}
-***/
-
 void Database::renameTable(Table* table, const char* newSchema, const char* newName)
 {
 	newSchema = getSymbol(newSchema);
@@ -2048,30 +2034,6 @@
 	if (serialLog)
 		serialLog->shutdownNow();
 }
-
-/***
-Transaction* Database::findTransaction(TransId transactionId)
-{
-	Sync sync (&activeTransactions.syncObject, "Database::findTransaction");
-	sync.lock (Shared);
-	Transaction *transaction;
-
-	for (transaction = activeTransactions.first; transaction; transaction = transaction->next)
-		if (transaction->transactionId == transactionId)
-			return transaction;
-	
-	sync.unlock();
-	Sync syncCommitted (&committedTransactions.syncObject, "Database::findTransaction");
-	syncCommitted.lock(Shared);
-	
-	for (transaction = committedTransactions.first; transaction; transaction = transaction->next)
-		if (transaction->transactionId == transactionId)
-			return transaction;
-	
-			
-	return NULL;
-}
-***/
 
 void Database::validateCache(void)
 {

--- 1.21/storage/falcon/Database.h	2007-04-06 17:03:10 -04:00
+++ 1.22/storage/falcon/Database.h	2007-04-06 17:03:10 -04:00
@@ -96,7 +96,6 @@
 class Database
 {
 public:
-	//void prepare (Transaction *transaction);
 	Database(const char *dbName, Configuration *config, Threads *parent);
 	virtual ~Database();
 
@@ -139,7 +138,6 @@
 	void ticker();
 	static void ticker (void *database);
 	bool deleteIndexEntry (int32 indexId, int indexVersion, IndexKey *key, int32 recordNumber, Transaction *transaction);
-	//void scavengeTransactions();
 	void scavenge();
 	void validate (int optionMask);
 	Role* findRole(const char *schemaName, const char * roleName);
@@ -176,7 +174,6 @@
 	int32			addInversion (InversionFilter *filter, Transaction *transaction);
 	void			clearDebug();
 	void			setDebug();
-	//void			scanIndex(int32 indexId, int indexVersion, IndexKey* lowKey, IndexKey* highKey, bool partial, Bitmap *bitmap);
 	void			deleteIndex (int32 indexId, int indexVersion, Transaction *transaction);
 	bool			addIndexEntry (int32 indexId, int indexVersion, IndexKey *key, int32 recordNumber, Transaction *transaction);
 	int32			createIndex(Transaction *transaction);
@@ -202,8 +199,9 @@
 	virtual void	createDatabase (const char *filename);
 	void			renameTable(Table* table, const char* newSchema, const char* newName);
 	bool			hasUncommittedRecords(Table* table, Transaction *transaction);
-	//Transaction* findTransaction(TransId transactionId);
 	void			validateCache(void);
+	void			commitByXid(int xidLength, const UCHAR* xid);
+	void			rollbackByXid(int xidLength, const UCHAR* xid);
 
 	Dbb				*dbb;
 	Cache			*cache;
@@ -274,8 +272,6 @@
 	int64			recordMemoryLower;
 	int64			lastRecordMemory;
 	time_t			creationTime;
-	void commitByXid(int xidLength, const UCHAR* xid);
-	void rollbackByXid(int xidLength, const UCHAR* xid);
 };
 
 #endif // !defined(AFX_DATABASE_H__5EC961D1_A406_11D2_AB5B_0000C01D2301__INCLUDED_)

--- 1.66/storage/falcon/SerialLog.cpp	2007-04-06 17:03:10 -04:00
+++ 1.67/storage/falcon/SerialLog.cpp	2007-04-06 17:03:10 -04:00
@@ -1194,7 +1194,7 @@
 
 void SerialLog::logInfo(void)
 {
-	Sync sync(&pending.syncObject, "SerialLog::preFlush");
+	Sync sync(&pending.syncObject, "SerialLog::logInfo");
 	sync.lock(Shared);
 	int count = 0;
 	uint64 minBlockNumber = writeBlock->blockNumber;

--- 1.65/storage/falcon/Transaction.cpp	2007-04-06 17:03:10 -04:00
+++ 1.66/storage/falcon/Transaction.cpp	2007-04-06 17:03:10 -04:00
@@ -71,7 +71,6 @@
 	hasLocks = false;
 	writePending = true;
 	waitingFor = NULL;
-	syncActive.lock(NULL, Exclusive);
 	useCount = 1;
 	curSavePointId = 0;
 	savePoints = NULL;
@@ -83,11 +82,18 @@
 	scanIndexCount = 0;
 	writeCount = 0;
 	totalRecordData = 0;
-	Transaction *oldest = transactionManager->activeTransactions.first;
+	numberStates = 0;
+	//scavenged = false;
 	
-	while (oldest && !oldest->isActive())
-		oldest = oldest->next;
-
+	if (seq == 0)
+		{
+		state = Available;
+		
+		return;
+		}
+		
+	syncActive.lock(NULL, Exclusive);
+	Transaction *oldest = transactionManager->findOldest();
 	oldestActive = (oldest) ? oldest->transactionId : transactionId;
 	int count = transactionManager->activeTransactions.count;
 	
@@ -98,8 +104,6 @@
 		states = new TransState [statesAllocated];
 		}
 	
-	numberStates = 0;
-	
 	if (count)
 		for (Transaction *transaction = transactionManager->activeTransactions.first; transaction; transaction = transaction->next)
 			if (transaction->isActive() && !transaction->systemTransaction)
@@ -808,10 +812,12 @@
 		}
 }
 
+/***
 void Transaction::scavengeRecords(int ageGroup)
 {
 	scavenged = true;
 }
+***/
 
 void Transaction::add(DeferredIndex* deferredIndex)
 {

--- 1.30/storage/falcon/Transaction.h	2007-04-06 17:03:10 -04:00
+++ 1.31/storage/falcon/Transaction.h	2007-04-06 17:03:10 -04:00
@@ -141,7 +141,7 @@
 	bool			systemTransaction;
 	bool			hasUpdates;
 	bool			writePending;
-	bool			scavenged;
+	//bool			scavenged;
 	bool			hasLocks;
 	SyncObject		syncActive;
 	SyncObject		syncIndexes;
Thread
bk commit into 5.1-falcon tree (jas:1.2563)U-ROWVWADEjas6 Apr