summaryrefslogtreecommitdiff
path: root/src/mongo/db/prefetch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/prefetch.cpp')
-rw-r--r--src/mongo/db/prefetch.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/mongo/db/prefetch.cpp b/src/mongo/db/prefetch.cpp
index 7634b2d862a..36ad06ef964 100644
--- a/src/mongo/db/prefetch.cpp
+++ b/src/mongo/db/prefetch.cpp
@@ -55,8 +55,12 @@ namespace mongo {
"repl.preload.docs",
&prefetchDocStats );
+ void prefetchIndexPages(Collection* collection, const BSONObj& obj);
+ void prefetchRecordPages(OperationContext* txn, const char* ns, const BSONObj& obj);
+
+
// prefetch for an oplog operation
- void prefetchPagesForReplicatedOp(Database* db, const BSONObj& op) {
+ void prefetchPagesForReplicatedOp(OperationContext* txn, Database* db, const BSONObj& op) {
const char *opField;
const char *opType = op.getStringField("op");
switch (*opType) {
@@ -110,10 +114,11 @@ namespace mongo {
// do not prefetch the data for capped collections because
// they typically do not have an _id index for findById() to use.
!collection->isCapped()) {
- prefetchRecordPages(ns, obj);
+ prefetchRecordPages(txn, ns, obj);
}
}
+ // page in pages needed for all index lookups on a given object
void prefetchIndexPages(Collection* collection, const BSONObj& obj) {
DiskLoc unusedDl; // unused
BSONObjSet unusedKeys;
@@ -170,8 +175,8 @@ namespace mongo {
}
}
-
- void prefetchRecordPages(const char* ns, const BSONObj& obj) {
+ // page in the data pages for a record associated with an object
+ void prefetchRecordPages(OperationContext* txn, const char* ns, const BSONObj& obj) {
BSONElement _id;
if( obj.getObjectID(_id) ) {
TimerHolder timer(&prefetchDocStats);
@@ -181,7 +186,7 @@ namespace mongo {
try {
// we can probably use Client::Context here instead of ReadContext as we
// have locked higher up the call stack already
- Client::ReadContext ctx( ns );
+ Client::ReadContext ctx(txn, ns);
if( Helpers::findById(ctx.ctx().db(), ns, builder.done(), result) ) {
// do we want to use Record::touch() here? it's pretty similar.
volatile char _dummy_char = '\0';