List:Commits« Previous MessageNext Message »
From:Christoffer Hall Date:October 11 2007 7:31am
Subject:bk commit into 6.0 tree (hall:1.2628)
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of hall. When hall 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 07:31:14+02:00, hall@helheim.(none) +5 -0
  Aio fixes.

  storage/falcon/Aio.cpp@stripped, 2007-10-11 07:31:09+02:00, hall@helheim.(none) +24 -3
    Aio fixes.

  storage/falcon/Aio.h@stripped, 2007-10-11 07:31:09+02:00, hall@helheim.(none) +1 -0
    Aio fixes.

  storage/falcon/BDB.h@stripped, 2007-10-11 07:31:09+02:00, hall@helheim.(none) +2 -0
    Aio fixes.

  storage/falcon/Cache.cpp@stripped, 2007-10-11 07:31:09+02:00, hall@helheim.(none) +22 -16
    Move towards split submission and completion in page cache.

  storage/falcon/Cache.h@stripped, 2007-10-11 07:31:09+02:00, hall@helheim.(none) +1 -0
    
    Add function.

diff -Nrup a/storage/falcon/Aio.cpp b/storage/falcon/Aio.cpp
--- a/storage/falcon/Aio.cpp	2007-10-08 08:59:57 +02:00
+++ b/storage/falcon/Aio.cpp	2007-10-11 07:31:09 +02:00
@@ -109,11 +109,13 @@ Aio::~Aio()
 void Aio::signalAioRQ(AioRQ *rq)
 {
     // singal BDB
+    Log::debug("Signalling for bdb %d\n", rq->bdb->pageNumber);
+    rq->bdb->completion.wake();
 }
 
 void Aio::freeAioRQ(AioRQ *rq)
 {
-    Sync sync(&syncObject, "Aio::submitBdb");
+    Sync sync(&syncObject, "Aio::freeAioRQ");
     sync.lock(Exclusive);
 
     rq->isFree = true;
@@ -150,6 +152,22 @@ int Aio::allocAioRQ()
         }
 }
 
