List:Commits« Previous MessageNext Message »
From:U-ROWVWADEjas Date:October 11 2007 7:23pm
Subject:bk commit into 6.0 tree (jas:1.2638)
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-10-11 15:23:28-04:00, jas@rowvwade. +2 -0
  Report possible page runs from Cache::flush.  Maybe we'll
  learn someting.

  storage/falcon/Cache.cpp@stripped, 2007-10-11 15:23:21-04:00, jas@rowvwade. +60 -13
    Report possible page runs from Cache::flush.  Maybe we'll
    learn someting.

  storage/falcon/Cache.h@stripped, 2007-10-11 15:23:21-04:00, jas@rowvwade. +5 -2
    Report possible page runs from Cache::flush.  Maybe we'll
    learn someting.

diff -Nrup a/storage/falcon/Cache.cpp b/storage/falcon/Cache.cpp
--- a/storage/falcon/Cache.cpp	2007-10-11 10:32:33 -04:00
+++ b/storage/falcon/Cache.cpp	2007-10-11 15:23:21 -04:00
@@ -38,6 +38,7 @@
 #include "DatabaseCopy.h"
 #include "Database.h"
 #include "Bitmap.h"
+#include ".\cache.h"
 
 extern uint falcon_purifier_interval;
 extern uint falcon_sync_threshold;
@@ -166,27 +167,36 @@ Cache::~Cache()
 Bdb* Cache::probePage(Dbb *dbb, int32 pageNumber)
 {
 	ASSERT (pageNumber >= 0);
-	int	slot = pageNumber % hashSize;
 	Sync sync (&syncObject, "Cache::probePage");
 	sync.lock (Shared);
+	Bdb *bdb = findBdb(dbb, pageNumber);
+	
+	if (bdb)
+		{
+		bdb->incrementUseCount(ADD_HISTORY);
+		sync.unlock();
 
-	for (Bdb *bdb = hashTable [slot]; bdb; bdb = bdb->hash)
-		if (bdb->pageNumber == pageNumber && bdb->dbb == dbb)
+		if (bdb->buffer->pageType == PAGE_free)
 			{
-			bdb->incrementUseCount(ADD_HISTORY);
-			sync.unlock();
+			bdb->decrementUseCount(REL_HISTORY);
+			
+			return NULL;
+			}
 
-			if (bdb->buffer->pageType == PAGE_free)
-				{
-				bdb->decrementUseCount(REL_HISTORY);
-				return NULL;
-				}
+		bdb->addRef(Shared  COMMA_ADD_HISTORY);
+		bdb->decrementUseCount(REL_HISTORY);
 
-			bdb->addRef(Shared  COMMA_ADD_HISTORY);
-			bdb->decrementUseCount(REL_HISTORY);
+		return bdb;
+		}
 
+	return NULL;
+}
+
+Bdb* Cache::findBdb(Dbb* dbb, int32 pageNumber)
+{
+	for (Bdb *bdb = hashTable [pageNumber % hashSize]; bdb; bdb = bdb->hash)
+		if (bdb->pageNumber == pageNumber && bdb->dbb == dbb)
 			return bdb;
-			}
 
 	return NULL;
 }
@@ -340,13 +350,39 @@ void Cache::flush(int64 arg)
 	flushLock.lock(Exclusive);
 	sync.lock(Shared);
 	flushArg = arg;
+	flushPages = 0;
 	
 	for (Bdb *bdb = firstDirty; bdb; bdb = bdb->nextDirty)
 		{
 		bdb->flushIt = true;
 		flushBitmap->set(bdb->pageNumber);
+		++flushPages;
 		}
+
+	int start = 0;
+	int last = 0;
+	int runs = 0;
+	int runPages = 0;
 	
+	for (int n = 0; (n = flushBitmap->nextSet(n)) >= 0; ++n)
+		if (n == last + 1)
+			++last;
+		else
+			{
+			if (last - start > 1)
+				{
+				Log::debug(" Flush run of %d pages starting at %d\n", last - start, start);
+				++runs;
+				runPages += last - start;
+				}
+				
+			last = start = n;
+			}
+	
+	if (runs > 0)
+		Log::debug("Flush: %d runs of %d pages out of %d\n", runs, runPages, flushPages);			
+			
+	flushStart = database->timestamp;
 	flushing = true;
 	sync.unlock();
 	flushLock.unlock();
@@ -602,8 +638,13 @@ void Cache::writePage(Bdb *bdb, int type
 	Dbb *dbb = bdb->dbb;
 	ASSERT(database);
 	markClean (bdb);
+	time_t start = database->timestamp;
 	dbb->writePage(bdb, type);
+	int delta = database->timestamp - start;
 	
+	if (delta > 1)
+		Log::debug("Page %d took %d seconds to write\n", bdb->pageNumber, delta);
+		
 #ifdef STOP_PAGE			
 	if (bdb->pageNumber == STOP_PAGE)
 		Log::debug("writing page %d/%d\n", bdb->pageNumber, dbb->tableSpaceId);
@@ -1005,6 +1046,12 @@ void Cache::ioThread(void)
 				{
 				flushing = false;
 				flushLock.unlock();
+				int delta = database->timestamp - flushStart;
+				
+				if (delta > 1)
+					Log::debug("Cache flush: %d pages in %d seconds\n",
+								flushPages, delta);
+
 				database->pageCacheFlushed(flushArg);
 				}
 			else
diff -Nrup a/storage/falcon/Cache.h b/storage/falcon/Cache.h
--- a/storage/falcon/Cache.h	2007-10-11 10:32:33 -04:00
+++ b/storage/falcon/Cache.h	2007-10-11 15:23:21 -04:00
@@ -81,8 +81,10 @@ public:
 	bool		flushing;
 
 protected:
-	Bdb* findBuffer (Dbb *dbb, int pageNumber, LockType lockType);
+	Bdb*		findBuffer (Dbb *dbb, int pageNumber, LockType lockType);
+	Bdb*		findBdb(Dbb* dbb, int32 pageNumber);
 
+	int64		flushArg;
 	Bdb			*bdbs;
 	Bdb			*endBdbs;
 	Queue<Bdb>	bufferQueue;
@@ -96,13 +98,14 @@ protected:
 	SyncObject	syncFlush;
 	SyncObject	syncDirty;
 	PagePrecedence	*freePrecedence;
+	time_t		flushStart;
+	int			flushPages;
 	int			hashSize;
 	int			pageSize;
 	int			upperFraction;
 	int			numberHunks;
 	int			numberDirtyPages;
 	int			numberIoThreads;
-	int64		flushArg;
 	volatile int bufferAge;
 };
 
Thread
bk commit into 6.0 tree (jas:1.2638)U-ROWVWADEjas11 Oct