summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl
diff options
context:
space:
mode:
authorKatherine Walker <katherine.walker@mongodb.com>2017-10-13 15:03:17 -0400
committerKatherine Walker <katherine.walker@mongodb.com>2017-10-13 15:03:17 -0400
commit0f9d6085526921dd8edaffce827ffd07653ee4cd (patch)
tree1ce2c1c1661c8f18c2e99c10b720270ce126b083 /src/mongo/db/repl
parent285ea409456815f5d36b07e301328e136d04374e (diff)
downloadmongo-0f9d6085526921dd8edaffce827ffd07653ee4cd.tar.gz
SERVER-31101 Drop WT table on secondary after collection is dropped
This reverts commit 285ea409456815f5d36b07e301328e136d04374e.
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r--src/mongo/db/repl/bgsync.cpp36
-rw-r--r--src/mongo/db/repl/bgsync.h2
2 files changed, 23 insertions, 15 deletions
diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp
index 2c83abd3488..c21c05fc3ae 100644
--- a/src/mongo/db/repl/bgsync.cpp
+++ b/src/mongo/db/repl/bgsync.cpp
@@ -265,15 +265,16 @@ void BackgroundSync::_runProducer() {
}
// we want to start when we're no longer primary
// start() also loads _lastOpTimeFetched, which we know is set from the "if"
- auto opCtx = cc().makeOperationContext();
- if (getState() == ProducerState::Starting) {
- start(opCtx.get());
+ {
+ auto opCtx = cc().makeOperationContext();
+ if (getState() == ProducerState::Starting) {
+ start(opCtx.get());
+ }
}
-
- _produce(opCtx.get());
+ _produce();
}
-void BackgroundSync::_produce(OperationContext* opCtx) {
+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 "
@@ -314,9 +315,11 @@ void BackgroundSync::_produce(OperationContext* opCtx) {
// find a target to sync from the last optime fetched
{
- const OpTime minValidSaved =
- _replicationProcess->getConsistencyMarkers()->getMinValid(opCtx);
-
+ OpTime minValidSaved;
+ {
+ auto opCtx = cc().makeOperationContext();
+ minValidSaved = _replicationProcess->getConsistencyMarkers()->getMinValid(opCtx.get());
+ }
stdx::lock_guard<stdx::mutex> lock(_mutex);
if (_state != ProducerState::Running) {
return;
@@ -439,9 +442,12 @@ void BackgroundSync::_produce(OperationContext* opCtx) {
// 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 (_replicationProcess->getConsistencyMarkers()->getAppliedThrough(opCtx).isNull()) {
- _replicationProcess->getConsistencyMarkers()->setAppliedThrough(
- opCtx, _replCoord->getMyLastAppliedOpTime());
+ {
+ auto opCtx = cc().makeOperationContext();
+ if (_replicationProcess->getConsistencyMarkers()->getAppliedThrough(opCtx.get()).isNull()) {
+ _replicationProcess->getConsistencyMarkers()->setAppliedThrough(
+ opCtx.get(), _replCoord->getMyLastAppliedOpTime());
+ }
}
// "lastFetched" not used. Already set in _enqueueDocuments.
@@ -513,8 +519,10 @@ void BackgroundSync::_produce(OperationContext* opCtx) {
// if it can't return a matching oplog start from the last fetch oplog ts field.
return;
} else if (fetcherReturnStatus.code() == ErrorCodes::OplogStartMissing) {
- auto storageInterface = StorageInterface::get(opCtx);
- _runRollback(opCtx, fetcherReturnStatus, source, syncSourceResp.rbid, storageInterface);
+ auto opCtx = cc().makeOperationContext();
+ auto storageInterface = StorageInterface::get(opCtx.get());
+ _runRollback(
+ opCtx.get(), fetcherReturnStatus, source, syncSourceResp.rbid, storageInterface);
} else if (fetcherReturnStatus == ErrorCodes::InvalidBSON) {
Seconds blacklistDuration(60);
warning() << "Fetcher got invalid BSON while querying oplog. Blacklisting sync source "
diff --git a/src/mongo/db/repl/bgsync.h b/src/mongo/db/repl/bgsync.h
index 1037fc623c5..427d195149c 100644
--- a/src/mongo/db/repl/bgsync.h
+++ b/src/mongo/db/repl/bgsync.h
@@ -154,7 +154,7 @@ private:
void _run();
// Production thread inner loop.
void _runProducer();
- void _produce(OperationContext* opCtx);
+ void _produce();
/**
* Checks current background sync state before pushing operations into blocking queue and