SERVER-124071: replSetRequestVotes, replSetUpdatePosition, replSetTestEgress, replSetGetRBID should error for Infinite (#54047)

GitOrigin-RevId: 95744580893a335bdf194726325647890674653d
This commit is contained in:
Ruchitha Rajaghatta 2026-05-26 16:06:06 -04:00 committed by MongoDB Bot
parent 8f8e471e1a
commit e3bd4b74f7
6 changed files with 35 additions and 0 deletions

View File

@ -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);

View File

@ -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;

View File

@ -238,4 +238,8 @@ bool AttachedPersistenceProvider::supportsColdCollections() const {
return false;
}
bool AttachedPersistenceProvider::supportsLegacyReplSetCommands() const {
return true;
}
} // namespace mongo::rss

View File

@ -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

View File

@ -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

View File

@ -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