Skip to content

Commit b03877b

Browse files
author
Hari Khalsa
committed
SERVER-13641 put opctx into Runners
1 parent 2fdfb48 commit b03877b

21 files changed

+37
-31
lines changed

src/mongo/db/catalog/index_create.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ namespace mongo {
137137
collection->deleteDocument( txn, loc, false, true, &toDelete );
138138
logOp( txn, "d", ns.c_str(), toDelete );
139139

140-
if (!runner->restoreState()) {
140+
if (!runner->restoreState(txn)) {
141141
// Runner got killed somehow. This probably shouldn't happen.
142142
if (runnerEOF) {
143143
// Quote: "We were already at the end. Normal.

src/mongo/db/commands/mr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ namespace mongo {
880880
* After calling this method, the temp collection will be completed.
881881
* If inline, the results will be in the in memory map
882882
*/
883-
void State::finalReduce( CurOp * op , ProgressMeterHolder& pm ) {
883+
void State::finalReduce(CurOp * op , ProgressMeterHolder& pm ) {
884884

885885
if (_jsMode) {
886886
// apply the reduce within JS
@@ -995,7 +995,7 @@ namespace mongo {
995995
prev = o;
996996
all.push_back( o );
997997

998-
if (!runner->restoreState()) {
998+
if (!runner->restoreState(_txn)) {
999999
break;
10001000
}
10011001

@@ -1376,7 +1376,7 @@ namespace mongo {
13761376
// if not inline: dump the in memory map to inc collection, all data is on disk
13771377
state.dumpToInc();
13781378
// final reduce
1379-
state.finalReduce( op , pm );
1379+
state.finalReduce(op , pm );
13801380
reduceTime += rt.micros();
13811381
countsBuilder.appendNumber( "reduce" , state.numReduces() );
13821382
timingBuilder.appendNumber("reduceTime", reduceTime / 1000);

src/mongo/db/commands/parallel_collection_scan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ namespace mongo {
9090
_iterators[i]->prepareToYield();
9191
}
9292
}
93-
virtual bool restoreState() {
93+
virtual bool restoreState(OperationContext* opCtx) {
9494
for (size_t i = 0; i < _iterators.size(); i++) {
9595
if (!_iterators[i]->recoverFromYield()) {
9696
kill();

src/mongo/db/commands/pipeline_command.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ namespace {
118118

119119
// These are all no-ops for PipelineRunners
120120
virtual void saveState() {}
121-
virtual bool restoreState() { return true; }
121+
virtual bool restoreState(OperationContext* opCtx) { return true; }
122122
virtual const Collection* collection() { return NULL; }
123123

124124
/**

src/mongo/db/ops/delete_executor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ namespace mongo {
147147
// saving/restoring state repeatedly?
148148
runner->saveState();
149149
collection->deleteDocument(txn, rloc, false, false, logop ? &toDelete : NULL );
150-
runner->restoreState();
150+
runner->restoreState(txn);
151151

152152
nDeleted++;
153153

src/mongo/db/ops/update.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ namespace mongo {
663663
// Restore state after modification
664664
uassert(17278,
665665
"Update could not restore runner state after updating a document.",
666-
runner->restoreState());
666+
runner->restoreState(txn));
667667

668668
// Call logOp if requested.
669669
if (request.shouldCallLogOp() && !logObj.isEmpty()) {

src/mongo/db/pipeline/document_source_cursor.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "mongo/db/pipeline/document_source.h"
3232

3333
#include "mongo/db/instance.h"
34+
#include "mongo/db/operation_context_impl.h"
3435
#include "mongo/db/pipeline/document.h"
3536
#include "mongo/db/query/find_constants.h"
3637
#include "mongo/db/query/type_explain.h"
@@ -80,8 +81,9 @@ namespace mongo {
8081
// so we shouldn't check it again.
8182
Lock::DBRead lk(_ns);
8283
Client::Context ctx(_ns, storageGlobalParams.dbpath, /*doVersion=*/false);
84+
OperationContextImpl opCtx; // XXX TODO(MATHIAS)
8385

84-
_runner->restoreState();
86+
_runner->restoreState(&opCtx);
8587

8688
int memUsageBytes = 0;
8789
BSONObj obj;
@@ -201,10 +203,11 @@ namespace {
201203
{
202204
Lock::DBRead lk(_ns);
203205
Client::Context ctx(_ns, storageGlobalParams.dbpath, /*doVersion=*/false);
206+
OperationContextImpl opCtx; // XXX TODO(MATHIAS)
204207
massert(17392, "No _runner. Were we disposed before explained?",
205208
_runner);
206209

207-
_runner->restoreState();
210+
_runner->restoreState(&opCtx);
208211

209212
TypeExplain* explainRaw;
210213
explainStatus = _runner->getInfo(&explainRaw, NULL);

src/mongo/db/query/eof_runner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ namespace mongo {
5252
void EOFRunner::saveState() {
5353
}
5454

55-
bool EOFRunner::restoreState() {
55+
bool EOFRunner::restoreState(OperationContext* opCtx) {
5656
// TODO: Does this value matter?
5757
return false;
5858
}

src/mongo/db/query/eof_runner.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ namespace mongo {
6060

6161
virtual void saveState();
6262

63-
virtual bool restoreState();
63+
virtual bool restoreState(OperationContext* opCtx);
6464

6565
virtual void invalidate(const DiskLoc& dl, InvalidationType type);
6666

src/mongo/db/query/idhack_runner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ namespace mongo {
186186

187187
void IDHackRunner::saveState() { }
188188

189-
bool IDHackRunner::restoreState() { return true; }
189+
bool IDHackRunner::restoreState(OperationContext* opCtx) { return true; }
190190

191191
// Nothing to do here, holding no state.
192192
void IDHackRunner::invalidate(const DiskLoc& dl, InvalidationType type) {

0 commit comments

Comments
 (0)