SERVER-113303 Mark module boundaries for `networking.execution` (#43412)

GitOrigin-RevId: b6a1aeaf40c97d7528d4661464fb0e8abd23e90c
This commit is contained in:
Saman Memaripour 2025-11-04 12:27:02 -05:00 committed by MongoDB Bot
parent e24176cd21
commit 9629e06a44
19 changed files with 60 additions and 31 deletions

2
.github/CODEOWNERS vendored
View File

@ -2972,6 +2972,8 @@ WORKSPACE.bazel @10gen/devprod-build @svc-auto-approve-bot
/src/mongo/s/**/client_metadata_propagation_egress_hook* @10gen/server-networking-and-observability @svc-auto-approve-bot
/src/mongo/s/**/balancer_feature_flag* @10gen/server-cluster-scalability @svc-auto-approve-bot
/src/mongo/s/**/sharding_task_executor_pool* @10gen/server-networking-and-observability @svc-auto-approve-bot
/src/mongo/s/**/sharding_task_executor.* @10gen/server-catalog-and-routing-routing-and-topology @svc-auto-approve-bot
/src/mongo/s/**/sharding_task_executor_test.cpp @10gen/server-catalog-and-routing-routing-and-topology @svc-auto-approve-bot
# The following patterns are parsed from ./src/mongo/s/change_streams/OWNERS.yml
/src/mongo/s/change_streams/**/* @10gen/query-execution-change-streams @10gen/server-catalog-and-routing @svc-auto-approve-bot

View File

@ -725,6 +725,7 @@ networking.execution:
meta:
slack: server-networking-observability
jira: Networking & Observability
fully_marked: true
files:
- src/mongo/db/baton*
- src/mongo/db/default_baton*

View File

@ -32,6 +32,7 @@
#include "mongo/util/cancellation.h"
#include "mongo/util/functional.h"
#include "mongo/util/future.h"
#include "mongo/util/modules.h"
#include "mongo/util/out_of_line_executor.h"
#include "mongo/util/time_support.h"
#include "mongo/util/waitable.h"
@ -51,7 +52,7 @@ class NetworkingBaton;
class Baton;
using BatonHandle = std::shared_ptr<Baton>;
using BatonHandle MONGO_MOD_PUBLIC = std::shared_ptr<Baton>;
/**
* A Baton is lightweight executor, with parallel forward progress guarantees. Rather than
@ -60,9 +61,9 @@ using BatonHandle = std::shared_ptr<Baton>;
*
* Note: This occurs automatically when opCtx waiting on a condition variable.
*/
class Baton : public Waitable,
public OutOfLineExecutor,
public std::enable_shared_from_this<Baton> {
class MONGO_MOD_OPEN Baton : public Waitable,
public OutOfLineExecutor,
public std::enable_shared_from_this<Baton> {
public:
~Baton() override = default;

View File

@ -35,6 +35,7 @@
#include "mongo/stdx/unordered_map.h"
#include "mongo/util/clock_source.h"
#include "mongo/util/functional.h"
#include "mongo/util/modules.h"
#include "mongo/util/out_of_line_executor.h"
#include "mongo/util/time_support.h"
#include "mongo/util/waitable.h"
@ -48,7 +49,7 @@ class OperationContext;
/**
* The most basic Baton implementation.
*/
class DefaultBaton : public Baton {
class MONGO_MOD_PUBLIC DefaultBaton : public Baton {
public:
explicit DefaultBaton(OperationContext* opCtx);

View File

@ -34,6 +34,7 @@
#include "mongo/executor/remote_command_response.h"
#include "mongo/executor/task_executor.h"
#include "mongo/util/duration.h"
#include "mongo/util/modules.h"
#include "mongo/util/net/hostandport.h"
#include <cstddef>
@ -54,7 +55,7 @@ namespace executor {
/**
* An async harness for scatter/gathering a command across an arbitrary number of specific hosts
*/
class AsyncMulticaster {
class MONGO_MOD_PUBLIC AsyncMulticaster {
public:
using Reply = std::tuple<HostAndPort, executor::RemoteCommandResponse>;
static constexpr size_t kMaxConcurrency = 100;

View File

@ -33,6 +33,7 @@
#include "mongo/db/request_execution_context.h"
#include "mongo/util/concurrency/thread_pool.h"
#include "mongo/util/future.h"
#include "mongo/util/modules.h"
#include <memory>
#include <string>
@ -44,7 +45,7 @@ namespace mongo {
* Requests (i.e., instances of `RequestExecutionContext`) are scheduled on a thread-pool, and
* passed to the command-specific implementation of `handleRequest`.
*/
class AsyncRequestExecutor {
class MONGO_MOD_OPEN AsyncRequestExecutor {
public:
AsyncRequestExecutor(AsyncRequestExecutor&&) = delete;
AsyncRequestExecutor(const AsyncRequestExecutor&) = delete;

View File

@ -33,6 +33,7 @@
#include "mongo/stdx/mutex.h"
#include "mongo/stdx/unordered_set.h"
#include "mongo/util/duration.h"
#include "mongo/util/modules.h"
#include "mongo/util/time_support.h"
#include <memory>
@ -102,7 +103,7 @@ private:
* destroy these without destroying the underlying AsyncTimerMockImpl objects
* accessed by tests and introducing races.
*/
class AsyncTimerMock : public AsyncTimerInterface {
class MONGO_MOD_PUBLIC AsyncTimerMock : public AsyncTimerInterface {
public:
AsyncTimerMock(std::shared_ptr<AsyncTimerMockImpl> timer);
@ -123,7 +124,7 @@ private:
* Shared pointers to timer impls are kept in a set here for access by tests,
* and these are also passed into the returned AsyncTimerMock objects.
*/
class AsyncTimerFactoryMock : public AsyncTimerFactoryInterface {
class MONGO_MOD_PUBLIC AsyncTimerFactoryMock : public AsyncTimerFactoryInterface {
public:
AsyncTimerFactoryMock() = default;

View File

@ -33,6 +33,7 @@
#include "mongo/executor/async_rpc.h"
#include "mongo/s/async_rpc_shard_targeter.h"
#include "mongo/s/transaction_router.h"
#include "mongo/util/modules.h"
#include <memory>
@ -44,7 +45,7 @@ namespace mongo::async_rpc {
* shardId.
*/
template <typename CommandType>
ExecutorFuture<AsyncRPCResponse<typename CommandType::Reply>> sendTxnCommand(
MONGO_MOD_PUBLIC ExecutorFuture<AsyncRPCResponse<typename CommandType::Reply>> sendTxnCommand(
std::shared_ptr<AsyncRPCOptions<CommandType>> options,
OperationContext* opCtx,
std::unique_ptr<ShardIdTargeter> targeter) {

View File

@ -34,17 +34,19 @@
#include "mongo/executor/async_client_factory.h"
#include "mongo/executor/connection_pool_stats.h"
#include "mongo/transport/grpc_connection_stats_gen.h"
#include "mongo/util/modules.h"
namespace mongo::executor {
/**
* Similar to assertConnectionStatsSoon but asserts on the values immediately.
*/
void assertConnectionStats(const AsyncClientFactory& factory,
const HostAndPort& remote,
std::function<bool(const ConnectionStatsPer&)> connectionPoolTest,
std::function<bool(const GRPCConnectionStats&)> gRPCTest,
StringData errMsg);
MONGO_MOD_PUBLIC void assertConnectionStats(
const AsyncClientFactory& factory,
const HostAndPort& remote,
std::function<bool(const ConnectionStatsPer&)> connectionPoolTest,
std::function<bool(const GRPCConnectionStats&)> gRPCTest,
StringData errMsg);
/**
* Asserts that the connection stats reach a certain value within a 30 second window. If the test is
@ -54,10 +56,11 @@ void assertConnectionStats(const AsyncClientFactory& factory,
* failure, a stringified version of the stats will be added to the errMsg.
* TODO: SERVER-66126 Some callsites can switched to use assertConnectionStats.
*/
void assertConnectionStatsSoon(const AsyncClientFactory& factory,
const HostAndPort& remote,
std::function<bool(const ConnectionStatsPer&)> connectionPoolTest,
std::function<bool(const GRPCConnectionStats&)> gRPCTest,
StringData errMsg);
MONGO_MOD_PUBLIC void assertConnectionStatsSoon(
const AsyncClientFactory& factory,
const HostAndPort& remote,
std::function<bool(const ConnectionStatsPer&)> connectionPoolTest,
std::function<bool(const GRPCConnectionStats&)> gRPCTest,
StringData errMsg);
} // namespace mongo::executor

View File

@ -38,13 +38,14 @@
#include "mongo/unittest/log_test.h"
#include "mongo/unittest/unittest.h"
#include "mongo/util/duration.h"
#include "mongo/util/modules.h"
#include "mongo/util/uuid.h"
namespace mongo {
namespace executor {
class ExecutorIntegrationTestFixture : public mongo::unittest::Test {
class MONGO_MOD_OPEN ExecutorIntegrationTestFixture : public mongo::unittest::Test {
public:
virtual BSONObj runSetupCommandSync(const DatabaseName& db, BSONObj cmdObj) = 0;

View File

@ -36,6 +36,7 @@
#include "mongo/transport/transport_layer.h"
#include "mongo/util/cancellation.h"
#include "mongo/util/future.h"
#include "mongo/util/modules.h"
#include <memory>
@ -47,7 +48,7 @@ namespace mongo::executor {
*
* The underlying session is returned to the pool upon destruction of the ExhaustResponseReader.
*/
class ExhaustResponseReaderTL : public NetworkInterface::ExhaustResponseReader {
class MONGO_MOD_PUBLIC ExhaustResponseReaderTL : public NetworkInterface::ExhaustResponseReader {
public:
ExhaustResponseReaderTL(RemoteCommandRequest originalRequest,
RemoteCommandResponse initialResponse,

View File

@ -31,11 +31,12 @@
#include "mongo/executor/network_interface.h"
#include "mongo/executor/task_executor.h"
#include "mongo/util/modules.h"
#include <memory>
namespace mongo {
namespace executor {
namespace MONGO_MOD_PUBLIC executor {
/**
* Returns a new TaskExecutor that does all of its RPC execution over the same transport session.
@ -52,5 +53,5 @@ std::shared_ptr<TaskExecutor> makePinnedConnectionTaskExecutor(std::shared_ptr<T
*/
std::shared_ptr<TaskExecutor> makePinnedConnectionTaskExecutor(std::shared_ptr<TaskExecutor> exec);
} // namespace executor
} // namespace MONGO_MOD_PUBLIC executor
} // namespace mongo

View File

@ -30,11 +30,13 @@
#include "mongo/db/service_context.h"
#include "mongo/executor/task_executor.h"
#include "mongo/util/modules.h"
#include <list>
#include <memory>
namespace mongo::executor {
namespace mongo {
namespace MONGO_MOD_PUBLIC executor {
struct ExecutorPair {
std::weak_ptr<TaskExecutor> pinned;
@ -61,4 +63,5 @@ private:
// Shutdown and join all pinned executors that were built on top of 'underlying'.
void shutdownPinnedExecutors(ServiceContext* svc, const std::shared_ptr<TaskExecutor>& underlying);
} // namespace mongo::executor
} // namespace MONGO_MOD_PUBLIC executor
} // namespace mongo

View File

@ -44,6 +44,7 @@
#include "mongo/transport/transport_layer_mock.h"
#include "mongo/unittest/unittest.h"
#include "mongo/util/concurrency/thread_pool.h"
#include "mongo/util/modules.h"
#include <chrono>
@ -51,7 +52,7 @@
namespace mongo::executor {
class PinnedConnectionTaskExecutorTest : public ThreadPoolExecutorTest {
class MONGO_MOD_OPEN PinnedConnectionTaskExecutorTest : public ThreadPoolExecutorTest {
using SinkMessageCbT = std::function<Status(Message)>;
using SourceMessageCbT = std::function<StatusWith<Message>()>;

View File

@ -73,3 +73,9 @@ filters:
- "sharding_task_executor_pool*":
approvers:
- 10gen/server-networking-and-observability
- "sharding_task_executor.*":
approvers:
- 10gen/server-catalog-and-routing-routing-and-topology
- "sharding_task_executor_test.cpp":
approvers:
- 10gen/server-catalog-and-routing-routing-and-topology

View File

@ -44,6 +44,7 @@
#include "mongo/executor/task_executor.h"
#include "mongo/util/future.h"
#include "mongo/util/interruptible.h"
#include "mongo/util/modules.h"
#include "mongo/util/net/hostandport.h"
#include "mongo/util/producer_consumer_queue.h"
#include "mongo/util/time_support.h"
@ -93,7 +94,7 @@ namespace mongo {
*
* Does not throw exceptions.
*/
class AsyncRequestsSender {
class MONGO_MOD_PUBLIC AsyncRequestsSender {
AsyncRequestsSender(const AsyncRequestsSender&) = delete;
AsyncRequestsSender& operator=(const AsyncRequestsSender&) = delete;

View File

@ -46,6 +46,7 @@
#include "mongo/util/cancellation.h"
#include "mongo/util/future.h"
#include "mongo/util/future_impl.h"
#include "mongo/util/modules.h"
#include "mongo/util/net/hostandport.h"
#include "mongo/util/out_of_line_executor.h"
@ -61,7 +62,7 @@
namespace mongo {
namespace async_rpc {
class ShardIdTargeter : public Targeter {
class MONGO_MOD_OPEN ShardIdTargeter : public Targeter {
public:
ShardIdTargeter(ExecutorPtr executor,
OperationContext* opCtx,

View File

@ -38,6 +38,7 @@
#include "mongo/stdx/condition_variable.h"
#include "mongo/util/future.h"
#include "mongo/util/interruptible.h"
#include "mongo/util/modules.h"
#include "mongo/util/net/hostandport.h"
#include "mongo/util/time_support.h"
@ -54,7 +55,7 @@ class ThreadPoolTaskExecutor;
* Implementation of a TaskExecutor that uses ThreadPoolTaskExecutor to submit tasks and allows to
* override methods if needed.
*/
class ShardingTaskExecutor final : public TaskExecutor {
class MONGO_MOD_PUBLIC ShardingTaskExecutor final : public TaskExecutor {
struct Passkey {
explicit Passkey() = default;
};

View File

@ -41,6 +41,7 @@
#include "mongo/util/assert_util.h"
#include "mongo/util/concurrency/with_lock.h"
#include "mongo/util/duration.h"
#include "mongo/util/modules.h"
#include "mongo/util/net/hostandport.h"
#include "mongo/util/synchronized_value.h"
@ -81,7 +82,7 @@ class ShardRegistry;
* * The ServerParameters can update the Parameters which will used in the next update
* * The SpecificPools for its ConnectionPool can updateHost with their individual States
*/
class ShardingTaskExecutorPoolController final
class MONGO_MOD_PUBLIC ShardingTaskExecutorPoolController final
: public executor::ConnectionPool::ControllerInterface {
class ReplicaSetChangeListener;