summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/sync_source_feedback.cpp
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2017-01-10 12:05:30 -0500
committerBenety Goh <benety@mongodb.com>2017-01-12 09:40:13 -0500
commit2264c7411e119e6c3c8198f6c31f641e65b9f3cb (patch)
treedb8119f29c96a0e462bbbe6b13fa111c05211d59 /src/mongo/db/repl/sync_source_feedback.cpp
parentc920eb38186c6122fed326ba341e05d7e02ffe37 (diff)
downloadmongo-2264c7411e119e6c3c8198f6c31f641e65b9f3cb.tar.gz
SERVER-27624 SyncSourceFeedback should check for shutdown before setting _reporter
Diffstat (limited to 'src/mongo/db/repl/sync_source_feedback.cpp')
-rw-r--r--src/mongo/db/repl/sync_source_feedback.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/mongo/db/repl/sync_source_feedback.cpp b/src/mongo/db/repl/sync_source_feedback.cpp
index 96ac055f792..c384fe6cf9b 100644
--- a/src/mongo/db/repl/sync_source_feedback.cpp
+++ b/src/mongo/db/repl/sync_source_feedback.cpp
@@ -114,13 +114,9 @@ void SyncSourceFeedback::forwardSlaveProgress() {
}
}
-Status SyncSourceFeedback::_updateUpstream(OperationContext* txn, BackgroundSync* bgsync) {
- Reporter* reporter;
- {
- stdx::lock_guard<stdx::mutex> lock(_mtx);
- reporter = _reporter;
- }
-
+Status SyncSourceFeedback::_updateUpstream(OperationContext* txn,
+ BackgroundSync* bgsync,
+ Reporter* reporter) {
auto syncTarget = reporter->getTarget();
auto triggerStatus = reporter->trigger();
@@ -240,6 +236,9 @@ void SyncSourceFeedback::run(executor::TaskExecutor* executor, BackgroundSync* b
keepAliveInterval);
{
stdx::lock_guard<stdx::mutex> lock(_mtx);
+ if (_shutdownSignaled) {
+ break;
+ }
_reporter = &reporter;
}
ON_BLOCK_EXIT([this]() {
@@ -247,7 +246,7 @@ void SyncSourceFeedback::run(executor::TaskExecutor* executor, BackgroundSync* b
_reporter = nullptr;
});
- auto status = _updateUpstream(txn.get(), bgsync);
+ auto status = _updateUpstream(txn.get(), bgsync, &reporter);
if (!status.isOK()) {
LOG(1) << "The replication progress command (replSetUpdatePosition) failed and will be "
"retried: "