diff options
Diffstat (limited to 'src/mongo/s/stale_exception.h')
| -rw-r--r-- | src/mongo/s/stale_exception.h | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/mongo/s/stale_exception.h b/src/mongo/s/stale_exception.h index d82b18bab52..1778fe689a4 100644 --- a/src/mongo/s/stale_exception.h +++ b/src/mongo/s/stale_exception.h @@ -75,7 +75,7 @@ public: void serialize(BSONObjBuilder* bob) const; static std::shared_ptr<const ErrorExtraInfo> parse(const BSONObj& obj); -protected: +private: NamespaceString _nss; ChunkVersion _received; boost::optional<ChunkVersion> _wanted; @@ -85,24 +85,41 @@ protected: boost::optional<SharedSemiFuture<void>> _criticalSectionSignal; }; +// TODO (SERVER-74380): Rename the StaleEpoch code to StaleDownstreamRouter and the info to +// StaleDownstreamRouterInfo class StaleEpochInfo final : public ErrorExtraInfo { public: static constexpr auto code = ErrorCodes::StaleEpoch; + StaleEpochInfo(NamespaceString nss, ChunkVersion received, ChunkVersion wanted) + : _nss(std::move(nss)), _received(received), _wanted(wanted) {} + + // TODO (SERVER-74380): Remove this constructor StaleEpochInfo(NamespaceString nss) : _nss(std::move(nss)) {} const auto& getNss() const { return _nss; } + const auto& getVersionReceived() const { + return _received; + } + + const auto& getVersionWanted() const { + return _wanted; + } + void serialize(BSONObjBuilder* bob) const; static std::shared_ptr<const ErrorExtraInfo> parse(const BSONObj& obj); private: NamespaceString _nss; -}; -using StaleConfigException = ExceptionFor<ErrorCodes::StaleConfig>; + // TODO (SERVER-74380): These two fields are boost::optional for backwards compatibility. Either + // both of them are boost::none or both are set. + boost::optional<ChunkVersion> _received; + boost::optional<ChunkVersion> _wanted; +}; class StaleDbRoutingVersion final : public ErrorExtraInfo { public: |
