From e3bd4b74f79fd672722ff8e9cf91bd105231afb4 Mon Sep 17 00:00:00 2001 From: Ruchitha Rajaghatta <77162985+ruchitharajaghatta@users.noreply.github.com> Date: Tue, 26 May 2026 16:06:06 -0400 Subject: [PATCH] SERVER-124071: replSetRequestVotes, replSetUpdatePosition, replSetTestEgress, replSetGetRBID should error for Infinite (#54047) GitOrigin-RevId: 95744580893a335bdf194726325647890674653d --- src/mongo/db/repl/repl_set_commands.cpp | 8 ++++++++ src/mongo/db/repl/repl_set_test_egress.cpp | 9 +++++++++ .../attached_storage/attached_persistence_provider.cpp | 4 ++++ .../rss/attached_storage/attached_persistence_provider.h | 4 ++++ src/mongo/db/rss/persistence_provider.h | 4 ++++ src/mongo/db/rss/stub_persistence_provider.h | 6 ++++++ 6 files changed, 35 insertions(+) diff --git a/src/mongo/db/repl/repl_set_commands.cpp b/src/mongo/db/repl/repl_set_commands.cpp index 8f5ded3c33a..53fcb152945 100644 --- a/src/mongo/db/repl/repl_set_commands.cpp +++ b/src/mongo/db/repl/repl_set_commands.cpp @@ -71,6 +71,7 @@ #include "mongo/db/repl/replication_process.h" #include "mongo/db/repl/storage_interface.h" #include "mongo/db/repl/update_position_args.h" +#include "mongo/db/rss/replicated_storage_service.h" #include "mongo/db/server_options.h" #include "mongo/db/service_context.h" #include "mongo/db/shard_role/lock_manager/d_concurrency.h" @@ -238,6 +239,13 @@ public: const DatabaseName&, const BSONObj& cmdObj, BSONObjBuilder& result) override { + + const auto& provider = rss::ReplicatedStorageService::get(opCtx).getPersistenceProvider(); + uassert(ErrorCodes::CommandNotSupported, + str::stream() << "replSetGetRBID command is not supported in this storage mode: " + << provider.name(), + provider.supportsLegacyReplSetCommands()); + Status status = ReplicationCoordinator::get(opCtx)->checkReplEnabledForCommand(&result); uassertStatusOK(status); diff --git a/src/mongo/db/repl/repl_set_test_egress.cpp b/src/mongo/db/repl/repl_set_test_egress.cpp index 5728437db70..aa71e48dfa5 100644 --- a/src/mongo/db/repl/repl_set_test_egress.cpp +++ b/src/mongo/db/repl/repl_set_test_egress.cpp @@ -37,6 +37,7 @@ #include "mongo/db/repl/member_data.h" #include "mongo/db/repl/repl_set_test_egress_gen.h" #include "mongo/db/repl/replication_coordinator.h" +#include "mongo/db/rss/replicated_storage_service.h" #include "mongo/db/service_context.h" #include "mongo/executor/network_interface.h" #include "mongo/executor/network_interface_factory.h" @@ -116,6 +117,14 @@ public: using InvocationBase::InvocationBase; Reply typedRun(OperationContext* opCtx) { + const auto& provider = + rss::ReplicatedStorageService::get(opCtx).getPersistenceProvider(); + uassert( + ErrorCodes::CommandNotSupported, + str::stream() << "replSetTestEgress command is not supported in this storage mode: " + << provider.name(), + provider.supportsLegacyReplSetCommands()); + const auto& cmd = request(); HostAndPort target; diff --git a/src/mongo/db/rss/attached_storage/attached_persistence_provider.cpp b/src/mongo/db/rss/attached_storage/attached_persistence_provider.cpp index ad94f3b8939..86f30ba0588 100644 --- a/src/mongo/db/rss/attached_storage/attached_persistence_provider.cpp +++ b/src/mongo/db/rss/attached_storage/attached_persistence_provider.cpp @@ -238,4 +238,8 @@ bool AttachedPersistenceProvider::supportsColdCollections() const { return false; } +bool AttachedPersistenceProvider::supportsLegacyReplSetCommands() const { + return true; +} + } // namespace mongo::rss diff --git a/src/mongo/db/rss/attached_storage/attached_persistence_provider.h b/src/mongo/db/rss/attached_storage/attached_persistence_provider.h index 51df3c6cc68..088fac1d260 100644 --- a/src/mongo/db/rss/attached_storage/attached_persistence_provider.h +++ b/src/mongo/db/rss/attached_storage/attached_persistence_provider.h @@ -238,6 +238,10 @@ public: * Attached storage does not support cold collections. */ bool supportsColdCollections() const override; + + /** + * Attached storage supports replSetTestEgress and replSetGetRBID commands. */ + bool supportsLegacyReplSetCommands() const override; }; } // namespace mongo::rss diff --git a/src/mongo/db/rss/persistence_provider.h b/src/mongo/db/rss/persistence_provider.h index c67a2358cb9..58f3e2772fa 100644 --- a/src/mongo/db/rss/persistence_provider.h +++ b/src/mongo/db/rss/persistence_provider.h @@ -285,6 +285,10 @@ public: * If true, the provider supports cold collections. */ virtual bool supportsColdCollections() const = 0; + + /** + * If true, the provider supports replSetTestEgress and replSetGetRBID commands. */ + virtual bool supportsLegacyReplSetCommands() const = 0; }; } // namespace rss diff --git a/src/mongo/db/rss/stub_persistence_provider.h b/src/mongo/db/rss/stub_persistence_provider.h index deeea71f8a1..1ca89c9693b 100644 --- a/src/mongo/db/rss/stub_persistence_provider.h +++ b/src/mongo/db/rss/stub_persistence_provider.h @@ -270,6 +270,12 @@ public: uasserted(mongo::ErrorCodes::NotImplemented, "StubPersistenceProvider::supportsColdCollections() method not implemented"); } + + bool supportsLegacyReplSetCommands() const override { + uasserted( + mongo::ErrorCodes::NotImplemented, + "StubPersistenceProvider::supportsLegacyReplSetCommands() method not implemented"); + } }; } // namespace mongo::rss