summaryrefslogtreecommitdiff
path: root/src/mongo/db/prefetch.cpp
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2014-04-17 12:13:59 -0400
committerEliot Horowitz <eliot@10gen.com>2014-04-17 13:14:04 -0400
commit03a7be273f670f01f3c510e43464d7ecd1ce2173 (patch)
treedf3b65ce9a85e7afbe63506851cc8e8bd1efca69 /src/mongo/db/prefetch.cpp
parent92748f2572fd6492bfccd56e339b7255017d15ee (diff)
downloadmongo-03a7be273f670f01f3c510e43464d7ecd1ce2173.tar.gz
SERVER-13084: remove Client::database and make many things not use thread local versions
Diffstat (limited to 'src/mongo/db/prefetch.cpp')
-rw-r--r--src/mongo/db/prefetch.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/mongo/db/prefetch.cpp b/src/mongo/db/prefetch.cpp
index ee1646288e8..fdcd3bc2c75 100644
--- a/src/mongo/db/prefetch.cpp
+++ b/src/mongo/db/prefetch.cpp
@@ -56,7 +56,7 @@ namespace mongo {
&prefetchDocStats );
// prefetch for an oplog operation
- void prefetchPagesForReplicatedOp(const BSONObj& op) {
+ void prefetchPagesForReplicatedOp(Database* db, const BSONObj& op) {
const char *opField;
const char *opType = op.getStringField("op");
switch (*opType) {
@@ -75,10 +75,6 @@ namespace mongo {
BSONObj obj = op.getObjectField(opField);
const char *ns = op.getStringField("ns");
- Database* db = cc().database();
- if ( !db )
- return;
-
Collection* collection = db->getCollection( ns );
if ( !collection )
return;
@@ -185,12 +181,12 @@ namespace mongo {
// we can probably use Client::Context here instead of ReadContext as we
// have locked higher up the call stack already
Client::ReadContext ctx( ns );
- if( Helpers::findById(cc(), ns, builder.done(), result) ) {
+ 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';
// Touch the first word on every page in order to fault it into memory
- for (int i = 0; i < result.objsize(); i += g_minOSPageSizeBytes) {
- _dummy_char += *(result.objdata() + i);
+ for (int i = 0; i < result.objsize(); i += g_minOSPageSizeBytes) {
+ _dummy_char += *(result.objdata() + i);
}
// hit the last page, in case we missed it above
_dummy_char += *(result.objdata() + result.objsize() - 1);