summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTommaso Tocci <tommaso.tocci@mongodb.com>2021-08-05 13:38:59 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-08-05 14:27:12 +0000
commit3fba330aef29a34bbf93a191e0b50e39c5e70b16 (patch)
treea4247a1bd5fac5e4a7157f09029ff4001e21d809 /src
parent1f4dbf3dde9d6b3da361a4ec3a27647920d75a64 (diff)
downloadmongo-3fba330aef29a34bbf93a191e0b50e39c5e70b16.tar.gz
SERVER-54252 Cleanup legacy configOpTime gossiping
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/s/SConscript1
-rw-r--r--src/mongo/db/s/sharding_config_optime_gossip.cpp91
-rw-r--r--src/mongo/db/s/sharding_config_optime_gossip.h58
-rw-r--r--src/mongo/db/s/sharding_initialization_mongod.cpp2
-rw-r--r--src/mongo/db/s/sharding_server_status.cpp9
-rw-r--r--src/mongo/db/s/sharding_state_recovery.cpp21
-rw-r--r--src/mongo/db/s/vector_clock_shard_server_test.cpp11
-rw-r--r--src/mongo/db/service_entry_point_common.cpp2
-rw-r--r--src/mongo/db/service_entry_point_common.h2
-rw-r--r--src/mongo/db/service_entry_point_mongod.cpp13
-rw-r--r--src/mongo/db/vector_clock.cpp44
-rw-r--r--src/mongo/db/vector_clock.h10
-rw-r--r--src/mongo/db/vector_clock_mongod.cpp6
-rw-r--r--src/mongo/db/vector_clock_mongod_test.cpp11
-rw-r--r--src/mongo/embedded/service_entry_point_embedded.cpp2
-rw-r--r--src/mongo/rpc/SConscript2
-rw-r--r--src/mongo/rpc/metadata.cpp7
-rw-r--r--src/mongo/rpc/metadata/config_server_metadata.cpp88
-rw-r--r--src/mongo/rpc/metadata/config_server_metadata.h95
-rw-r--r--src/mongo/rpc/metadata/config_server_metadata_test.cpp73
-rw-r--r--src/mongo/s/SConscript15
-rw-r--r--src/mongo/s/catalog/sharding_catalog_client_impl.cpp15
-rw-r--r--src/mongo/s/client/shard_remote.cpp43
-rw-r--r--src/mongo/s/client/sharding_connection_hook.h2
-rw-r--r--src/mongo/s/config_server_catalog_cache_loader.cpp21
-rw-r--r--src/mongo/s/grid.cpp35
-rw-r--r--src/mongo/s/grid.h30
-rw-r--r--src/mongo/s/mongos_main.cpp5
-rw-r--r--src/mongo/s/s_sharding_server_status.cpp9
-rw-r--r--src/mongo/s/sharding_egress_metadata_hook.cpp128
-rw-r--r--src/mongo/s/sharding_egress_metadata_hook.h82
-rw-r--r--src/mongo/s/sharding_egress_metadata_hook_for_mongos.cpp50
-rw-r--r--src/mongo/s/sharding_egress_metadata_hook_for_mongos.h48
-rw-r--r--src/mongo/s/sharding_initialization.cpp1
-rw-r--r--src/mongo/s/sharding_router_test_fixture.cpp2
35 files changed, 101 insertions, 933 deletions
diff --git a/src/mongo/db/s/SConscript b/src/mongo/db/s/SConscript
index 8e20dabb18f..4f6211d4b4e 100644
--- a/src/mongo/db/s/SConscript
+++ b/src/mongo/db/s/SConscript
@@ -97,7 +97,6 @@ env.Library(
'shard_metadata_util.cpp',
'shard_server_catalog_cache_loader.cpp',
'shard_server_op_observer.cpp',
- 'sharding_config_optime_gossip.cpp',
'sharding_initialization_mongod.cpp',
'sharding_runtime_d_params.idl',
'sharding_state_recovery.cpp',
diff --git a/src/mongo/db/s/sharding_config_optime_gossip.cpp b/src/mongo/db/s/sharding_config_optime_gossip.cpp
deleted file mode 100644
index 7421ff74059..00000000000
--- a/src/mongo/db/s/sharding_config_optime_gossip.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * Copyright (C) 2018-present MongoDB, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the Server Side Public License, version 1,
- * as published by MongoDB, Inc.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * Server Side Public License for more details.
- *
- * You should have received a copy of the Server Side Public License
- * along with this program. If not, see
- * <http://www.mongodb.com/licensing/server-side-public-license>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the Server Side Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kSharding
-
-#include "mongo/platform/basic.h"
-
-#include "mongo/db/s/sharding_config_optime_gossip.h"
-
-#include "mongo/base/status.h"
-#include "mongo/db/auth/authorization_session.h"
-#include "mongo/db/repl/replication_coordinator.h"
-#include "mongo/db/s/sharding_state.h"
-#include "mongo/db/server_options.h"
-#include "mongo/rpc/metadata/config_server_metadata.h"
-#include "mongo/s/grid.h"
-
-namespace mongo {
-namespace rpc {
-
-void ShardingEgressMetadataHookForMongod::_saveGLEStats(const BSONObj& metadata,
- StringData hostString) {}
-
-repl::OpTime ShardingEgressMetadataHookForMongod::_getConfigServerOpTime() {
- if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer) {
- return repl::ReplicationCoordinator::get(_serviceContext)
- ->getCurrentCommittedSnapshotOpTime();
- }
-
- invariant(serverGlobalParams.clusterRole == ClusterRole::ShardServer);
- return Grid::get(_serviceContext)->configOpTime();
-}
-
-Status ShardingEgressMetadataHookForMongod::_advanceConfigOpTimeFromShard(
- OperationContext* opCtx, const ShardId& shardId, const BSONObj& metadataObj) {
- if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer) {
- return Status::OK();
- }
-
- return ShardingEgressMetadataHook::_advanceConfigOpTimeFromShard(opCtx, shardId, metadataObj);
-}
-
-void advanceConfigOpTimeFromRequestMetadata(OperationContext* opCtx) {
- auto const shardingState = ShardingState::get(opCtx);
-
- if (!shardingState->enabled()) {
- // Nothing to do if sharding state has not been initialized
- return;
- }
-
- boost::optional<repl::OpTime> opTime = rpc::ConfigServerMetadata::get(opCtx).getOpTime();
- if (!opTime)
- return;
-
- uassert(ErrorCodes::Unauthorized,
- "Unauthorized to update config opTime",
- AuthorizationSession::get(opCtx->getClient())
- ->isAuthorizedForActionsOnResource(ResourcePattern::forClusterResource(),
- ActionType::internal));
-
- Grid::get(opCtx)->advanceConfigOpTime(opCtx, *opTime);
-}
-
-} // namespace rpc
-} // namespace mongo
diff --git a/src/mongo/db/s/sharding_config_optime_gossip.h b/src/mongo/db/s/sharding_config_optime_gossip.h
deleted file mode 100644
index 67a4c3e5169..00000000000
--- a/src/mongo/db/s/sharding_config_optime_gossip.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Copyright (C) 2018-present MongoDB, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the Server Side Public License, version 1,
- * as published by MongoDB, Inc.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * Server Side Public License for more details.
- *
- * You should have received a copy of the Server Side Public License
- * along with this program. If not, see
- * <http://www.mongodb.com/licensing/server-side-public-license>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the Server Side Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#pragma once
-
-#include "mongo/s/sharding_egress_metadata_hook.h"
-
-namespace mongo {
-namespace rpc {
-
-class ShardingEgressMetadataHookForMongod final : public ShardingEgressMetadataHook {
-public:
- using ShardingEgressMetadataHook::ShardingEgressMetadataHook;
-
-private:
- void _saveGLEStats(const BSONObj& metadata, StringData hostString) override;
-
- repl::OpTime _getConfigServerOpTime() override;
-
- Status _advanceConfigOpTimeFromShard(OperationContext* opCtx,
- const ShardId& shardId,
- const BSONObj& metadataObj) override;
-};
-
-/**
- * Updates the ShardRegistry's stored notion of the config server optime based on the
- * ConfigServerMetadata decoration attached to the OperationContext.
- */
-void advanceConfigOpTimeFromRequestMetadata(OperationContext* opCtx);
-
-} // namespace rpc
-} // namespace mongo
diff --git a/src/mongo/db/s/sharding_initialization_mongod.cpp b/src/mongo/db/s/sharding_initialization_mongod.cpp
index b09c053d4eb..860cc8fb259 100644
--- a/src/mongo/db/s/sharding_initialization_mongod.cpp
+++ b/src/mongo/db/s/sharding_initialization_mongod.cpp
@@ -53,7 +53,6 @@
#include "mongo/db/s/read_only_catalog_cache_loader.h"
#include "mongo/db/s/shard_local.h"
#include "mongo/db/s/shard_server_catalog_cache_loader.h"
-#include "mongo/db/s/sharding_config_optime_gossip.h"
#include "mongo/db/s/transaction_coordinator_service.h"
#include "mongo/db/server_options.h"
#include "mongo/db/vector_clock_metadata_hook.h"
@@ -80,7 +79,6 @@ auto makeEgressHooksList(ServiceContext* service) {
auto unshardedHookList = std::make_unique<rpc::EgressMetadataHookList>();
unshardedHookList->addHook(std::make_unique<rpc::VectorClockMetadataHook>(service));
unshardedHookList->addHook(std::make_unique<rpc::ClientMetadataPropagationEgressHook>());
- unshardedHookList->addHook(std::make_unique<rpc::ShardingEgressMetadataHookForMongod>(service));
return unshardedHookList;
}
diff --git a/src/mongo/db/s/sharding_server_status.cpp b/src/mongo/db/s/sharding_server_status.cpp
index 3489612493c..1fbb819fe94 100644
--- a/src/mongo/db/s/sharding_server_status.cpp
+++ b/src/mongo/db/s/sharding_server_status.cpp
@@ -36,6 +36,7 @@
#include "mongo/db/s/resharding/resharding_metrics.h"
#include "mongo/db/s/sharding_state.h"
#include "mongo/db/s/sharding_statistics.h"
+#include "mongo/db/vector_clock.h"
#include "mongo/s/balancer_configuration.h"
#include "mongo/s/catalog_cache.h"
#include "mongo/s/client/shard_registry.h"
@@ -71,7 +72,13 @@ public:
result.append("configsvrConnectionString",
shardRegistry->getConfigServerConnectionString().toString());
- grid->configOpTime().append(&result, "lastSeenConfigServerOpTime");
+ const auto configOpTime = [&]() {
+ const auto vcTime = VectorClock::get(opCtx)->getTime();
+ const auto vcConfigTimeTs = vcTime.configTime().asTimestamp();
+ return mongo::repl::OpTime(vcConfigTimeTs, mongo::repl::OpTime::kUninitializedTerm);
+ }();
+
+ configOpTime.append(&result, "lastSeenConfigServerOpTime");
const long long maxChunkSizeInBytes =
grid->getBalancerConfiguration()->getMaxChunkSizeBytes();
diff --git a/src/mongo/db/s/sharding_state_recovery.cpp b/src/mongo/db/s/sharding_state_recovery.cpp
index 9bfe36ff580..90c72314095 100644
--- a/src/mongo/db/s/sharding_state_recovery.cpp
+++ b/src/mongo/db/s/sharding_state_recovery.cpp
@@ -48,11 +48,11 @@
#include "mongo/db/repl/repl_client_info.h"
#include "mongo/db/s/sharding_logging.h"
#include "mongo/db/s/sharding_state.h"
+#include "mongo/db/vector_clock_mutable.h"
#include "mongo/db/write_concern.h"
#include "mongo/db/write_concern_options.h"
#include "mongo/logv2/log.h"
#include "mongo/s/client/shard_registry.h"
-#include "mongo/s/grid.h"
namespace mongo {
namespace {
@@ -147,8 +147,13 @@ Status modifyRecoveryDocument(OperationContext* opCtx,
boost::optional<AutoGetDb> autoGetDb;
autoGetDb.emplace(opCtx, NamespaceString::kServerConfigurationNamespace.db(), MODE_X);
- auto const grid = Grid::get(opCtx);
- BSONObj updateObj = RecoveryDocument::createChangeObj(grid->configOpTime(), change);
+ const auto configOpTime = [&]() {
+ const auto vcTime = VectorClock::get(opCtx)->getTime();
+ const auto vcConfigTimeTs = vcTime.configTime().asTimestamp();
+ return mongo::repl::OpTime(vcConfigTimeTs, mongo::repl::OpTime::kUninitializedTerm);
+ }();
+
+ BSONObj updateObj = RecoveryDocument::createChangeObj(configOpTime, change);
LOGV2_DEBUG(22083,
1,
@@ -209,7 +214,6 @@ void ShardingStateRecovery::endMetadataOp(OperationContext* opCtx) {
}
Status ShardingStateRecovery::recover(OperationContext* opCtx) {
- Grid* const grid = Grid::get(opCtx);
ShardingState* const shardingState = ShardingState::get(opCtx);
invariant(shardingState->enabled());
@@ -237,7 +241,9 @@ Status ShardingStateRecovery::recover(OperationContext* opCtx) {
"recoveryDoc"_attr = redact(recoveryDoc.toBSON()));
if (!recoveryDoc.getMinOpTimeUpdaters()) {
- grid->advanceConfigOpTime(opCtx, recoveryDoc.getMinOpTime());
+ LogicalTime minOpTime{recoveryDoc.getMinOpTime().getTimestamp()};
+ VectorClockMutable::get(opCtx)->tickClusterTimeTo(minOpTime);
+ VectorClockMutable::get(opCtx)->tickConfigTimeTo(minOpTime);
return Status::OK();
}
@@ -260,10 +266,7 @@ Status ShardingStateRecovery::recover(OperationContext* opCtx) {
if (!status.isOK())
return status;
- LOGV2(22087,
- "Sharding state recovered. New config server opTime is {newConfigServerOpTime}",
- "Sharding state recovered",
- "newConfigServerOpTime"_attr = grid->configOpTime());
+ LOGV2(22087, "Sharding state recovered");
// Finally, clear the recovery document so next time we don't need to recover
status = modifyRecoveryDocument(opCtx, RecoveryDocument::Clear, kLocalWriteConcern);
diff --git a/src/mongo/db/s/vector_clock_shard_server_test.cpp b/src/mongo/db/s/vector_clock_shard_server_test.cpp
index 932a3f620ae..22efd956506 100644
--- a/src/mongo/db/s/vector_clock_shard_server_test.cpp
+++ b/src/mongo/db/s/vector_clock_shard_server_test.cpp
@@ -124,11 +124,12 @@ DEATH_TEST_F(VectorClockShardServerTest, CannotTickConfigTime, "Hit a MONGO_UNRE
vc->tickConfigTime(1);
}
-DEATH_TEST_F(VectorClockShardServerTest, CannotTickToConfigTime, "Hit a MONGO_UNREACHABLE") {
- auto sc = getServiceContext();
- auto vc = VectorClockMutable::get(sc);
- vc->tickConfigTimeTo(LogicalTime());
-}
+// TODO SERVER-55032 re-enable the following test
+// DEATH_TEST_F(VectorClockShardServerTest, CannotTickToConfigTime, "Hit a MONGO_UNREACHABLE") {
+// auto sc = getServiceContext();
+// auto vc = VectorClockMutable::get(sc);
+// vc->tickConfigTimeTo(LogicalTime());
+//}
DEATH_TEST_F(VectorClockShardServerTest, CannotTickTopologyTime, "Hit a MONGO_UNREACHABLE") {
auto sc = getServiceContext();
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp
index 68b1bdebe04..e04627e7563 100644
--- a/src/mongo/db/service_entry_point_common.cpp
+++ b/src/mongo/db/service_entry_point_common.cpp
@@ -1514,8 +1514,6 @@ void ExecCommandDatabase::_initiateCommand() {
if (OperationShardingState::isOperationVersioned(opCtx) || oss.hasDbVersion()) {
uassertStatusOK(shardingState->canAcceptShardedCommands());
}
-
- _execContext->behaviors->advanceConfigOpTimeFromRequestMetadata(opCtx);
}
_scoped = _execContext->behaviors->scopedOperationCompletionShardingActions(opCtx);
diff --git a/src/mongo/db/service_entry_point_common.h b/src/mongo/db/service_entry_point_common.h
index 89d4cc529f6..b38ea9b61bd 100644
--- a/src/mongo/db/service_entry_point_common.h
+++ b/src/mongo/db/service_entry_point_common.h
@@ -95,8 +95,6 @@ struct ServiceEntryPointCommon {
virtual void resetLockerState(OperationContext* opCtx) const noexcept = 0;
- virtual void advanceConfigOpTimeFromRequestMetadata(OperationContext* opCtx) const = 0;
-
MONGO_WARN_UNUSED_RESULT_FUNCTION virtual std::unique_ptr<PolymorphicScoped>
scopedOperationCompletionShardingActions(OperationContext* opCtx) const = 0;
diff --git a/src/mongo/db/service_entry_point_mongod.cpp b/src/mongo/db/service_entry_point_mongod.cpp
index 71be1d02ba4..fb0c47b6ebd 100644
--- a/src/mongo/db/service_entry_point_mongod.cpp
+++ b/src/mongo/db/service_entry_point_mongod.cpp
@@ -43,12 +43,10 @@
#include "mongo/db/s/operation_sharding_state.h"
#include "mongo/db/s/scoped_operation_completion_sharding_actions.h"
#include "mongo/db/s/shard_filtering_metadata_refresh.h"
-#include "mongo/db/s/sharding_config_optime_gossip.h"
#include "mongo/db/s/sharding_state.h"
#include "mongo/db/service_entry_point_common.h"
#include "mongo/logv2/log.h"
#include "mongo/rpc/get_status_from_command_result.h"
-#include "mongo/rpc/metadata/config_server_metadata.h"
#include "mongo/rpc/metadata/sharding_metadata.h"
#include "mongo/s/grid.h"
#include "mongo/s/shard_cannot_refresh_due_to_locks_held_exception.h"
@@ -222,12 +220,6 @@ public:
lastCommittedOpTime.getTimestamp());
}
}
-
- // If we're a shard other than the config shard, attach the last configOpTime we know about.
- if (isShardingAware && !isConfig) {
- auto opTime = Grid::get(opCtx)->configOpTime();
- rpc::ConfigServerMetadata(opTime).writeToMetadata(metadataBob);
- }
}
bool refreshDatabase(OperationContext* opCtx, const StaleDbRoutingVersion& se) const
@@ -263,11 +255,6 @@ public:
opCtx->swapLockState(std::make_unique<LockerImpl>(), lk);
}
- void advanceConfigOpTimeFromRequestMetadata(OperationContext* opCtx) const override {
- // Handle config optime information that may have been sent along with the command.
- rpc::advanceConfigOpTimeFromRequestMetadata(opCtx);
- }
-
std::unique_ptr<PolymorphicScoped> scopedOperationCompletionShardingActions(
OperationContext* opCtx) const override {
return std::make_unique<ScopedOperationCompletionShardingActions>(opCtx);
diff --git a/src/mongo/db/vector_clock.cpp b/src/mongo/db/vector_clock.cpp
index 2159fd2a012..61b3114b3e6 100644
--- a/src/mongo/db/vector_clock.cpp
+++ b/src/mongo/db/vector_clock.cpp
@@ -154,35 +154,6 @@ public:
}
};
-template <class ActualFormat>
-class VectorClock::OnlyOutOnNewFCVComponentFormat : public ActualFormat {
-public:
- using ActualFormat::ActualFormat;
- virtual ~OnlyOutOnNewFCVComponentFormat() = default;
-
- bool out(ServiceContext* service,
- OperationContext* opCtx,
- bool permitRefresh,
- BSONObjBuilder* out,
- LogicalTime time,
- Component component) const override {
- if (serverGlobalParams.featureCompatibility.isVersionInitialized() &&
- serverGlobalParams.featureCompatibility.isGreaterThanOrEqualTo(
- ServerGlobalParams::FeatureCompatibility::Version::kUpgradingFrom44To47)) {
- return ActualFormat::out(service, opCtx, permitRefresh, out, time, component);
- }
- return false;
- }
-
- LogicalTime in(ServiceContext* service,
- OperationContext* opCtx,
- const BSONObj& in,
- bool couldBeUnauthenticated,
- Component component) const override {
- return ActualFormat::in(service, opCtx, in, couldBeUnauthenticated, component);
- }
-};
-
class VectorClock::SignedComponentFormat : public VectorClock::ComponentFormat {
public:
using ComponentFormat::ComponentFormat;
@@ -318,12 +289,8 @@ private:
const VectorClock::ComponentArray<std::unique_ptr<VectorClock::ComponentFormat>>
VectorClock::_gossipFormatters{
std::make_unique<VectorClock::SignedComponentFormat>(VectorClock::kClusterTimeFieldName),
- std::make_unique<
- VectorClock::OnlyOutOnNewFCVComponentFormat<VectorClock::PlainComponentFormat>>(
- VectorClock::kConfigTimeFieldName),
- std::make_unique<
- VectorClock::OnlyOutOnNewFCVComponentFormat<VectorClock::PlainComponentFormat>>(
- VectorClock::kTopologyTimeFieldName)};
+ std::make_unique<VectorClock::PlainComponentFormat>(VectorClock::kConfigTimeFieldName),
+ std::make_unique<VectorClock::PlainComponentFormat>(VectorClock::kTopologyTimeFieldName)};
bool VectorClock::gossipOut(OperationContext* opCtx,
BSONObjBuilder* outMessage,
@@ -413,13 +380,6 @@ void VectorClock::_disable() {
_isEnabled = false;
}
-void VectorClock::gossipInConfigOpTime(const repl::OpTime& configOpTime) {
- LogicalTimeArray newTimeArray;
- newTimeArray[Component::ClusterTime] = LogicalTime(configOpTime.getTimestamp());
- newTimeArray[Component::ConfigTime] = LogicalTime(configOpTime.getTimestamp());
- _advanceTime(std::move(newTimeArray));
-}
-
void VectorClock::resetVectorClock_forTest() {
stdx::lock_guard<Latch> lock(_mutex);
auto it = _vectorTime.begin();
diff --git a/src/mongo/db/vector_clock.h b/src/mongo/db/vector_clock.h
index b6f58fd5e87..28b806bb045 100644
--- a/src/mongo/db/vector_clock.h
+++ b/src/mongo/db/vector_clock.h
@@ -159,14 +159,6 @@ public:
*/
bool isEnabled() const;
- /**
- * Advances, if necessary, the clusterTime and configTime components of the vector clock up to
- * the configOpTime received from another node. Necessary to ensure that the Grid's configOpTime
- * won't be greater than the VectorClock's clusterTime.
- * TODO SERVER-54252: Remove this after 5.0 has branched out.
- */
- void gossipInConfigOpTime(const repl::OpTime& configOpTime);
-
///////////////////////////////////////////////////////////////////////////////////////////////
// The group of methods below is only used for unit-testing
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -307,8 +299,6 @@ protected:
private:
class PlainComponentFormat;
class SignedComponentFormat;
- template <class ActualFormat>
- class OnlyOutOnNewFCVComponentFormat;
/**
* Called to determine if the cluster time component should be gossiped in and out to external
diff --git a/src/mongo/db/vector_clock_mongod.cpp b/src/mongo/db/vector_clock_mongod.cpp
index 77fc8caa5a9..157b0d32593 100644
--- a/src/mongo/db/vector_clock_mongod.cpp
+++ b/src/mongo/db/vector_clock_mongod.cpp
@@ -407,8 +407,10 @@ void VectorClockMongoD::_tickTo(Component component, LogicalTime newTime) {
return;
}
- if (component == Component::ConfigTime &&
- serverGlobalParams.clusterRole == ClusterRole::ConfigServer) {
+ if (component == Component::ConfigTime) {
+ // The ConfigTime is allowed to be tickTo on the ConfigServer and on the shard only when
+ // called from ShardingStateRecovery
+ // TODO SERVER-55032 re-add clusterRole == configServer condition like for TopologyTime
_advanceComponentTimeTo(component, std::move(newTime));
return;
}
diff --git a/src/mongo/db/vector_clock_mongod_test.cpp b/src/mongo/db/vector_clock_mongod_test.cpp
index 25c3d267825..9e3406d4bc9 100644
--- a/src/mongo/db/vector_clock_mongod_test.cpp
+++ b/src/mongo/db/vector_clock_mongod_test.cpp
@@ -127,11 +127,12 @@ DEATH_TEST_F(VectorClockMongoDTest, CannotTickConfigTime, "Hit a MONGO_UNREACHAB
vc->tickConfigTime(1);
}
-DEATH_TEST_F(VectorClockMongoDTest, CannotTickToConfigTime, "Hit a MONGO_UNREACHABLE") {
- auto sc = getServiceContext();
- auto vc = VectorClockMutable::get(sc);
- vc->tickConfigTimeTo(LogicalTime());
-}
+// TODO SERVER-55032 re-enable the following test
+// DEATH_TEST_F(VectorClockMongoDTest, CannotTickToConfigTime, "Hit a MONGO_UNREACHABLE") {
+// auto sc = getServiceContext();
+// auto vc = VectorClockMutable::get(sc);
+// vc->tickConfigTimeTo(LogicalTime());
+//}
DEATH_TEST_F(VectorClockMongoDTest, CannotTickTopologyTime, "Hit a MONGO_UNREACHABLE") {
auto sc = getServiceContext();
diff --git a/src/mongo/embedded/service_entry_point_embedded.cpp b/src/mongo/embedded/service_entry_point_embedded.cpp
index 56626f0c87b..4a8a163f763 100644
--- a/src/mongo/embedded/service_entry_point_embedded.cpp
+++ b/src/mongo/embedded/service_entry_point_embedded.cpp
@@ -139,8 +139,6 @@ public:
void resetLockerState(OperationContext* opCtx) const noexcept override {}
- void advanceConfigOpTimeFromRequestMetadata(OperationContext* opCtx) const override {}
-
std::unique_ptr<PolymorphicScoped> scopedOperationCompletionShardingActions(
OperationContext* opCtx) const override {
return nullptr;
diff --git a/src/mongo/rpc/SConscript b/src/mongo/rpc/SConscript
index a831e2fdcd4..d553d875e48 100644
--- a/src/mongo/rpc/SConscript
+++ b/src/mongo/rpc/SConscript
@@ -113,7 +113,6 @@ env.Library(
target='metadata',
source=[
'metadata.cpp',
- 'metadata/config_server_metadata.cpp',
'metadata/egress_metadata_hook_list.cpp',
'metadata/sharding_metadata.cpp',
'metadata/repl_set_metadata.cpp',
@@ -179,7 +178,6 @@ if wiredtiger:
'get_status_from_command_result_test.cpp',
'legacy_request_test.cpp',
'metadata/client_metadata_test.cpp',
- 'metadata/config_server_metadata_test.cpp',
'metadata/egress_metadata_hook_list_test.cpp',
'metadata/oplog_query_metadata_test.cpp',
'metadata/repl_set_metadata_test.cpp',
diff --git a/src/mongo/rpc/metadata.cpp b/src/mongo/rpc/metadata.cpp
index 8b749dc36cb..fa7911f59b5 100644
--- a/src/mongo/rpc/metadata.cpp
+++ b/src/mongo/rpc/metadata.cpp
@@ -39,7 +39,6 @@
#include "mongo/db/logical_time_validator.h"
#include "mongo/db/vector_clock.h"
#include "mongo/rpc/metadata/client_metadata.h"
-#include "mongo/rpc/metadata/config_server_metadata.h"
#include "mongo/rpc/metadata/impersonated_user_metadata.h"
#include "mongo/rpc/metadata/tracking_metadata.h"
#include "mongo/util/string_map.h"
@@ -54,7 +53,6 @@ BSONObj makeEmptyMetadata() {
void readRequestMetadata(OperationContext* opCtx, const OpMsg& opMsg, bool cmdRequiresAuth) {
BSONElement readPreferenceElem;
- BSONElement configSvrElem;
BSONElement trackingElem;
BSONElement clientElem;
BSONElement helloClientElem;
@@ -65,8 +63,6 @@ void readRequestMetadata(OperationContext* opCtx, const OpMsg& opMsg, bool cmdRe
auto fieldName = metadataElem.fieldNameStringData();
if (fieldName == "$readPreference") {
readPreferenceElem = metadataElem;
- } else if (fieldName == ConfigServerMetadata::fieldName()) {
- configSvrElem = metadataElem;
} else if (fieldName == ClientMetadata::fieldName()) {
clientElem = metadataElem;
} else if (fieldName == TrackingMetadata::fieldName()) {
@@ -104,9 +100,6 @@ void readRequestMetadata(OperationContext* opCtx, const OpMsg& opMsg, bool cmdRe
ClientMetadata::setFromMetadataForOperation(opCtx, clientElem);
}
- ConfigServerMetadata::get(opCtx) =
- uassertStatusOK(ConfigServerMetadata::readFromMetadata(configSvrElem));
-
TrackingMetadata::get(opCtx) =
uassertStatusOK(TrackingMetadata::readFromMetadata(trackingElem));
diff --git a/src/mongo/rpc/metadata/config_server_metadata.cpp b/src/mongo/rpc/metadata/config_server_metadata.cpp
deleted file mode 100644
index 3dffe940087..00000000000
--- a/src/mongo/rpc/metadata/config_server_metadata.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * Copyright (C) 2018-present MongoDB, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the Server Side Public License, version 1,
- * as published by MongoDB, Inc.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * Server Side Public License for more details.
- *
- * You should have received a copy of the Server Side Public License
- * along with this program. If not, see
- * <http://www.mongodb.com/licensing/server-side-public-license>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the Server Side Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#include "mongo/platform/basic.h"
-
-#include "mongo/rpc/metadata/config_server_metadata.h"
-
-#include "mongo/bson/util/bson_check.h"
-#include "mongo/db/jsobj.h"
-#include "mongo/db/repl/bson_extract_optime.h"
-#include "mongo/rpc/metadata.h"
-
-namespace mongo {
-namespace rpc {
-
-using repl::OpTime;
-
-namespace {
-
-const char kOpTimeFieldName[] = "opTime";
-
-} // unnamed namespace
-
-const OperationContext::Decoration<ConfigServerMetadata> ConfigServerMetadata::get =
- OperationContext::declareDecoration<ConfigServerMetadata>();
-
-ConfigServerMetadata::ConfigServerMetadata(OpTime opTime) : _opTime(std::move(opTime)) {}
-
-StatusWith<ConfigServerMetadata> ConfigServerMetadata::readFromMetadata(
- const BSONObj& metadataObj) {
- return readFromMetadata(metadataObj.getField(fieldName()));
-}
-
-StatusWith<ConfigServerMetadata> ConfigServerMetadata::readFromMetadata(
- const BSONElement& metadataElem) {
- if (metadataElem.eoo()) {
- return ConfigServerMetadata{};
- } else if (metadataElem.type() != mongo::Object) {
- return {ErrorCodes::TypeMismatch,
- str::stream() << "ConfigServerMetadata element has incorrect type: expected"
- << mongo::Object << " but got " << metadataElem.type()};
- }
-
- BSONObj configMetadataObj = metadataElem.Obj();
-
- repl::OpTime opTime;
- auto status = bsonExtractOpTimeField(configMetadataObj, kOpTimeFieldName, &opTime);
- if (!status.isOK()) {
- return status;
- }
-
- return ConfigServerMetadata(std::move(opTime));
-}
-
-void ConfigServerMetadata::writeToMetadata(BSONObjBuilder* builder) const {
- invariant(_opTime);
- BSONObjBuilder configMetadataBuilder(builder->subobjStart(fieldName()));
- _opTime->append(&configMetadataBuilder, kOpTimeFieldName);
-}
-
-} // namespace rpc
-} // namespace mongo
diff --git a/src/mongo/rpc/metadata/config_server_metadata.h b/src/mongo/rpc/metadata/config_server_metadata.h
deleted file mode 100644
index b2462784a34..00000000000
--- a/src/mongo/rpc/metadata/config_server_metadata.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * Copyright (C) 2018-present MongoDB, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the Server Side Public License, version 1,
- * as published by MongoDB, Inc.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * Server Side Public License for more details.
- *
- * You should have received a copy of the Server Side Public License
- * along with this program. If not, see
- * <http://www.mongodb.com/licensing/server-side-public-license>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the Server Side Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#pragma once
-
-#include "mongo/db/operation_context.h"
-#include "mongo/db/repl/optime.h"
-
-namespace mongo {
-
-class BSONObj;
-class BSONObjBuilder;
-
-namespace rpc {
-
-/**
- * This class encapsulates the metadata sent between shard mongods and mongos on every command
- * request and response, containing metadata information about the config servers.
- *
- * format:
- * configsvr: {
- * opTime: {ts: Timestamp(0, 0), t: 0}
- * }
- */
-class ConfigServerMetadata {
-public:
- static const OperationContext::Decoration<ConfigServerMetadata> get;
-
- ConfigServerMetadata() = default;
- explicit ConfigServerMetadata(repl::OpTime opTime);
-
- /**
- * Parses the metadata from the given metadata object.
- * Returns a non-ok status on parse error.
- * If no metadata is found, returns a default-constructed ConfigServerMetadata.
- */
- static StatusWith<ConfigServerMetadata> readFromMetadata(const BSONObj& metadataObj);
-
- /**
- * Parses ConfigServerMetadata from a pre-extracted BSONElement. When reading a metadata object,
- * this form is more efficient as it permits parsing the metadata in one pass.
- */
- static StatusWith<ConfigServerMetadata> readFromMetadata(const BSONElement& metadataElem);
-
- /**
- * Writes the metadata to the given BSONObjBuilder for building a command request or response
- * metadata.
- * Only valid to call if _opTime is initialized.
- */
- void writeToMetadata(BSONObjBuilder* builder) const;
-
- /**
- * Returns the OpTime of the most recent operation on the config servers that this
- * shard has seen.
- */
- boost::optional<repl::OpTime> getOpTime() const {
- return _opTime;
- }
-
- static StringData fieldName() {
- return "$configServerState";
- }
-
-private:
- boost::optional<repl::OpTime> _opTime;
-};
-
-} // namespace rpc
-} // namespace mongo
diff --git a/src/mongo/rpc/metadata/config_server_metadata_test.cpp b/src/mongo/rpc/metadata/config_server_metadata_test.cpp
deleted file mode 100644
index 436e85f92ce..00000000000
--- a/src/mongo/rpc/metadata/config_server_metadata_test.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Copyright (C) 2018-present MongoDB, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the Server Side Public License, version 1,
- * as published by MongoDB, Inc.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * Server Side Public License for more details.
- *
- * You should have received a copy of the Server Side Public License
- * along with this program. If not, see
- * <http://www.mongodb.com/licensing/server-side-public-license>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the Server Side Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#include "mongo/platform/basic.h"
-
-#include "mongo/db/jsobj.h"
-#include "mongo/rpc/metadata/config_server_metadata.h"
-#include "mongo/unittest/unittest.h"
-
-namespace mongo {
-namespace rpc {
-namespace {
-
-using repl::OpTime;
-
-TEST(ConfigSvrMetadataTest, Roundtrip) {
- OpTime opTime(Timestamp(1234, 100), 5);
- ConfigServerMetadata metadata(opTime);
-
- ASSERT_EQ(opTime, metadata.getOpTime().get());
-
- BSONObjBuilder builder;
- metadata.writeToMetadata(&builder);
-
- BSONObj expectedObj(
- BSON("$configServerState" << BSON(
- "opTime" << BSON("ts" << opTime.getTimestamp() << "t" << opTime.getTerm()))));
-
- BSONObj serializedObj = builder.obj();
- ASSERT_BSONOBJ_EQ(expectedObj, serializedObj);
-
- auto cloneStatus = ConfigServerMetadata::readFromMetadata(serializedObj);
- ASSERT_OK(cloneStatus.getStatus());
-
- const auto& clonedMetadata = cloneStatus.getValue();
- ASSERT_EQ(opTime, clonedMetadata.getOpTime().get());
-
- BSONObjBuilder clonedBuilder;
- clonedMetadata.writeToMetadata(&clonedBuilder);
-
- BSONObj clonedSerializedObj = clonedBuilder.obj();
- ASSERT_BSONOBJ_EQ(expectedObj, clonedSerializedObj);
-}
-
-} // unnamed namespace
-} // namespace rpc
-} // namespace mongo
diff --git a/src/mongo/s/SConscript b/src/mongo/s/SConscript
index 3e89e1552aa..af45170771d 100644
--- a/src/mongo/s/SConscript
+++ b/src/mongo/s/SConscript
@@ -236,7 +236,6 @@ env.Library(
'catalog/sharding_catalog_client_impl',
'committed_optime_metadata_hook',
'coreshard',
- 'sharding_egress_metadata_hook_for_mongos',
'sharding_task_executor',
'sharding_test_fixture_common',
],
@@ -286,7 +285,6 @@ env.Library(
'config_server_catalog_cache_loader.cpp',
'config_server_client.cpp',
'shard_util.cpp',
- 'sharding_egress_metadata_hook.cpp',
],
LIBDEPS=[
'$BUILD_DIR/mongo/db/client_metadata_propagation_egress_hook',
@@ -317,17 +315,6 @@ env.Library(
)
env.Library(
- target='sharding_egress_metadata_hook_for_mongos',
- source=[
- 'sharding_egress_metadata_hook_for_mongos.cpp'
- ],
- LIBDEPS=[
- '$BUILD_DIR/mongo/rpc/metadata',
- 'coreshard',
- ]
-)
-
-env.Library(
target='committed_optime_metadata_hook',
source=[
'committed_optime_metadata_hook.cpp'
@@ -458,7 +445,6 @@ env.Library(
'mongos_server_parameters',
'mongos_topology_coordinator',
'query/cluster_cursor_cleanup_job',
- 'sharding_egress_metadata_hook_for_mongos',
'sharding_initialization',
'sharding_router_api',
],
@@ -512,7 +498,6 @@ env.Library(
'mongos_topology_coordinator',
'query/cluster_cursor_cleanup_job',
'sessions_collection_sharded',
- 'sharding_egress_metadata_hook_for_mongos',
'sharding_initialization',
'sharding_router_api',
],
diff --git a/src/mongo/s/catalog/sharding_catalog_client_impl.cpp b/src/mongo/s/catalog/sharding_catalog_client_impl.cpp
index 4d5e2173e5e..67a4e1b2a93 100644
--- a/src/mongo/s/catalog/sharding_catalog_client_impl.cpp
+++ b/src/mongo/s/catalog/sharding_catalog_client_impl.cpp
@@ -50,6 +50,7 @@
#include "mongo/db/repl/optime.h"
#include "mongo/db/repl/read_concern_args.h"
#include "mongo/db/repl/repl_client_info.h"
+#include "mongo/db/vector_clock.h"
#include "mongo/executor/network_interface.h"
#include "mongo/logv2/log.h"
#include "mongo/rpc/get_status_from_command_result.h"
@@ -624,9 +625,17 @@ std::pair<CollectionType, std::vector<ChunkType>> ShardingCatalogClientImpl::get
aggRequest.setReadConcern(readConcern.toBSONInner());
aggRequest.setWriteConcern(WriteConcernOptions());
- const auto readPref = (serverGlobalParams.clusterRole == ClusterRole::ConfigServer)
- ? ReadPreferenceSetting()
- : Grid::get(opCtx)->readPreferenceWithConfigTime(kConfigReadSelector);
+ const auto readPref = [&]() -> ReadPreferenceSetting {
+ if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer) {
+ return {};
+ }
+
+ const auto vcTime = VectorClock::get(opCtx)->getTime();
+ ReadPreferenceSetting readPref{kConfigReadSelector};
+ readPref.minClusterTime = vcTime.configTime().asTimestamp();
+ return readPref;
+ }();
+
aggRequest.setUnwrappedReadPref(readPref.toContainingBSON());
// Run the aggregation
diff --git a/src/mongo/s/client/shard_remote.cpp b/src/mongo/s/client/shard_remote.cpp
index b1acef8f962..78ca5ddd6e8 100644
--- a/src/mongo/s/client/shard_remote.cpp
+++ b/src/mongo/s/client/shard_remote.cpp
@@ -29,8 +29,6 @@
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kSharding
-#include "mongo/platform/basic.h"
-
#include "mongo/s/client/shard_remote.h"
#include <algorithm>
@@ -42,10 +40,10 @@
#include "mongo/client/remote_command_targeter.h"
#include "mongo/client/replica_set_monitor.h"
#include "mongo/db/jsobj.h"
-#include "mongo/db/logical_time.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/query/query_request_helper.h"
#include "mongo/db/repl/read_concern_args.h"
+#include "mongo/db/vector_clock.h"
#include "mongo/executor/task_executor_pool.h"
#include "mongo/logv2/log.h"
#include "mongo/rpc/get_status_from_command_result.h"
@@ -355,18 +353,29 @@ StatusWith<Shard::QueryResponse> ShardRemote::_exhaustiveFindOnConfig(
const BSONObj& sort,
boost::optional<long long> limit,
const boost::optional<BSONObj>& hint) {
+
invariant(isConfig());
- auto const grid = Grid::get(opCtx);
- BSONObj readConcernObj;
- {
+ const auto configTime = [&] {
+ const auto currentTime = VectorClock::get(opCtx)->getTime();
+ return currentTime.configTime();
+ }();
+
+ const auto readPrefWithConfigTime = [&] {
+ ReadPreferenceSetting readPrefToReturn{readPref};
+ readPrefToReturn.minClusterTime = configTime.asTimestamp();
+ return readPrefToReturn;
+ }();
+
+ BSONObj readConcernObj = [&] {
invariant(readConcernLevel == repl::ReadConcernLevel::kMajorityReadConcern);
- const auto readConcern = grid->readConcernWithConfigTime(readConcernLevel);
+ repl::OpTime configOpTime{configTime.asTimestamp(),
+ mongo::repl::OpTime::kUninitializedTerm};
+ repl::ReadConcernArgs readConcern{configOpTime, readConcernLevel};
BSONObjBuilder bob;
readConcern.appendInfo(&bob);
- readConcernObj =
- bob.done().getObjectField(repl::ReadConcernArgs::kReadConcernFieldName).getOwned();
- }
+ return bob.done().getObjectField(repl::ReadConcernArgs::kReadConcernFieldName).getOwned();
+ }();
const Milliseconds maxTimeMS =
std::min(opCtx->getRemainingMaxTimeMillis(),
@@ -393,11 +402,8 @@ StatusWith<Shard::QueryResponse> ShardRemote::_exhaustiveFindOnConfig(
findCommand.serialize(BSONObj(), &findCmdBuilder);
}
- return _runExhaustiveCursorCommand(opCtx,
- grid->readPreferenceWithConfigTime(readPref),
- nss.db().toString(),
- maxTimeMS,
- findCmdBuilder.done());
+ return _runExhaustiveCursorCommand(
+ opCtx, readPrefWithConfigTime, nss.db().toString(), maxTimeMS, findCmdBuilder.done());
}
Status ShardRemote::createIndexOnConfig(OperationContext* opCtx,
@@ -522,10 +528,13 @@ StatusWith<ShardRemote::AsyncCmdHandle> ShardRemote::_scheduleCommand(
Milliseconds maxTimeMSOverride,
const BSONObj& cmdObj,
const TaskExecutor::RemoteCommandCallbackFn& cb) {
+
const auto readPrefWithConfigTime = [&]() -> ReadPreferenceSetting {
if (isConfig()) {
- auto const grid = Grid::get(opCtx);
- return grid->readPreferenceWithConfigTime(readPref);
+ const auto vcTime = VectorClock::get(opCtx)->getTime();
+ ReadPreferenceSetting readPrefToReturn{readPref};
+ readPrefToReturn.minClusterTime = vcTime.configTime().asTimestamp();
+ return readPrefToReturn;
} else {
return {readPref};
}
diff --git a/src/mongo/s/client/sharding_connection_hook.h b/src/mongo/s/client/sharding_connection_hook.h
index 3dbc2953602..7ef8cd3925f 100644
--- a/src/mongo/s/client/sharding_connection_hook.h
+++ b/src/mongo/s/client/sharding_connection_hook.h
@@ -31,7 +31,7 @@
#include "mongo/client/connpool.h"
#include "mongo/rpc/metadata.h"
-#include "mongo/s/sharding_egress_metadata_hook.h"
+#include "mongo/rpc/metadata/metadata_hook.h"
namespace mongo {
diff --git a/src/mongo/s/config_server_catalog_cache_loader.cpp b/src/mongo/s/config_server_catalog_cache_loader.cpp
index 0065acfb04a..4e4d0e452df 100644
--- a/src/mongo/s/config_server_catalog_cache_loader.cpp
+++ b/src/mongo/s/config_server_catalog_cache_loader.cpp
@@ -38,6 +38,7 @@
#include "mongo/db/client.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/vector_clock.h"
#include "mongo/logv2/log.h"
#include "mongo/s/catalog/sharding_catalog_client.h"
#include "mongo/s/grid.h"
@@ -57,14 +58,24 @@ CollectionAndChangedChunks getChangedChunks(OperationContext* opCtx,
bool avoidSnapshotForRefresh) {
const auto catalogClient = Grid::get(opCtx)->catalogClient();
+ // TODO SERVER-54394 always use snapshot read concern once ephemeral storage engine supports it
const auto readConcernLevel = !avoidSnapshotForRefresh
? repl::ReadConcernLevel::kSnapshotReadConcern
: repl::ReadConcernLevel::kLocalReadConcern;
- const auto afterClusterTime = (serverGlobalParams.clusterRole == ClusterRole::ConfigServer)
- ? repl::ReplicationCoordinator::get(opCtx)->getMyLastAppliedOpTime()
- : Grid::get(opCtx)->configOpTime();
- const auto readConcern =
- repl::ReadConcernArgs(LogicalTime(afterClusterTime.getTimestamp()), readConcernLevel);
+
+ const auto afterClusterTime = [&] {
+ if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer) {
+ return repl::ReplicationCoordinator::get(opCtx)
+ ->getMyLastAppliedOpTime()
+ .getTimestamp();
+
+ } else {
+ const auto vcTime = VectorClock::get(opCtx)->getTime();
+ return vcTime.configTime().asTimestamp();
+ }
+ }();
+
+ const auto readConcern = repl::ReadConcernArgs(LogicalTime(afterClusterTime), readConcernLevel);
auto collAndChunks =
catalogClient->getCollectionAndChunks(opCtx, nss, sinceVersion, readConcern);
diff --git a/src/mongo/s/grid.cpp b/src/mongo/s/grid.cpp
index 4dae85d5df2..6a2efb9d8c4 100644
--- a/src/mongo/s/grid.cpp
+++ b/src/mongo/s/grid.cpp
@@ -29,18 +29,10 @@
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kSharding
-#include "mongo/platform/basic.h"
-
#include "mongo/s/grid.h"
#include "mongo/db/operation_context.h"
-#include "mongo/db/server_options.h"
-#include "mongo/db/vector_clock.h"
-#include "mongo/executor/task_executor.h"
-#include "mongo/executor/task_executor_pool.h"
-#include "mongo/logv2/log.h"
#include "mongo/s/balancer_configuration.h"
-#include "mongo/s/client/shard_factory.h"
#include "mongo/s/query/cluster_cursor_manager.h"
namespace mongo {
@@ -106,33 +98,6 @@ void Grid::setCustomConnectionPoolStatsFn(CustomConnectionPoolStatsFn statsFn) {
_customConnectionPoolStatsFn = std::move(statsFn);
}
-repl::ReadConcernArgs Grid::readConcernWithConfigTime(
- repl::ReadConcernLevel readConcernLevel) const {
- return ReadConcernArgs(configOpTime(), readConcernLevel);
-}
-
-ReadPreferenceSetting Grid::readPreferenceWithConfigTime(
- const ReadPreferenceSetting& readPreference) const {
- ReadPreferenceSetting readPrefToReturn(readPreference);
- readPrefToReturn.minClusterTime = configOpTime().getTimestamp();
- return readPrefToReturn;
-}
-
-repl::OpTime Grid::configOpTime() const {
- invariant(serverGlobalParams.clusterRole != ClusterRole::ConfigServer);
- const auto currentTime = VectorClock::get(grid.owner(this))->getTime();
- const auto vcConfigTimeTs = currentTime.configTime().asTimestamp();
- return mongo::repl::OpTime(vcConfigTimeTs, mongo::repl::OpTime::kUninitializedTerm);
-}
-
-void Grid::advanceConfigOpTime(OperationContext* opCtx, repl::OpTime opTime) {
- auto vectorClock = VectorClock::get(grid.owner(this));
- if (!vectorClock->isEnabled()) {
- return;
- }
- vectorClock->gossipInConfigOpTime(opTime);
-}
-
void Grid::clearForUnitTests() {
_catalogCache.reset();
_catalogClient.reset();
diff --git a/src/mongo/s/grid.h b/src/mongo/s/grid.h
index 81a765db38d..079ca621a6b 100644
--- a/src/mongo/s/grid.h
+++ b/src/mongo/s/grid.h
@@ -31,7 +31,6 @@
#include <functional>
-#include "mongo/db/repl/optime.h"
#include "mongo/executor/task_executor_pool.h"
#include "mongo/platform/mutex.h"
#include "mongo/s/catalog/sharding_catalog_client.h"
@@ -43,8 +42,6 @@ namespace mongo {
class BalancerConfiguration;
class ClusterCursorManager;
-class OperationContext;
-class ServiceContext;
namespace executor {
class NetworkInterface;
@@ -130,33 +127,6 @@ public:
}
/**
- * Returns a readConcern at the specified level for reading after the current ConfigTime.
- */
- repl::ReadConcernArgs readConcernWithConfigTime(repl::ReadConcernLevel readConcernLevel) const;
-
- /**
- * Returns a readPreference (based on the given one) for targeting a config server that is at or
- * after the current ConfigTime.
- */
- ReadPreferenceSetting readPreferenceWithConfigTime(
- const ReadPreferenceSetting& readPreference) const;
-
- /**
- * Returns the the last optime that a shard or config server has reported as the current
- * committed optime on the config server.
- * NOTE: This is not valid to call on a config server instance.
- */
- repl::OpTime configOpTime() const;
-
- /**
- * Called whenever a mongos or shard gets a response from a config server or shard and updates
- * what we've seen as the last config server optime.
- * If the config optime was updated, returns the previous value.
- * NOTE: This is not valid to call on a config server instance.
- */
- void advanceConfigOpTime(OperationContext* opCtx, repl::OpTime opTime);
-
- /**
* Clears the grid object so that it can be reused between test executions. This will not
* be necessary if grid is hanging off the global ServiceContext and each test gets its
* own service context.
diff --git a/src/mongo/s/mongos_main.cpp b/src/mongo/s/mongos_main.cpp
index ef0db47b802..ba4a75ed746 100644
--- a/src/mongo/s/mongos_main.cpp
+++ b/src/mongo/s/mongos_main.cpp
@@ -90,7 +90,6 @@
#include "mongo/s/service_entry_point_mongos.h"
#include "mongo/s/session_catalog_router.h"
#include "mongo/s/sessions_collection_sharded.h"
-#include "mongo/s/sharding_egress_metadata_hook_for_mongos.h"
#include "mongo/s/sharding_initialization.h"
#include "mongo/s/sharding_uptime_reporter.h"
#include "mongo/s/transaction_router.h"
@@ -433,8 +432,6 @@ Status initializeSharding(OperationContext* opCtx) {
hookList->addHook(
std::make_unique<rpc::CommittedOpTimeMetadataHook>(opCtx->getServiceContext()));
hookList->addHook(std::make_unique<rpc::ClientMetadataPropagationEgressHook>());
- hookList->addHook(std::make_unique<rpc::ShardingEgressMetadataHookForMongos>(
- opCtx->getServiceContext()));
return hookList;
},
boost::none);
@@ -676,8 +673,6 @@ ExitCode runMongosServer(ServiceContext* serviceContext) {
auto unshardedHookList = std::make_unique<rpc::EgressMetadataHookList>();
unshardedHookList->addHook(std::make_unique<rpc::VectorClockMetadataHook>(serviceContext));
unshardedHookList->addHook(std::make_unique<rpc::ClientMetadataPropagationEgressHook>());
- unshardedHookList->addHook(
- std::make_unique<rpc::ShardingEgressMetadataHookForMongos>(serviceContext));
unshardedHookList->addHook(std::make_unique<rpc::CommittedOpTimeMetadataHook>(serviceContext));
// Add sharding hooks to both connection pools - ShardingConnectionHook includes auth hooks
diff --git a/src/mongo/s/s_sharding_server_status.cpp b/src/mongo/s/s_sharding_server_status.cpp
index 9bbc8d989ff..a1515a609f4 100644
--- a/src/mongo/s/s_sharding_server_status.cpp
+++ b/src/mongo/s/s_sharding_server_status.cpp
@@ -31,6 +31,7 @@
#include "mongo/bson/bsonobjbuilder.h"
#include "mongo/db/commands/server_status.h"
+#include "mongo/db/vector_clock.h"
#include "mongo/executor/hedging_metrics.h"
#include "mongo/s/balancer_configuration.h"
#include "mongo/s/catalog_cache.h"
@@ -59,7 +60,13 @@ public:
result.append("configsvrConnectionString",
shardRegistry->getConfigServerConnectionString().toString());
- grid->configOpTime().append(&result, "lastSeenConfigServerOpTime");
+ const auto configOpTime = [&]() {
+ const auto vcTime = VectorClock::get(opCtx)->getTime();
+ const auto vcConfigTimeTs = vcTime.configTime().asTimestamp();
+ return mongo::repl::OpTime(vcConfigTimeTs, mongo::repl::OpTime::kUninitializedTerm);
+ }();
+
+ configOpTime.append(&result, "lastSeenConfigServerOpTime");
const long long maxChunkSizeInBytes =
grid->getBalancerConfiguration()->getMaxChunkSizeBytes();
diff --git a/src/mongo/s/sharding_egress_metadata_hook.cpp b/src/mongo/s/sharding_egress_metadata_hook.cpp
deleted file mode 100644
index 640445e6a6c..00000000000
--- a/src/mongo/s/sharding_egress_metadata_hook.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * Copyright (C) 2018-present MongoDB, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the Server Side Public License, version 1,
- * as published by MongoDB, Inc.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * Server Side Public License for more details.
- *
- * You should have received a copy of the Server Side Public License
- * along with this program. If not, see
- * <http://www.mongodb.com/licensing/server-side-public-license>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the Server Side Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kSharding
-
-#include "mongo/platform/basic.h"
-
-#include <string>
-
-#include "mongo/base/status.h"
-#include "mongo/db/service_context.h"
-#include "mongo/rpc/metadata/client_metadata.h"
-#include "mongo/rpc/metadata/config_server_metadata.h"
-#include "mongo/rpc/metadata/impersonated_user_metadata.h"
-#include "mongo/rpc/metadata/metadata_hook.h"
-#include "mongo/rpc/metadata/repl_set_metadata.h"
-#include "mongo/s/client/shard_registry.h"
-#include "mongo/s/grid.h"
-#include "mongo/s/sharding_egress_metadata_hook.h"
-#include "mongo/util/net/hostandport.h"
-
-namespace mongo {
-namespace rpc {
-
-ShardingEgressMetadataHook::ShardingEgressMetadataHook(ServiceContext* serviceContext)
- : _serviceContext(serviceContext) {
- invariant(_serviceContext);
-}
-
-Status ShardingEgressMetadataHook::writeRequestMetadata(OperationContext* opCtx,
- BSONObjBuilder* metadataBob) {
- try {
- rpc::ConfigServerMetadata(_getConfigServerOpTime()).writeToMetadata(metadataBob);
- return Status::OK();
- } catch (...) {
- return exceptionToStatus();
- }
-}
-
-Status ShardingEgressMetadataHook::readReplyMetadata(OperationContext* opCtx,
- StringData replySource,
- const BSONObj& metadataObj) {
- try {
- _saveGLEStats(metadataObj, replySource);
- return _advanceConfigOpTimeFromShard(opCtx, replySource.toString(), metadataObj);
- } catch (...) {
- return exceptionToStatus();
- }
-}
-
-Status ShardingEgressMetadataHook::_advanceConfigOpTimeFromShard(OperationContext* opCtx,
- const ShardId& shardId,
- const BSONObj& metadataObj) {
- auto const grid = Grid::get(_serviceContext);
-
- try {
- auto shard = grid->shardRegistry()->getShardNoReload(shardId);
- if (!shard) {
- return Status::OK();
- }
-
- // Update our notion of the config server opTime from the configOpTime in the response.
- if (shard->isConfig()) {
- // Config servers return the config opTime as part of their own metadata.
- if (metadataObj.hasField(rpc::kReplSetMetadataFieldName)) {
- // Sharding users of ReplSetMetadata do not use the wall clock time field.
- auto parseStatus = rpc::ReplSetMetadata::readFromMetadata(metadataObj);
- if (!parseStatus.isOK()) {
- return parseStatus.getStatus();
- }
-
- // Use the last committed optime to advance config optime.
- // For successful majority writes, we could use the optime of the last op
- // from us and lastOpCommitted is always greater than or equal to it.
- // On majority write failures, the last visible optime would be incorrect
- // due to rollback as explained in SERVER-24630 and the last committed optime
- // is safe to use.
- const auto& replMetadata = parseStatus.getValue();
- const auto opTime = replMetadata.getLastOpCommitted();
- grid->advanceConfigOpTime(opCtx, opTime.opTime);
- }
- } else {
- // Regular shards return the config opTime as part of ConfigServerMetadata.
- auto parseStatus = rpc::ConfigServerMetadata::readFromMetadata(metadataObj);
- if (!parseStatus.isOK()) {
- return parseStatus.getStatus();
- }
-
- const auto& configMetadata = parseStatus.getValue();
- const auto opTime = configMetadata.getOpTime();
- if (opTime.is_initialized()) {
- grid->advanceConfigOpTime(opCtx, opTime.get());
- }
- }
- return Status::OK();
- } catch (...) {
- return exceptionToStatus();
- }
-}
-
-} // namespace rpc
-} // namespace mongo
diff --git a/src/mongo/s/sharding_egress_metadata_hook.h b/src/mongo/s/sharding_egress_metadata_hook.h
deleted file mode 100644
index 8bdf85adc66..00000000000
--- a/src/mongo/s/sharding_egress_metadata_hook.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * Copyright (C) 2018-present MongoDB, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the Server Side Public License, version 1,
- * as published by MongoDB, Inc.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * Server Side Public License for more details.
- *
- * You should have received a copy of the Server Side Public License
- * along with this program. If not, see
- * <http://www.mongodb.com/licensing/server-side-public-license>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the Server Side Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#pragma once
-
-#include "mongo/base/string_data.h"
-#include "mongo/db/repl/optime.h"
-#include "mongo/rpc/metadata/metadata_hook.h"
-#include "mongo/s/client/shard.h"
-
-namespace mongo {
-namespace rpc {
-
-/**
- * Hooks for handling configsvr optime, client metadata and auth metadata for sharding.
- */
-class ShardingEgressMetadataHook : public rpc::EgressMetadataHook {
-public:
- ShardingEgressMetadataHook(ServiceContext* serviceContext);
- virtual ~ShardingEgressMetadataHook() = default;
-
- Status readReplyMetadata(OperationContext* opCtx,
- StringData replySource,
- const BSONObj& metadataObj) override;
- Status writeRequestMetadata(OperationContext* opCtx, BSONObjBuilder* metadataBob) override;
-
-protected:
- /**
- * On mongod this is a no-op.
- * On mongos it looks for $gleStats in a command's reply metadata, and fills in the
- * ClusterLastErrorInfo for this thread's associated Client with the data, if found.
- * This data will be used by subsequent GLE calls, to ensure we look for the correct write on
- * the correct PRIMARY.
- */
- virtual void _saveGLEStats(const BSONObj& metadata, StringData hostString) = 0;
-
- /**
- * Called by writeRequestMetadata() to find the config server optime that should be sent as part
- * of the ConfigServerMetadata.
- */
- virtual repl::OpTime _getConfigServerOpTime() = 0;
-
- /**
- * On config servers this is a no-op.
- * On shards and mongoses this advances the Grid's stored config server optime based on the
- * metadata in the response object from running a command.
- */
- virtual Status _advanceConfigOpTimeFromShard(OperationContext* opCtx,
- const ShardId& shardId,
- const BSONObj& metadataObj);
-
- ServiceContext* const _serviceContext;
-};
-
-} // namespace rpc
-} // namespace mongo
diff --git a/src/mongo/s/sharding_egress_metadata_hook_for_mongos.cpp b/src/mongo/s/sharding_egress_metadata_hook_for_mongos.cpp
deleted file mode 100644
index 90c58dc6ec8..00000000000
--- a/src/mongo/s/sharding_egress_metadata_hook_for_mongos.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Copyright (C) 2018-present MongoDB, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the Server Side Public License, version 1,
- * as published by MongoDB, Inc.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * Server Side Public License for more details.
- *
- * You should have received a copy of the Server Side Public License
- * along with this program. If not, see
- * <http://www.mongodb.com/licensing/server-side-public-license>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the Server Side Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kSharding
-
-#include "mongo/platform/basic.h"
-
-#include "mongo/s/sharding_egress_metadata_hook_for_mongos.h"
-
-#include "mongo/db/client.h"
-#include "mongo/s/grid.h"
-
-namespace mongo {
-namespace rpc {
-
-void ShardingEgressMetadataHookForMongos::_saveGLEStats(const BSONObj& metadata,
- StringData hostString) {}
-
-repl::OpTime ShardingEgressMetadataHookForMongos::_getConfigServerOpTime() {
- return Grid::get(_serviceContext)->configOpTime();
-}
-
-} // namespace rpc
-} // namespace mongo
diff --git a/src/mongo/s/sharding_egress_metadata_hook_for_mongos.h b/src/mongo/s/sharding_egress_metadata_hook_for_mongos.h
deleted file mode 100644
index 9014b87628a..00000000000
--- a/src/mongo/s/sharding_egress_metadata_hook_for_mongos.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Copyright (C) 2018-present MongoDB, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the Server Side Public License, version 1,
- * as published by MongoDB, Inc.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * Server Side Public License for more details.
- *
- * You should have received a copy of the Server Side Public License
- * along with this program. If not, see
- * <http://www.mongodb.com/licensing/server-side-public-license>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the Server Side Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#pragma once
-
-#include "mongo/s/sharding_egress_metadata_hook.h"
-
-namespace mongo {
-namespace rpc {
-
-class ShardingEgressMetadataHookForMongos final : public ShardingEgressMetadataHook {
-public:
- using ShardingEgressMetadataHook::ShardingEgressMetadataHook;
-
-private:
- void _saveGLEStats(const BSONObj& metadata, StringData hostString) override;
-
- repl::OpTime _getConfigServerOpTime() override;
-};
-
-} // namespace rpc
-} // namespace mongo
diff --git a/src/mongo/s/sharding_initialization.cpp b/src/mongo/s/sharding_initialization.cpp
index 11d55bfa79c..993182d3c97 100644
--- a/src/mongo/s/sharding_initialization.cpp
+++ b/src/mongo/s/sharding_initialization.cpp
@@ -55,7 +55,6 @@
#include "mongo/executor/task_executor_pool.h"
#include "mongo/executor/thread_pool_task_executor.h"
#include "mongo/logv2/log.h"
-#include "mongo/rpc/metadata/config_server_metadata.h"
#include "mongo/rpc/metadata/metadata_hook.h"
#include "mongo/s/balancer_configuration.h"
#include "mongo/s/catalog/sharding_catalog_client_impl.h"
diff --git a/src/mongo/s/sharding_router_test_fixture.cpp b/src/mongo/s/sharding_router_test_fixture.cpp
index 8c7af5b2001..1597ca75e8e 100644
--- a/src/mongo/s/sharding_router_test_fixture.cpp
+++ b/src/mongo/s/sharding_router_test_fixture.cpp
@@ -65,7 +65,6 @@
#include "mongo/s/config_server_catalog_cache_loader.h"
#include "mongo/s/grid.h"
#include "mongo/s/query/cluster_cursor_manager.h"
-#include "mongo/s/sharding_egress_metadata_hook_for_mongos.h"
#include "mongo/s/sharding_task_executor.h"
#include "mongo/s/write_ops/batched_command_response.h"
#include "mongo/transport/mock_session.h"
@@ -109,7 +108,6 @@ ShardingTestFixture::ShardingTestFixture()
hookList->addHook(std::make_unique<rpc::VectorClockMetadataHook>(service));
hookList->addHook(std::make_unique<rpc::CommittedOpTimeMetadataHook>(service));
hookList->addHook(std::make_unique<rpc::ClientMetadataPropagationEgressHook>());
- hookList->addHook(std::make_unique<rpc::ShardingEgressMetadataHookForMongos>(service));
return hookList;
};