diff options
-rw-r--r-- | src/mongo/db/prefetch.cpp | 18 | ||||
-rw-r--r-- | src/mongo/db/prefetch.h | 6 | ||||
-rw-r--r-- | src/mongo/db/repl/sync_tail.cpp | 5 |
3 files changed, 21 insertions, 8 deletions
diff --git a/src/mongo/db/prefetch.cpp b/src/mongo/db/prefetch.cpp index 9b2a0837a55..db5f92c3fdf 100644 --- a/src/mongo/db/prefetch.cpp +++ b/src/mongo/db/prefetch.cpp @@ -55,12 +55,18 @@ namespace mongo { "repl.preload.docs", &prefetchDocStats ); - void prefetchIndexPages(Collection* collection, const BSONObj& obj); + void prefetchIndexPages(Collection* collection, + const repl::ReplSetImpl::IndexPrefetchConfig& prefetchConfig, + const BSONObj& obj); + void prefetchRecordPages(OperationContext* txn, const char* ns, const BSONObj& obj); // prefetch for an oplog operation - void prefetchPagesForReplicatedOp(OperationContext* txn, Database* db, const BSONObj& op) { + void prefetchPagesForReplicatedOp(OperationContext* txn, + Database* db, + const repl::ReplSetImpl::IndexPrefetchConfig& prefetchConfig, + const BSONObj& op) { const char *opField; const char *opType = op.getStringField("op"); switch (*opType) { @@ -102,7 +108,7 @@ namespace mongo { // a way to achieve that would be to prefetch the record first, and then afterwards do // this part. // - prefetchIndexPages(collection, obj); + prefetchIndexPages(collection, prefetchConfig, obj); // do not prefetch the data for inserts; it doesn't exist yet // @@ -119,11 +125,11 @@ namespace mongo { } // page in pages needed for all index lookups on a given object - void prefetchIndexPages(Collection* collection, const BSONObj& obj) { + void prefetchIndexPages(Collection* collection, + const repl::ReplSetImpl::IndexPrefetchConfig& prefetchConfig, + const BSONObj& obj) { DiskLoc unusedDl; // unused BSONObjSet unusedKeys; - repl::ReplSetImpl::IndexPrefetchConfig prefetchConfig = - repl::theReplSet->getIndexPrefetchConfig(); // do we want prefetchConfig to be (1) as-is, (2) for update ops only, or (3) configured per op type? // One might want PREFETCH_NONE for updates, but it's more rare that it is a bad idea for inserts. diff --git a/src/mongo/db/prefetch.h b/src/mongo/db/prefetch.h index 36310b40676..89ac800bea4 100644 --- a/src/mongo/db/prefetch.h +++ b/src/mongo/db/prefetch.h @@ -29,6 +29,7 @@ #include "mongo/db/jsobj.h" #include "mongo/db/diskloc.h" +#include "mongo/db/repl/repl_set_impl.h" namespace mongo { class Collection; @@ -36,5 +37,8 @@ namespace mongo { class OperationContext; // page in both index and data pages for an op from the oplog - void prefetchPagesForReplicatedOp(OperationContext* txn, Database* db, const BSONObj& op); + void prefetchPagesForReplicatedOp(OperationContext* txn, + Database* db, + const repl::ReplSetImpl::IndexPrefetchConfig& prefetchConfig, + const BSONObj& op); } diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp index 742fa123412..569ea8f7f0a 100644 --- a/src/mongo/db/repl/sync_tail.cpp +++ b/src/mongo/db/repl/sync_tail.cpp @@ -130,7 +130,10 @@ namespace repl { // for multiple prefetches if they are for the same database. OperationContextImpl txn; Client::ReadContext ctx(&txn, ns); - prefetchPagesForReplicatedOp(&txn, ctx.ctx().db(), op); + prefetchPagesForReplicatedOp(&txn, + ctx.ctx().db(), + theReplSet->getIndexPrefetchConfig(), + op); } catch (const DBException& e) { LOG(2) << "ignoring exception in prefetchOp(): " << e.what() << endl; |