summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/replication_coordinator_impl.cpp
diff options
context:
space:
mode:
authorWilliam Schultz <william.schultz@mongodb.com>2020-03-02 09:51:01 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-02 15:14:48 +0000
commitf3c6ff922842d56abb15a39e64a27fc6ae087298 (patch)
tree793a240811be2747c7ccb7a74bcb9df7e5cdfb5f /src/mongo/db/repl/replication_coordinator_impl.cpp
parentfa63db9e59c9b45e448c00d5126c68b394ad7585 (diff)
downloadmongo-f3c6ff922842d56abb15a39e64a27fc6ae087298.tar.gz
SERVER-46288 Only drop snapshots on replica set reconfig if the config content changed
Diffstat (limited to 'src/mongo/db/repl/replication_coordinator_impl.cpp')
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index 235128a2656..cc35cf453ec 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -3273,7 +3273,15 @@ void ReplicationCoordinatorImpl::_finishReplSetReconfig(OperationContext* opCtx,
// On a reconfig we drop all snapshots so we don't mistakenly read from the wrong one.
// For example, if we change the meaning of the "committed" snapshot from applied -> durable.
- _dropAllSnapshots_inlock();
+ //
+ // If the new config has the same content but different version and term, skip it, since
+ // the quorum condition is still the same.
+ auto newConfigCopy = newConfig;
+ newConfigCopy.setConfigTerm(oldConfig.getConfigTerm());
+ newConfigCopy.setConfigVersion(oldConfig.getConfigVersion());
+ if (SimpleBSONObjComparator::kInstance.evaluate(oldConfig.toBSON() != newConfigCopy.toBSON())) {
+ _dropAllSnapshots_inlock();
+ }
lk.unlock();
_performPostMemberStateUpdateAction(action);