+void Aio::submitWrite(Bdb* bdb, bool async)
+{
+    submitBdb(bdb, async, true);
+}
+
+void Aio::submitRead(Bdb* bdb, bool async)
+{
+    submitBdb(bdb, async, false);
+}
+
+void Aio::waitFor(Bdb* bdb)
+{
+    Log::debug("Waiting for bdb %d\n", bdb->pageNumber);
+    bdb->completion.sleep();
+}
+
 void Aio::submitBdb(Bdb* bdb, bool async, bool isWrite)
 {
 
@@ -165,8 +183,11 @@ void Aio::submitBdb(Bdb* bdb, bool async
     rq->bdb = bdb;
     rq->isWrite = isWrite;
 
+    Log::debug("Submitting to fd: %d offset %lld size %d\n", fd, rq->offset,
rq->size);
+
     if (async)
         {
+
         aioWorkers->startWhenever("Aio worker thread", Aio::aioWorkerThread, rq);
         return;
         }
@@ -196,7 +217,7 @@ void Aio::write(int64 offset, int32 size
     rq->isWrite = true;
     
     pwrite(rq);
-
+    freeAioRQ(rq);
 }
 
 void Aio::read(int64 offset, int32 size, UCHAR *buffer)
@@ -214,6 +235,7 @@ void Aio::read(int64 offset, int32 size,
     
     pread(rq);
 
+    freeAioRQ(rq);
 }
 
 void Aio::aioWorkerThread(void *argument)
@@ -222,7 +244,6 @@ void Aio::aioWorkerThread(void *argument
     AioRQ *rq = (AioRQ *) argument;
     Aio *aio = rq->aio;
 
-    Sync sync(&aio->syncObject, "Aio::aioWorkerThread");
     if (rq->isWrite)
         aio->pwrite(rq);
     else
diff -Nrup a/storage/falcon/Aio.h b/storage/falcon/Aio.h
--- a/storage/falcon/Aio.h	2007-10-08 08:59:57 +02:00
+++ b/storage/falcon/Aio.h	2007-10-11 07:31:09 +02:00
@@ -55,6 +55,7 @@ public:
 
     void        submitRead(Bdb *buffer, bool async);
     void        submitWrite(Bdb *buffer, bool async);
+    void        waitFor(Bdb* bdb);
 
     static void aioWorkerThread(void *argument);
 
diff -Nrup a/storage/falcon/BDB.h b/storage/falcon/BDB.h
--- a/storage/falcon/BDB.h	2007-09-20 17:41:30 +02:00
+++ b/storage/falcon/BDB.h	2007-10-11 07:31:09 +02:00
@@ -25,6 +25,7 @@
 #endif // _MSC_VER >= 1000
 
 #include "SyncObject.h"
+#include "Synchronize.h"
 
 //#define COLLECT_BDB_HISTORY
 #if defined _DEBUG  && defined COLLECT_BDB_HISTORY
@@ -106,6 +107,7 @@ public:
 	short			flags;
 	bool			flushIt;
 	volatile INTERLOCK_TYPE	useCount;
+    Synchronize     completion;
 
 #ifdef COLLECT_BDB_HISTORY
 	SyncObject	historySyncObject;
diff -Nrup a/storage/falcon/Cache.cpp b/storage/falcon/Cache.cpp
--- a/storage/falcon/Cache.cpp	2007-09-20 17:41:32 +02:00
+++ b/storage/falcon/Cache.cpp	2007-10-11 07:31:09 +02:00
@@ -522,25 +522,13 @@ void Cache::markClean(Bdb *bdb)
 		clearPrecedence (bdb->higher);
 }
 
-void Cache::writePage(Bdb *bdb)
+void Cache::writePageComplete(Bdb *bdb)
 {
-	if (!(bdb->flags & BDB_dirty))
-		{
-		//Log::debug("Cache::writePage: page %d not dirty\n", bdb->pageNumber);
-		markClean (bdb);
-		return;
-		}
-
 	Dbb *database = bdb->dbb;
 	ASSERT(database);
-	markClean (bdb);
-	database->writePage(bdb);
-	
-#ifdef STOP_PAGE			
-	if (bdb->pageNumber == STOP_PAGE)
-		Log::debug("writing page %d/%d\n", bdb->pageNumber, dbb->tableSpaceId);
-#endif
-		
+
+	//markClean (bdb);
+
 	bdb->flags &= ~(BDB_dirty | BDB_new);
 
 	if (pageWriter && (bdb->flags & BDB_writer))
@@ -557,6 +545,24 @@ void Cache::writePage(Bdb *bdb)
 		for (DatabaseCopy *shadow = database->shadows; shadow; shadow = shadow->next)
 			shadow->rewritePage(bdb);
 		}
+}
+
+void Cache::writePage(Bdb *bdb)
+{
+	if (!(bdb->flags & BDB_dirty))
+		{
+		//Log::debug("Cache::writePage: page %d not dirty\n", bdb->pageNumber);
+		markClean (bdb);
+		return;
+		}
+
+	Dbb *database = bdb->dbb;
+	ASSERT(database);
+	markClean (bdb);
+	//database->writePage(bdb);
+	database->submitWrite(bdb, false);
+	//database->waitFor(bdb);
+    writePageComplete(bdb);
 }
 
 void Cache::analyze(Stream *stream)
diff -Nrup a/storage/falcon/Cache.h b/storage/falcon/Cache.h
--- a/storage/falcon/Cache.h	2007-09-20 17:41:32 +02:00
+++ b/storage/falcon/Cache.h	2007-10-11 07:31:09 +02:00
@@ -50,6 +50,7 @@ public:
 	void	analyze (Stream *stream);
 	void	writePage (Bdb *bdb);
 	void	markClean (Bdb *bdb);
+    void    writePageComplete(Bdb *bdb);
 	void	markDirty (Bdb *bdb);
 	void	validate();
 	void	moveToHead (Bdb *bdb);
Thread
bk commit into 6.0 tree (hall:1.2628)Christoffer Hall28 Nov