diff options
author | Jack Mulrow <jack.mulrow@mongodb.com> | 2023-02-26 21:58:02 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-02-26 23:05:25 +0000 |
commit | 513497c66e3d3bfa810817fa826540a56b58fd67 (patch) | |
tree | 754e9d7d27d55461db15277813a85da0f5b62162 /src/mongo/s/mongos_main.cpp | |
parent | 728500f59d1a6be4fd95b8ffa7d3c7dd122b25be (diff) | |
download | mongo-513497c66e3d3bfa810817fa826540a56b58fd67.tar.gz |
SERVER-74382 Prevent ShardingReplicaSetChangeListener from failing to unset updateInProgress
Diffstat (limited to 'src/mongo/s/mongos_main.cpp')
-rw-r--r-- | src/mongo/s/mongos_main.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/s/mongos_main.cpp b/src/mongo/s/mongos_main.cpp index 33214b83693..8cbb3390b83 100644 --- a/src/mongo/s/mongos_main.cpp +++ b/src/mongo/s/mongos_main.cpp @@ -532,7 +532,9 @@ public: { stdx::lock_guard lock(_mutex); if (!_hasUpdateState(lock, setName)) { - _updateStates.emplace(setName, ReplSetConfigUpdateState()); + _updateStates.emplace(std::piecewise_construct, + std::forward_as_tuple(setName), + std::forward_as_tuple()); } auto& updateState = _updateStates.at(setName); updateState.nextUpdateToSend = connStr; @@ -661,6 +663,10 @@ private: mutable Mutex _mutex = MONGO_MAKE_LATCH("ShardingReplicaSetChangeListenerMongod::mutex"); struct ReplSetConfigUpdateState { + ReplSetConfigUpdateState() = default; + ReplSetConfigUpdateState(const ReplSetConfigUpdateState&) = delete; + ReplSetConfigUpdateState& operator=(const ReplSetConfigUpdateState&) = delete; + // True when an update to the config.shards is in progress. bool updateInProgress = false; boost::optional<ConnectionString> nextUpdateToSend; |