summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatherine Walker <katherine.walker@mongodb.com>2017-10-13 15:03:17 -0400
committerBenety Goh <benety@mongodb.com>2017-11-17 15:08:32 -0500
commit85eec1d61a2bc6a7b7a1391fd787ad00eadc5060 (patch)
tree92dc18ca9aa5339b14345f226ced4067115c4a0d
parent8c2ece023718fd8b23629a55392399dae0be1581 (diff)
downloadmongo-85eec1d61a2bc6a7b7a1391fd787ad00eadc5060.tar.gz
SERVER-31101 Drop WT table on secondary after collection is dropped
(cherry picked from commit 0f9d6085526921dd8edaffce827ffd07653ee4cd)
-rw-r--r--src/mongo/db/repl/bgsync.cpp29
-rw-r--r--src/mongo/db/repl/bgsync.h2
2 files changed, 21 insertions, 10 deletions
diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp
index 98d86f0c7c0..8aca1292631 100644
--- a/src/mongo/db/repl/bgsync.cpp
+++ b/src/mongo/db/repl/bgsync.cpp
@@ -262,15 +262,15 @@ void BackgroundSync::_producerThread() {
}
// we want to start when we're no longer primary
// start() also loads _lastOpTimeFetched, which we know is set from the "if"
- OperationContextImpl txn;
if (isStopped()) {
- start(&txn);
+ OperationContextImpl opCtx;
+ start(&opCtx);
}
- _produce(&txn);
+ _produce();
}
-void BackgroundSync::_produce(OperationContext* txn) {
+void BackgroundSync::_produce() {
if (MONGO_FAIL_POINT(stopReplProducer)) {
// This log output is used in js tests so please leave it.
log() << "bgsync - stopReplProducer fail point "
@@ -316,14 +316,19 @@ void BackgroundSync::_produce(OperationContext* txn) {
OplogReader syncSourceReader;
OpTime minValid;
if (_replCoord->getMemberState().recovering()) {
- auto minValidSaved = getMinValid(txn);
+ OperationContextImpl opCtx;
+ auto minValidSaved = getMinValid(&opCtx);
if (minValidSaved > lastOpTimeFetched) {
minValid = minValidSaved;
}
}
int rbid;
- syncSourceReader.connectToSyncSource(txn, lastOpTimeFetched, minValid, _replCoord, &rbid);
+ {
+ OperationContextImpl opCtx;
+ syncSourceReader.connectToSyncSource(
+ &opCtx, lastOpTimeFetched, minValid, _replCoord, &rbid);
+ }
// no server found
if (syncSourceReader.getHost().empty()) {
@@ -373,8 +378,11 @@ void BackgroundSync::_produce(OperationContext* txn) {
// Set the applied point if unset. This is most likely the first time we've established a sync
// source since stepping down or otherwise clearing the applied point. We need to set this here,
// before the OplogWriter gets a chance to append to the oplog.
- if (getAppliedThrough(txn).isNull()) {
- setAppliedThrough(txn, _replCoord->getMyLastAppliedOpTime());
+ {
+ OperationContextImpl opCtx;
+ if (getAppliedThrough(&opCtx).isNull()) {
+ setAppliedThrough(&opCtx, _replCoord->getMyLastAppliedOpTime());
+ }
}
Status fetcherReturnStatus = Status::OK();
@@ -492,7 +500,10 @@ void BackgroundSync::_produce(OperationContext* txn) {
}
}
- _rollback(txn, source, rbid, getConnection);
+ {
+ OperationContextImpl opCtx;
+ _rollback(&opCtx, source, rbid, getConnection);
+ }
stop();
} else if (!fetcherReturnStatus.isOK()) {
warning() << "Fetcher error querying oplog: " << fetcherReturnStatus.toString();
diff --git a/src/mongo/db/repl/bgsync.h b/src/mongo/db/repl/bgsync.h
index 20ea6629ba0..e946f5feca5 100644
--- a/src/mongo/db/repl/bgsync.h
+++ b/src/mongo/db/repl/bgsync.h
@@ -170,7 +170,7 @@ private:
// Production thread
void _producerThread();
- void _produce(OperationContext* txn);
+ void _produce();
/**
* Signals to the applier that we have no new data,