summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authordwight <dwight@10gen.com>2010-11-16 10:22:26 -0500
committerdwight <dwight@10gen.com>2010-11-16 10:22:26 -0500
commit92a84418550cf3e4d928d477613d505ad7f47145 (patch)
treecd1a2633b730fb3f2cfef77ff99398ad40329d4d /db
parentff803376640491d2b89b6dd11239be120404c8e8 (diff)
downloadmongo-92a84418550cf3e4d928d477613d505ad7f47145.tar.gz
dur
Diffstat (limited to 'db')
-rw-r--r--db/dur_journal.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/db/dur_journal.cpp b/db/dur_journal.cpp
index 408d8670eda..c75d6815666 100644
--- a/db/dur_journal.cpp
+++ b/db/dur_journal.cpp
@@ -59,8 +59,10 @@ namespace mongo {
unsigned nextFileNumber;
LogFile *lf;
string dir;
+ MVar<path> &toUnlink;
- Journal()
+ Journal() :
+ toUnlink(*(new MVar<path>)) /* freeing MVar at program termination would be problematic */
{
written = 0;
nextFileNumber = 0;
@@ -112,11 +114,10 @@ namespace mongo {
}
}
- static MVar<path> toUnlink;
void unlinkThread() {
Client::initThread("unlink");
while( 1 ) {
- path p = toUnlink.take();
+ path p = j.toUnlink.take();
try {
remove(p);
}
@@ -148,13 +149,13 @@ namespace mongo {
// we do unlinks asynchronously - unless they are falling behind.
// (unlinking big files can be slow on some operating systems; we don't want to stop world)
path p = j.getFilePathFor(fn);
- if( !toUnlink.tryPut(p) ) {
+ if( !j.toUnlink.tryPut(p) ) {
/* DR___ for durability error and warning codes
Compare to RS___ for replica sets
*/
log() << "DR100 latency warning on journal unlink" << endl;
Timer t;
- toUnlink.put(p);
+ j.toUnlink.put(p);
log() << "toUnlink.put() " << t.millis() << "ms" << endl;
}
}