List:Commits« Previous MessageNext Message »
From:U-ROWVWADEjas Date:November 10 2007 7:13pm
Subject:bk commit into 6.0 tree (jas:1.2662)
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 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-11-10 14:13:02-05:00, jas@rowvwade. +6 -0
  Don't generate status reports if no log listener is going to
  report them.  And don't format any messages unless there is a log
  listener that wants them.

  storage/falcon/Cache.cpp@stripped, 2007-11-10 14:12:52-05:00, jas@rowvwade. +8 -4
    Don't generate status reports if no log listener is going to
    report them.

  storage/falcon/Dbb.cpp@stripped, 2007-11-10 14:12:52-05:00, jas@rowvwade. +3 -0
    Don't generate status reports if no log listener is going to
    report them.

  storage/falcon/Log.cpp@stripped, 2007-11-10 14:12:52-05:00, jas@rowvwade. +34 -4
    Don't even format log messages if no listener is interested
    in hearing about them.

  storage/falcon/Log.h@stripped, 2007-11-10 14:12:53-05:00, jas@rowvwade. +3 -2
    Add method to determine whether there is an interested log
    listener or not.

  storage/falcon/SerialLog.cpp@stripped, 2007-11-10 14:12:53-05:00, jas@rowvwade. +8 -1
    Don't generate status reports if no log listener is going to
    report them.

  storage/falcon/TransactionManager.cpp@stripped, 2007-11-10 14:12:54-05:00, jas@rowvwade. +1 -5
    Don't generate status reports if no log listener is going to
    report them.

diff -Nrup a/storage/falcon/Cache.cpp b/storage/falcon/Cache.cpp
--- a/storage/falcon/Cache.cpp	2007-11-07 11:17:53 -05:00
+++ b/storage/falcon/Cache.cpp	2007-11-10 14:12:52 -05:00
@@ -872,10 +872,14 @@ void Cache::syncFile(Dbb *dbb, const cha
 	int writes = dbb->writesSinceSync;
 	time_t start = database->timestamp;
 	dbb->sync();
-	time_t delta = database->timestamp - start;
 	
-	if (delta > 1)
-		Log::log(LogInfo, "%d: %s %s sync: %d pages in %d seconds\n", database->deltaTime, fileName, text, writes, delta);
+	if (Log::isActive(LogInfo))
+		{
+		time_t delta = database->timestamp - start;
+		
+		if (delta > 1)
+			Log::log(LogInfo, "%d: %s %s sync: %d pages in %d seconds\n", database->deltaTime, fileName, text, writes, delta);
+		}
 }
 
 void Cache::ioThread(void* arg)
@@ -995,7 +999,7 @@ void Cache::ioThread(void)
 				flushing = false;
 				flushLock.unlock();
 				
-				if (writes > 0)
+				if (writes > 0 && Log::isActive(LogInfo))
 					Log::log(LogInfo, "%d: Cache flush: %d pages, %d writes in %d seconds (%d pps)\n",
 								database->deltaTime, pages, writes, delta, pages / MAX(delta, 1));
 
