summaryrefslogtreecommitdiff
path: root/src/mongo/s
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2022-03-10 09:14:47 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-03-10 10:00:45 +0000
commitd03d37af8b5ef60d828579e537ae0aab1f290719 (patch)
tree7d1ca1cf2e4db324be8a5ee2655c12f76e253023 /src/mongo/s
parentdb137621456c0db1e8e2362c525e347433a0f43f (diff)
downloadmongo-d03d37af8b5ef60d828579e537ae0aab1f290719.tar.gz
SERVER-63327 Make the Stale* exception handling uniform in all code paths
Diffstat (limited to 'src/mongo/s')
-rw-r--r--src/mongo/s/request_types/flush_database_cache_updates.idl2
-rw-r--r--src/mongo/s/stale_exception.h25
2 files changed, 20 insertions, 7 deletions
diff --git a/src/mongo/s/request_types/flush_database_cache_updates.idl b/src/mongo/s/request_types/flush_database_cache_updates.idl
index a4d331ff788..fb77d853623 100644
--- a/src/mongo/s/request_types/flush_database_cache_updates.idl
+++ b/src/mongo/s/request_types/flush_database_cache_updates.idl
@@ -38,6 +38,7 @@ commands:
_flushDatabaseCacheUpdates:
description: "An internal command to wait for the last routing table cache refresh for a particular database to be persisted to disk"
command_name: _flushDatabaseCacheUpdates
+ cpp_name: FlushDatabaseCacheUpdates
strict: true
namespace: type
api_version: ""
@@ -51,6 +52,7 @@ commands:
_flushDatabaseCacheUpdatesWithWriteConcern:
description: "The same behavior as _flushDatabaseCacheUpdates but accepts writeConcern"
command_name: _flushDatabaseCacheUpdatesWithWriteConcern
+ cpp_name: FlushDatabaseCacheUpdatesWithWriteConcern
strict: true
namespace: type
api_version: ""
diff --git a/src/mongo/s/stale_exception.h b/src/mongo/s/stale_exception.h
index 4aa22837a3a..70d7a0dc42e 100644
--- a/src/mongo/s/stale_exception.h
+++ b/src/mongo/s/stale_exception.h
@@ -50,7 +50,7 @@ public:
_received(received),
_wanted(wanted),
_shardId(shardId),
- _criticalSectionSignal(criticalSectionSignal) {}
+ _criticalSectionSignal(std::move(criticalSectionSignal)) {}
const auto& getNss() const {
return _nss;
@@ -117,8 +117,7 @@ protected:
boost::optional<ChunkVersion> _wanted;
ShardId _shardId;
- // This signal does not get serialized and therefore does not get propagated
- // to the router.
+ // This signal does not get serialized and therefore does not get propagated to the router
boost::optional<SharedSemiFuture<void>> _criticalSectionSignal;
};
@@ -154,10 +153,15 @@ class StaleDbRoutingVersion final : public ErrorExtraInfo {
public:
static constexpr auto code = ErrorCodes::StaleDbVersion;
- StaleDbRoutingVersion(std::string db,
- DatabaseVersion received,
- boost::optional<DatabaseVersion> wanted)
- : _db(std::move(db)), _received(received), _wanted(wanted) {}
+ StaleDbRoutingVersion(
+ std::string db,
+ DatabaseVersion received,
+ boost::optional<DatabaseVersion> wanted,
+ boost::optional<SharedSemiFuture<void>> criticalSectionSignal = boost::none)
+ : _db(std::move(db)),
+ _received(received),
+ _wanted(wanted),
+ _criticalSectionSignal(std::move(criticalSectionSignal)) {}
const auto& getDb() const {
return _db;
@@ -171,6 +175,10 @@ public:
return _wanted;
}
+ auto getCriticalSectionSignal() const {
+ return _criticalSectionSignal;
+ }
+
void serialize(BSONObjBuilder* bob) const override;
static std::shared_ptr<const ErrorExtraInfo> parse(const BSONObj&);
static StaleDbRoutingVersion parseFromCommandError(const BSONObj& commandError);
@@ -179,6 +187,9 @@ private:
std::string _db;
DatabaseVersion _received;
boost::optional<DatabaseVersion> _wanted;
+
+ // This signal does not get serialized and therefore does not get propagated to the router
+ boost::optional<SharedSemiFuture<void>> _criticalSectionSignal;
};
} // namespace mongo