Below is the list of changes that have just been committed into a local
6.0 repository of jas. When jas 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, 2008-05-08 16:37:28-04:00, jas@rowvwade. +4 -0
Replaced Bdb::flags with individual booleans for "dirty" and "registered"
(by PageWriter) to get around non-thread safe usage.
This is a fix for bugs 36294 and 36367.
storage/falcon/BDB.cpp@stripped, 2008-05-08 16:37:13-04:00, jas@rowvwade. +8 -7
Replaced Bdb::flags with individual booleans for "dirty" and "registered"
(by PageWriter) to get around non-thread safe usage.
storage/falcon/BDB.h@stripped, 2008-05-08 16:37:14-04:00, jas@rowvwade. +5 -3
Replaced Bdb::flags with individual booleans for "dirty" and "registered"
(by PageWriter) to get around non-thread safe usage.
storage/falcon/Cache.cpp@stripped, 2008-05-08 16:37:14-04:00, jas@rowvwade. +21 -22
Replaced Bdb::flags with individual booleans for "dirty" and "registered"
(by PageWriter) to get around non-thread safe usage.
storage/falcon/PageWriter.cpp@stripped, 2008-05-08 16:37:14-04:00, jas@rowvwade. +1 -1
Replaced Bdb::flags with individual booleans for "dirty" and "registered"
(by PageWriter) to get around non-thread safe usage.
diff -Nrup a/storage/falcon/BDB.cpp b/storage/falcon/BDB.cpp
--- a/storage/falcon/BDB.cpp 2008-03-27 02:08:48 -04:00
+++ b/storage/falcon/BDB.cpp 2008-05-08 16:37:13 -04:00
@@ -48,7 +48,8 @@ Bdb::Bdb()
prior = NULL;
hash = NULL;
buffer = NULL;
- flags = 0;
+ isDirty = false;
+ isRegistered = false;
pageNumber = -1;
useCount = 0;
age = 0;
@@ -91,10 +92,10 @@ void Bdb::mark(TransId transId)
++markingThread->pageMarks;
}
- if (!(flags & BDB_dirty))
+ if (!isDirty)
{
- flags |= BDB_dirty;
- cache->markDirty (this);
+ isDirty = true;
+ cache->markDirty(this);
}
}
@@ -117,10 +118,10 @@ void Bdb::release()
markingThread = NULL;
}
- if (flags & BDB_register)
+ if (isRegistered)
{
+ isRegistered = false;
cache->pageWriter->writePage(dbb, pageNumber, transactionId);
- flags &= ~BDB_register;
}
syncObject.unlock (NULL, lockType);
@@ -164,7 +165,7 @@ void Bdb::decrementUseCount()
void Bdb::setWriter()
{
- flags |= BDB_writer | BDB_register;
+ isRegistered = true;
}
#ifdef COLLECT_BDB_HISTORY
diff -Nrup a/storage/falcon/BDB.h b/storage/falcon/BDB.h
--- a/storage/falcon/BDB.h 2008-03-27 02:08:51 -04:00
+++ b/storage/falcon/BDB.h 2008-05-08 16:37:14 -04:00
@@ -51,12 +51,12 @@
#define BDB_HISTORY(_bdb_) {}
#endif
+/*** replaced by individual booleans
static const int BDB_dirty = 1;
-//static const int BDB_new = 2;
static const int BDB_writer = 4; // PageWriter wants to hear about this
static const int BDB_register = 8; // Register with PageWrite on next release
static const int BDB_write_pending = 16; // Asynchronous write is pending
-//static const int BDB_marked = (BDB_dirty | BDB_new);
+****/
class Page;
class Cache;
@@ -104,8 +104,10 @@ public:
SyncObject syncWrite;
time_t lastMark;
LockType lockType;
- short flags;
+ //short flags;
bool flushIt;
+ bool isDirty;
+ bool isRegistered; // page write cares
volatile INTERLOCK_TYPE useCount;
#ifdef COLLECT_BDB_HISTORY
diff -Nrup a/storage/falcon/Cache.cpp b/storage/falcon/Cache.cpp
--- a/storage/falcon/Cache.cpp 2008-04-11 22:22:41 -04:00
+++ b/storage/falcon/Cache.cpp 2008-05-08 16:37:14 -04:00
@@ -409,7 +409,7 @@ Bdb* Cache::findBuffer(Dbb *dbb, int pag
if (!bdb)
throw SQLError(RUNTIME_ERROR, "buffer pool is exhausted\n");
- if (!(bdb->flags & BDB_dirty))
+ if (!bdb->isDirty)
break;
writePage (bdb, WRITE_TYPE_REUSE);
@@ -503,7 +503,7 @@ void Cache::writePage(Bdb *bdb, int type
Sync writer(&bdb->syncWrite, "Cache::writePage");
writer.lock(Exclusive);
- if (!(bdb->flags & BDB_dirty))
+ if (!bdb->isDirty)
{
//Log::debug("Cache::writePage: page %d not dirty\n", bdb->pageNumber);
markClean (bdb);
@@ -511,7 +511,7 @@ void Cache::writePage(Bdb *bdb, int type
return;
}
- ASSERT(!(bdb->flags & BDB_write_pending));
+ //ASSERT(!(bdb->flags & BDB_write_pending));
Dbb *dbb = bdb->dbb;
ASSERT(database);
markClean (bdb);
@@ -572,11 +572,11 @@ void Cache::writePage(Bdb *bdb, int type
Log::debug("writing page %d/%d\n", bdb->pageNumber, dbb->tableSpaceId);
#endif
- bdb->flags &= ~BDB_dirty;
-
- if (pageWriter && (bdb->flags & BDB_writer))
+ bdb->isDirty = false;
+
+ if (pageWriter && bdb->isRegistered)
{
- bdb->flags &= ~(BDB_writer | BDB_register);
+ bdb->isRegistered = false;
pageWriter->pageWritten(bdb->dbb, bdb->pageNumber);
}
@@ -604,7 +604,7 @@ void Cache::analyze(Stream *stream)
{
++total;
- if (bdb->flags & BDB_dirty)
+ if (bdb->isDirty)
++dirty;
if (bdb->useCount)
@@ -637,13 +637,13 @@ void Cache::freePage(Dbb *dbb, int32 pag
for (Bdb *bdb = hashTable [slot]; bdb; bdb = bdb->hash)
if (bdb->pageNumber == pageNumber && bdb->dbb == dbb)
{
- if (bdb->flags & BDB_dirty)
+ if (bdb->isDirty)
{
sync.unlock();
markClean (bdb);
}
- bdb->flags &= ~BDB_dirty;
+ bdb->isDirty = false;
break;
}
}
@@ -658,7 +658,7 @@ void Cache::flush(Dbb *dbb)
for (Bdb *bdb = bdbs; bdb < endBdbs; ++bdb)
if (bdb->dbb == dbb)
{
- if (bdb->flags & BDB_dirty)
+ if (bdb->isDirty)
writePage(bdb, WRITE_TYPE_FORCE);
bdb->dbb = NULL;
@@ -750,7 +750,6 @@ void Cache::ioThread(void)
syncThread.lock(Shared);
Sync flushLock(&syncFlush, "Cache::ioThread");
Sync sync(&syncObject, "Cache::ioThread");
- //Sync syncPIO(&database->syncSerialLogIO, "Cache::ioThread");
Priority priority(database->ioScheduler);
Thread *thread = Thread::getThread("Cache::ioThread");
UCHAR *rawBuffer = new UCHAR[ASYNC_BUFFER_SIZE];
@@ -777,7 +776,7 @@ void Cache::ioThread(void)
// Look for a page to flush. Then get all his friends
for (Bdb *bdb = hashTable[slot]; bdb; bdb = bdb->hash)
- if (bdb->pageNumber == pageNumber && bdb->flushIt &&
(bdb->flags & BDB_dirty))
+ if (bdb->pageNumber == pageNumber && bdb->flushIt &&
bdb->isDirty)
{
hit = true;
count = 0;
@@ -797,20 +796,20 @@ void Cache::ioThread(void)
bdb->ioThreadNext = bdbList;
bdbList = bdb;
- ASSERT(!(bdb->flags & BDB_write_pending));
- bdb->flags |= BDB_write_pending;
+ //ASSERT(!(bdb->flags & BDB_write_pending));
+ //bdb->flags |= BDB_write_pending;
memcpy(p, bdb->buffer, pageSize);
p += pageSize;
bdb->flushIt = false;
markClean(bdb);
- bdb->flags &= ~BDB_dirty;
+ bdb->isDirty = false;
bdb->release(REL_HISTORY);
sync.lock(Shared);
if ( !(bdb = findBdb(dbb, bdb->pageNumber + 1)) )
break;
- if (!(bdb->flags & BDB_dirty) && !continueWrite(bdb))
+ if (!bdb->isDirty && !continueWrite(bdb))
break;
}
@@ -844,7 +843,7 @@ void Cache::ioThread(void)
for (bdb = bdbList; bdb; bdb = next)
{
- bdb->flags &= ~BDB_write_pending;
+ //bdb->flags &= ~BDB_write_pending;
next = bdb->ioThreadNext;
bdb->syncWrite.unlock();
bdb->decrementUseCount(REL_HISTORY);
@@ -877,8 +876,8 @@ void Cache::ioThread(void)
for (bdb = bdbList; bdb; bdb = next)
{
- ASSERT(bdb->flags & BDB_write_pending);
- bdb->flags &= ~BDB_write_pending;
+ //ASSERT(bdb->flags & BDB_write_pending);
+ //bdb->flags &= ~BDB_write_pending;
next = bdb->ioThreadNext;
bdb->syncWrite.unlock();
bdb->decrementUseCount(REL_HISTORY);
@@ -943,7 +942,7 @@ bool Cache::continueWrite(Bdb* startingB
if (!bdb)
return dirty >= clean;
- if (bdb->flags & BDB_dirty)
+ if (bdb->isDirty)
++dirty;
else
++clean;
@@ -1011,7 +1010,7 @@ void Cache::analyzeFlush(void)
for (int max = pageNumber + 5; pageNumber < max && (bdb = findBdb(dbb,
pageNumber)) && !bdb->flushIt; ++pageNumber)
{
- if (bdb->flags & BDB_dirty)
+ if (bdb->isDirty)
fprintf(traceFile, " %d dirty not flushed, type %d \n", pageNumber,
bdb->buffer->pageType);
else
fprintf(traceFile," %d not dirty, type %d\n", pageNumber,
bdb->buffer->pageType);
diff -Nrup a/storage/falcon/PageWriter.cpp b/storage/falcon/PageWriter.cpp
--- a/storage/falcon/PageWriter.cpp 2007-10-08 13:20:15 -04:00
+++ b/storage/falcon/PageWriter.cpp 2008-05-08 16:37:14 -04:00
@@ -182,7 +182,7 @@ void PageWriter::writer()
if (bdb)
{
- if (bdb->flags & BDB_dirty)
+ if (bdb->isDirty)
cache->writePage(bdb, WRITE_TYPE_PAGE_WRITER);
bdb->release(REL_HISTORY);
| Thread |
|---|
| • bk commit into 6.0 tree (jas:1.2674) | U-ROWVWADEjas | 8 May 2008 |