List:Commits« Previous MessageNext Message »
From:U-ROWVWADEjas Date:July 20 2007 6:41pm
Subject:bk commit into 6.0-falcon tree (jas:1.2649)
View as plain text  
Below is the list of changes that have just been committed into a local
6.0-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-07-20 12:41:38-04:00, jas@rowvwade. +4 -0
  Added a handful of local SavePoint to Transaction to avoid
  unnecessary memory allocations.

  storage/falcon/SavePoint.cpp@stripped, 2007-07-20 12:41:29-04:00, jas@rowvwade. +2 -0
    Commented out degenerate SavePoint constructor and destructor.

  storage/falcon/SavePoint.h@stripped, 2007-07-20 12:41:29-04:00, jas@rowvwade. +2 -2
    Commented out degenerate SavePoint constructor and destructor.

  storage/falcon/Transaction.cpp@stripped, 2007-07-20 12:41:30-04:00, jas@rowvwade. +34 -16
    Added a handful of local SavePoint to Transaction to avoid
    unnecessary memory allocations.

  storage/falcon/Transaction.h@stripped, 2007-07-20 12:41:30-04:00, jas@rowvwade. +5 -1
    Added a handful of local SavePoint to Transaction to avoid
    unnecessary memory allocations.

# 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.2/storage/falcon/SavePoint.cpp	2007-07-20 12:41:58 -04:00
+++ 1.3/storage/falcon/SavePoint.cpp	2007-07-20 12:41:58 -04:00
@@ -25,6 +25,7 @@
 // Construction/Destruction
 //////////////////////////////////////////////////////////////////////
 
+/***
 SavePoint::SavePoint()
 {
 }
@@ -33,3 +34,4 @@
 {
 
 }
+***/

--- 1.3/storage/falcon/SavePoint.h	2007-07-20 12:41:58 -04:00
+++ 1.4/storage/falcon/SavePoint.h	2007-07-20 12:41:58 -04:00
@@ -29,8 +29,8 @@
 class SavePoint
 {
 public:
-	SavePoint();
-	virtual ~SavePoint();
+	//SavePoint();
+	//virtual ~SavePoint();
 
 	SavePoint		*next;
 	RecordVersion	**records;

--- 1.118/storage/falcon/Transaction.cpp	2007-07-20 12:41:58 -04:00
+++ 1.119/storage/falcon/Transaction.cpp	2007-07-20 12:41:58 -04:00
@@ -67,11 +67,15 @@
 {
 	states = NULL;
 	statesAllocated = 0;
+	savePoints = NULL;
+	freeSavePoints = NULL;
 	initialize(cnct, seq);
 }
 
 void Transaction::initialize(Connection* cnct, TransId seq)
 {
+	ASSERT(savePoints == NULL);
+	ASSERT(freeSavePoints == NULL);
 	connection = cnct;
 	isolationLevel = connection->isolationLevel;
 	mySqlThreadId = connection->mySqlThreadId;
@@ -91,8 +95,6 @@
 	waitingFor = NULL;
 	useCount = 1;
 	curSavePointId = 0;
-	savePoints = NULL;
-	freeSavePoints = NULL;
 	deferredIndexes = NULL;
 	deferredIndexCount = 0;
 	xidLength = 0;
@@ -121,7 +123,13 @@
 
 		return;
 		}
-		
+	
+	for (int n = 0; n < LOCAL_SAVE_POINTS; ++n)
+		{
+		localSavePoints[n].next = freeSavePoints;
+		freeSavePoints = localSavePoints + n;
+		}
+	
 	syncActive.lock(NULL, Exclusive);
 	Transaction *oldest = transactionManager->findOldest();
 	oldestActive = (oldest) ? oldest->transactionId : transactionId;
@@ -191,19 +199,7 @@
 		record->release();
 		}
 	
-	SavePoint *savePoint;
-	
-	while ( (savePoint = savePoints) )
-		{
-		savePoints = savePoint->next;
-		delete savePoint;
-		}
-
-	while ( (savePoint = freeSavePoints) )
-		{
-		freeSavePoints = savePoint->next;
-		delete savePoint;
-		}
+	releaseSavePoints();
 	
 	if (deferredIndexes)
 		{
@@ -316,6 +312,7 @@
 	if (hasLocks)
 		releaseRecordLocks();
 
+	releaseSavePoints();
 	Sync syncActiveTransactions(&transactionManager->activeTransactions.syncObject,
"Transaction::commitNoUpdates");
 	syncActiveTransactions.lock(Shared);
 	releaseDependencies();
@@ -1140,4 +1137,25 @@
 			ASSERT(!noDependencies);
 			ASSERT(state->transaction->transactionId == state->transactionId);
 			}
+}
+
+void Transaction::releaseSavePoints(void)
+{
+	SavePoint *savePoint;
+	
+	while ( (savePoint = savePoints) )
+		{
+		savePoints = savePoint->next;
+		
+		if (savePoint < localSavePoints || savePoint >= localSavePoints +
LOCAL_SAVE_POINTS)
+			delete savePoint;
+		}
+
+	while ( (savePoint = freeSavePoints) )
+		{
+		freeSavePoints = savePoint->next;
+		
+		if (savePoint < localSavePoints || savePoint >= localSavePoints +
LOCAL_SAVE_POINTS)
+			delete savePoint;
+		}
 }

--- 1.56/storage/falcon/Transaction.h	2007-07-20 12:41:58 -04:00
+++ 1.57/storage/falcon/Transaction.h	2007-07-20 12:41:58 -04:00
@@ -26,6 +26,7 @@
 
 #include "SyncObject.h"
 #include "SerialLog.h"
+#include "SavePoint.h"
 
 static const int NO_TRANSACTION = 0;
 
@@ -34,7 +35,6 @@
 class Transaction;
 class Connection;
 class Table;
-class SavePoint;
 class IO;
 class DeferredIndex;
 class Index;
@@ -76,6 +76,8 @@
 	RecordVersion	**records;
 	};
 
+static const int LOCAL_SAVE_POINTS = 5;
+
 // flags for getRelativeStates()
 #define WAIT_IF_ACTIVE		1
 #define DO_NOT_WAIT			2
@@ -134,6 +136,7 @@
 	Transaction		*waitingFor;
 	SavePoint		*savePoints;
 	SavePoint		*freeSavePoints;
+	SavePoint		localSavePoints[LOCAL_SAVE_POINTS];
 	DeferredIndex	*deferredIndexes;
 	int				deferredIndexCount;
 	int				statesAllocated;
@@ -179,6 +182,7 @@
 	void releaseCommittedTransaction(void);
 	void commitNoUpdates(void);
 	void validateDependencies(bool noDependencies);
+	void releaseSavePoints(void);
 };
 
 #endif // !defined(AFX_TRANSACTION_H__02AD6A4D_A433_11D2_AB5B_0000C01D2301__INCLUDED_)
Thread
bk commit into 6.0-falcon tree (jas:1.2649)U-ROWVWADEjas20 Jul