summaryrefslogtreecommitdiff
path: root/db/dur.cpp
diff options
context:
space:
mode:
authordwight <dwight@10gen.com>2010-12-17 07:59:45 -0500
committerdwight <dwight@10gen.com>2010-12-17 08:00:06 -0500
commit4efaae056697c024920bfe387cf31d6ec37c749f (patch)
treebadfbff27a1a0c94788235f473cd3681cee7b9a7 /db/dur.cpp
parent28904fa7ae991355a1043da387328ad98bb0ac84 (diff)
downloadmongo-4efaae056697c024920bfe387cf31d6ec37c749f.tar.gz
dur optimizing seeting context to local database as that will be super common case
Diffstat (limited to 'db/dur.cpp')
-rw-r--r--db/dur.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/db/dur.cpp b/db/dur.cpp
index 906b4030272..278e9e8b993 100644
--- a/db/dur.cpp
+++ b/db/dur.cpp
@@ -194,6 +194,8 @@ namespace mongo {
}
#endif
+ RelativePath local = RelativePath::fromRelativePath("local");
+
/** we will build an output buffer ourself and then use O_DIRECT
we could be in read lock for this
caller handles locking
@@ -239,18 +241,21 @@ namespace mongo {
mmf->willNeedRemap() = true;
}
i->w_ptr = ((char*)mmf->view_write()) + ofs;
- if( mmf->relativePath() != lastFilePath ) {
+ JEntry e;
+ e.len = i->len;
+ assert( ofs <= 0x80000000 );
+ e.ofs = (unsigned) ofs;
+ e.setFileNo( mmf->fileSuffixNo() );
+ if( mmf->relativePath() == local ) {
+ e.setLocalDbContextBit();
+ }
+ else if( mmf->relativePath() != lastFilePath ) {
lastFilePath = mmf->relativePath();
//assert( !str::startsWith(lastFilePath, dbpath) ); // dbpath should be stripped this is a relative path
JDbContext c;
bb.appendStruct(c);
bb.appendStr(lastFilePath.toString());
}
- JEntry e;
- e.len = i->len;
- assert( ofs <= 0x80000000 );
- e.ofs = (unsigned) ofs;
- e.fileNo = mmf->fileSuffixNo();
bb.appendStruct(e);
bb.appendBuf(i->p, i->len);
}