diff -Nrup a/storage/falcon/Dbb.cpp b/storage/falcon/Dbb.cpp
--- a/storage/falcon/Dbb.cpp	2007-11-01 16:28:42 -04:00
+++ b/storage/falcon/Dbb.cpp	2007-11-10 14:12:52 -05:00
@@ -1110,6 +1110,9 @@ bool Dbb::hasDirtyPages()
 
 void Dbb::reportStatistics()
 {
+	if (!Log::isActive(LogInfo))
+		return;
+		
 	int deltaReads = reads - priorReads;
 	int deltaWrites = writes - priorWrites;
 	int deltaFlushWrites = flushWrites - priorFlushWrites;
diff -Nrup a/storage/falcon/Log.cpp b/storage/falcon/Log.cpp
--- a/storage/falcon/Log.cpp	2007-09-20 11:41:53 -04:00
+++ b/storage/falcon/Log.cpp	2007-11-10 14:12:52 -05:00
@@ -62,6 +62,7 @@ static pthread_mutex_t	mutex;
 
 static LogListener		*listeners;
 static SymbolManager	*symbols;
+static int				activeMask;
 volatile int			Log::exclusive;
 volatile Thread*		Log::exclusiveThread;
 
@@ -94,6 +95,9 @@ bool initialize()
 
 void Log::log(const char *txt, ...)
 {
+	if (!(activeMask & LogLog))
+		return;
+		
 	va_list		args;
 	va_start	(args, txt);
 	log (LogLog, txt, args);
@@ -101,6 +105,9 @@ void Log::log(const char *txt, ...)
 
 void Log::logBreak(const char *txt, ...)
 {
+	if (!(activeMask & LogLog))
+		return;
+
 	va_list		args;
 	va_start	(args, txt);
 	log (LogLog, txt, args);
@@ -108,6 +115,9 @@ void Log::logBreak(const char *txt, ...)
 
 void Log::debug(const char *txt, ...)
 {
+	if (!(activeMask & LogDebug))
+		return;
+
 	va_list		args;
 	va_start	(args, txt);
 	log (LogDebug, txt, args);
@@ -115,6 +125,9 @@ void Log::debug(const char *txt, ...)
 
 void Log::debugBreak(const char *txt, ...)
 {
+	if (!(activeMask & LogDebug))
+		return;
+
 	va_list		args;
 	va_start	(args, txt);
 	log (LogDebug, txt, args);
@@ -122,6 +135,9 @@ void Log::debugBreak(const char *txt, ..
 
 void Log::log(int mask, const char *txt, ...)
 {
+	if (!(activeMask & mask))
+		return;
+
 	va_list		args;
 	va_start	(args, txt);
 	log (mask, txt, args);
@@ -136,7 +152,8 @@ void Log::addListener(int mask, Listener
 {
 	ENTER_CRITICAL_SECTION;
 	LogListener *listener;
-
+	activeMask |= mask;
+	
 	for (listener = listeners; listener; listener = listener->next)
 		if (listener->listener == fn && listener->arg == arg)
 			{
@@ -169,6 +186,11 @@ void Log::deleteListener(Listener *fn, v
 			break;
 			}
 
+	activeMask = 0;
+	
+	for (LogListener *lissn = listeners; lissn; lissn = lissn->next)
+		activeMask |= listener->mask;
+		
 	LEAVE_CRITICAL_SECTION;
 }
 
@@ -181,6 +203,9 @@ int Log::init()
 
 void Log::log(int mask, const char *text, va_list args)
 {
+	if (!(activeMask & mask))
+		return;
+
 	char		temp [1024];
 
 	if (vsnprintf (temp, sizeof (temp) - 1, text, args) < 0)
@@ -191,9 +216,9 @@ void Log::log(int mask, const char *text
 
 void Log::logMessage(int mask, const char *text)
 {
-	//Thread *thread = Thread::getThread("Log::logMessage");
-	//Sync sync(&syncObject, "Log::logMessage");
-	//sync.lock(Exclusive);
+	if (!(activeMask & mask))
+		return;
+
 	char temp [1024], *scrubbed = temp;
 	bool inCS = false;
 
@@ -356,4 +381,9 @@ void Log::releaseExclusive(void)
 		exclusiveThread = NULL;
 		LEAVE_CRITICAL_SECTION;
 		}
+}
+
+bool Log::isActive(int mask)
+{
+	return (mask & activeMask) != 0;
 }
diff -Nrup a/storage/falcon/Log.h b/storage/falcon/Log.h
--- a/storage/falcon/Log.h	2007-09-20 11:41:53 -04:00
+++ b/storage/falcon/Log.h	2007-11-10 14:12:53 -05:00
@@ -59,14 +59,15 @@ public:
 	static void logMessage (int mask, const char *text);
 	static void log (int mask, const char *text, va_list args);
 	static void log (int mask, const char *txt, ...);
-	static int init();
-	static void deleteListener(Listener *fn, void *arg);
+	static int	init();
+	static void	deleteListener(Listener *fn, void *arg);
 	static void addListener (int mask, Listener *fn, void *arg);
 	static void print (int mask, const char *text, void *arg);
 	static void debug (const char *txt, ...);
 	static void log (const char *txt, ...);
 	static void setExclusive(void);
 	static void releaseExclusive(void);
+	static bool isActive(int mask);
 
 	static volatile int		exclusive;
 	static volatile Thread	*exclusiveThread;
diff -Nrup a/storage/falcon/SerialLog.cpp b/storage/falcon/SerialLog.cpp
--- a/storage/falcon/SerialLog.cpp	2007-11-05 14:48:15 -05:00
+++ b/storage/falcon/SerialLog.cpp	2007-11-10 14:12:53 -05:00
@@ -588,7 +588,7 @@ void SerialLog::createNewWindow(void)
 			break;
 			}
 
-	if (fileOffset == 0)
+	if (fileOffset == 0 && Log::isActive(LogInfo))
 		Log::log(LogInfo, "%d: Switching log files (%d used)\n", database->deltaTime, file->highWater);
 
 	writeWindow->deactivateWindow();
@@ -1299,8 +1299,12 @@ void SerialLog::setPhysicalBlock(TransId
 
 void SerialLog::reportStatistics(void)
 {
+	if (!Log::isActive(LogInfo))
+		return;
+		
 	Sync sync(&pending.syncObject, "SerialLog::reportStatistics");
 	sync.lock(Shared);
+	/***
 	int count = 0;
 	uint64 minBlockNumber = writeBlock->blockNumber;
 		
@@ -1311,7 +1315,10 @@ void SerialLog::reportStatistics(void)
 		if (action->minBlockNumber < minBlockNumber)
 			minBlockNumber = action->minBlockNumber;
 		}
+	***/
 	
+	uint64 minBlockNumber = (earliest) ? earliest->minBlockNumber : writeBlock->blockNumber;
+	int count = inactions.count;
 	uint64 delta = writeBlock->blockNumber - minBlockNumber;
 	int reads = windowReads - priorWindowReads;
 	priorWindowReads = windowReads;
diff -Nrup a/storage/falcon/TransactionManager.cpp b/storage/falcon/TransactionManager.cpp
--- a/storage/falcon/TransactionManager.cpp	2007-10-16 10:06:00 -04:00
+++ b/storage/falcon/TransactionManager.cpp	2007-11-10 14:12:54 -05:00
@@ -342,7 +342,7 @@ void TransactionManager::reportStatistic
 	priorCommitted = committed;
 	priorRolledBack = rolledBack;
 	
-	if (active || numberCommitted || numberRolledBack)
+	if ((active || numberCommitted || numberRolledBack) && Log::isActive(LogInfo))
 		Log::log (LogInfo, "%d: Transactions: %d committed, %d rolled back, %d active, %d post-commit, oldest %d seconds\n",
 				  database->deltaTime, numberCommitted, numberRolledBack, active, pendingCleanup, maxTime);
 }
@@ -358,10 +358,6 @@ void TransactionManager::removeCommitted
 
 void TransactionManager::expungeTransaction(Transaction *transaction)
 {
-	// There is an implicit assumption that the caller has a lock on activeTransactions.sycnObject
-	
-	//Sync syncCommitted(&committedTransactions.syncObject, "TransactionManager::expungeTransaction");
-	//syncCommitted.lock(Shared);
 	Sync sync(&syncInitialize, "TransactionManager::expungeTransaction");
 	sync.lock(Shared);
 
Thread
bk commit into 6.0 tree (jas:1.2662)U-ROWVWADEjas10 Nov