diff options
author | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2017-11-29 17:04:40 -0500 |
---|---|---|
committer | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2018-01-12 17:11:54 -0500 |
commit | f496011618ba7b1a99e6d9e51bea6966341cfd12 (patch) | |
tree | be4f55586855c535892f138c24616cf90fe29277 /src/mongo/db/repl/replication_coordinator_impl.h | |
parent | 427d09d191ba7fd6187eff01ab522ed5b0714f28 (diff) | |
download | mongo-f496011618ba7b1a99e6d9e51bea6966341cfd12.tar.gz |
SERVER-28290 Stepping down due to a higher term seen in a heartbeat should not discard term after stepdown.
Diffstat (limited to 'src/mongo/db/repl/replication_coordinator_impl.h')
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_impl.h b/src/mongo/db/repl/replication_coordinator_impl.h index ab3873868e6..aa53524763c 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.h +++ b/src/mongo/db/repl/replication_coordinator_impl.h @@ -386,7 +386,6 @@ public: * Returns event handle that we can use to wait for the operation to complete. * When the operation is complete (waitForEvent() returns), 'updateResult' will be set * to a status telling if the term increased or a stepdown was triggered. - */ executor::TaskExecutor::EventHandle updateTerm_forTest( long long term, TopologyCoordinator::UpdateTermResult* updateResult); @@ -1342,6 +1341,10 @@ private: // This variable must be written immediately after _term, and thus its value can lag. // Reading this value does not require the replication coordinator mutex to be locked. AtomicInt64 _termShadow; // (S) + + // When we decide to step down due to hearing about a higher term, we remember the term we heard + // here so we can update our term to match as part of finishing stepdown. + boost::optional<long long> _pendingTermUpdateDuringStepDown; // (M) }; } // namespace repl |