SERVER-109797 Rename command running functions in Shard (#40525)

Co-authored-by: Blake Oler <blake.oler@mongodb.com>
GitOrigin-RevId: 6d96de70d2623944cbb567cdaf12f5800ad47ddf
This commit is contained in:
Guillaume Racicot 2025-09-02 10:15:48 -04:00 committed by MongoDB Bot
parent 9e35b92e50
commit b739801eea
81 changed files with 621 additions and 637 deletions

View File

@ -72,7 +72,8 @@ StatusWith<std::set<boost::optional<TenantId>>> getTenantsWithConfigDbsOnShard(
listDbCommand.setNameOnly(true);
std::set<boost::optional<TenantId>> tenantIds;
auto swListDbResponse = shard.runCommand(opCtx,
auto swListDbResponse =
shard.runCommandWithIndefiniteRetries(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
listDbCommand.toBSON(),

View File

@ -136,8 +136,8 @@ getFCVAndClusterParametersFromConfigServer() {
findFCV.setReadConcern(repl::ReadConcernArgs::kSnapshot);
findFCV.setLimit(1);
auto findFCVResponseBSON =
uassertStatusOK(
configServers->runCommand(opCtx.get(),
uassertStatusOK(configServers->runCommandWithIndefiniteRetries(
opCtx.get(),
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
findFCV.getDbName(),
findFCV.toBSON(),

View File

@ -51,8 +51,8 @@ void setClusterParameterImplRouter(OperationContext* opCtx,
const auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
const auto cmdResponse = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
opCtx,
const auto cmdResponse =
uassertStatusOK(configShard->runCommand(opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
configsvrSetClusterParameter.toBSON(),

View File

@ -337,8 +337,7 @@ void handleDropPendingDBsGarbage(OperationContext* parentOpCtx) {
request.setDbName(DatabaseName::kAdmin);
request.setTypes({{DDLCoordinatorType_serializer(DDLCoordinatorTypeEnum::kDropDatabase)}});
const auto response = shard->runCommandWithFixedRetryAttempts(
opCtx,
const auto response = shard->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
request.toBSON(),

View File

@ -212,7 +212,7 @@ QuerySettingsStage::createQueryShapeRepresentativeQueriesCursor(OperationContext
findRepresentativeQueriesCmd.setReadConcern(readConcernArgs);
auto configShard = grid->shardRegistry()->getConfigShard();
auto shardResponse = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
auto shardResponse = uassertStatusOK(configShard->runCommand(
opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
nss.dbName(),

View File

@ -400,7 +400,7 @@ void forcePrimaryDatabaseRefreshAndWaitForReplication(OperationContext* opCtx,
// currently have no way to detect a topology change/rollback after the return from primary is
// received.
runAndThrowIfTermChanged(opCtx, [&](auto term) {
auto cmdResponse = uassertStatusOK(selfShard->runCommandWithFixedRetryAttempts(
auto cmdResponse = uassertStatusOK(selfShard->runCommand(
opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
@ -1381,7 +1381,7 @@ ShardServerCatalogCacheLoaderImpl::_forcePrimaryCollectionRefreshAndWaitForRepli
return runAndThrowIfTermChanged(opCtx, [&](auto term) {
auto notif = _namespaceNotifications.createNotification(nss);
auto cmdResponse = uassertStatusOK(selfShard->runCommandWithFixedRetryAttempts(
auto cmdResponse = uassertStatusOK(selfShard->runCommand(
opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,

View File

@ -71,8 +71,8 @@ public:
&opCtx->getWriteConcern());
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto cmdResponse = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
opCtx,
auto cmdResponse = uassertStatusOK(
configShard->runCommand(opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
configsvrAbortReshardCollection.toBSON(),

View File

@ -71,8 +71,8 @@ public:
&opCtx->getWriteConcern());
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto cmdResponse = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
opCtx,
auto cmdResponse = uassertStatusOK(
configShard->runCommand(opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
configsvrAbortReshardCollection.toBSON(),

View File

@ -86,8 +86,8 @@ public:
cmd.serialize(&cmdBuilder);
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto cmdResponseStatus = uassertStatusOK(
configShard->runCommandWithFixedRetryAttempts(opCtx,
auto cmdResponseStatus =
uassertStatusOK(configShard->runCommand(opCtx,
kPrimaryOnlyReadPreference,
DatabaseName::kAdmin,
cmdBuilder.obj(),

View File

@ -70,8 +70,8 @@ public:
generic_argument_util::setMajorityWriteConcern(cmd, &opCtx->getWriteConcern());
auto cfg = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto response = uassertStatusOK(cfg->runCommandWithFixedRetryAttempts(
opCtx,
auto response =
uassertStatusOK(cfg->runCommand(opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
cmd.toBSON(),

View File

@ -139,8 +139,8 @@ CachedDatabaseInfo createDatabase(OperationContext* opCtx,
auto txnRouterResourceYielder = TransactionRouterResourceYielder::makeForRemoteCommand();
auto sendCommand = [&] {
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto response = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
opCtx,
auto response = uassertStatusOK(
configShard->runCommand(opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
request.toBSON(),

View File

@ -101,8 +101,8 @@ public:
generic_argument_util::setMajorityWriteConcern(configsvrCreateDatabase);
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto response = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
opCtx,
auto response = uassertStatusOK(
configShard->runCommand(opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
configsvrCreateDatabase.toBSON(),

View File

@ -147,8 +147,7 @@ public:
}
const auto s = std::move(shardStatus.getValue());
auto response = uassertStatusOK(
s->runCommandWithFixedRetryAttempts(opCtx,
auto response = uassertStatusOK(s->runCommand(opCtx,
ReadPreferenceSetting::get(opCtx),
DatabaseName::kAdmin,
filteredCmd,

View File

@ -97,8 +97,8 @@ public:
shardSvrMergeAllChunksOnShard.setMaxTimeProcessingChunksMS(
req.getMaxTimeProcessingChunksMS());
auto swCommandResponse = shard->runCommandWithFixedRetryAttempts(
opCtx,
auto swCommandResponse =
shard->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
shardSvrMergeAllChunksOnShard.toBSON(),

View File

@ -115,8 +115,8 @@ public:
auto shard = uassertStatusOK(
Grid::get(opCtx)->shardRegistry()->getShard(opCtx, firstChunk.getShardId()));
auto response = uassertStatusOK(shard->runCommandWithFixedRetryAttempts(
opCtx,
auto response = uassertStatusOK(
shard->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
cmdBuilder.obj(),

View File

@ -123,7 +123,7 @@ public:
parsedRequest.appendAsConfigCommand(&cmdBuilder);
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto cmdResponseStatus = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
auto cmdResponseStatus = uassertStatusOK(configShard->runCommand(
opCtx,
kPrimaryOnlyReadPreference,
DatabaseName::kAdmin,

View File

@ -75,12 +75,12 @@ public:
cmd.serialize(&cmdBuilder);
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto cmdResponse = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
opCtx,
auto cmdResponse = uassertStatusOK(
configShard->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
CommandHelpers::appendMajorityWriteConcern(cmdBuilder.obj(),
opCtx->getWriteConcern()),
CommandHelpers::appendMajorityWriteConcern(
cmdBuilder.obj(), opCtx->getWriteConcern()),
Shard::RetryPolicy::kIdempotent));
uassertStatusOK(cmdResponse.commandStatus);
}

View File

@ -89,8 +89,9 @@ public:
configsvrRequest.setWriteConcern(defaultMajorityWriteConcernDoNotUse());
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
const auto commandResponse = uassertStatusOK(
configShard->runCommand(opCtx,
const auto commandResponse =
uassertStatusOK(configShard->runCommandWithIndefiniteRetries(
opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
configsvrRequest.toBSON(),

View File

@ -382,7 +382,8 @@ ExecutorFuture<void> CollModCoordinator::_runImpl(
const auto& configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
uassertStatusOK(Shard::CommandResponse::getEffectiveStatus(
configShard->runCommand(opCtx,
configShard->runCommandWithIndefiniteRetries(
opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
nss().dbName(),
request.toBSON(),

View File

@ -183,8 +183,8 @@ void refreshDbVersionOnPrimaryShard(OperationContext* opCtx,
const ShardId& primaryShard) {
const auto shardRegistry = Grid::get(opCtx)->shardRegistry();
const auto primaryShardPtr = uassertStatusOK(shardRegistry->getShard(opCtx, primaryShard));
auto cmdResponse = uassertStatusOK(primaryShardPtr->runCommandWithFixedRetryAttempts(
opCtx,
auto cmdResponse = uassertStatusOK(
primaryShardPtr->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
BSON("_flushDatabaseCacheUpdates" << dbNameStr),

View File

@ -599,8 +599,8 @@ std::vector<NamespaceString> MovePrimaryCoordinator::cloneDataToRecipient(Operat
};
auto clonedCollections = [&](const BSONObj& command) {
const auto cloneResponse =
toShard->runCommand(opCtx,
const auto cloneResponse = toShard->runCommandWithIndefiniteRetries(
opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
command,
@ -654,7 +654,7 @@ void MovePrimaryCoordinator::commitMetadataToConfig(
const auto config = Grid::get(opCtx)->shardRegistry()->getConfigShard();
const auto commitResponse =
config->runCommandWithFixedRetryAttempts(opCtx,
config->runCommand(opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
commitCommand,
@ -905,8 +905,7 @@ void MovePrimaryCoordinator::enterCriticalSectionOnRecipient(
const auto shardRegistry = Grid::get(opCtx)->shardRegistry();
const auto toShard = uassertStatusOK(shardRegistry->getShard(opCtx, toShardId));
return toShard->runCommandWithFixedRetryAttempts(
opCtx,
return toShard->runCommand(opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
enterCriticalSectionCommand,
@ -958,8 +957,7 @@ void MovePrimaryCoordinator::exitCriticalSectionOnRecipient(
const auto shardRegistry = Grid::get(opCtx)->shardRegistry();
const auto toShard = uassertStatusOK(shardRegistry->getShard(opCtx, toShardId));
return toShard->runCommandWithFixedRetryAttempts(
opCtx,
return toShard->runCommand(opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
exitCriticalSectionCommand,

View File

@ -342,10 +342,8 @@ ExecutorFuture<void> RefineCollectionShardKeyCoordinator::_runImpl(
commitRequest.setCommitRefineCollectionShardKeyRequest(cRCSreq);
generic_argument_util::setMajorityWriteConcern(commitRequest);
auto commitResponse = Grid::get(opCtx)
->shardRegistry()
->getConfigShard()
->runCommandWithFixedRetryAttempts(
auto commitResponse =
Grid::get(opCtx)->shardRegistry()->getConfigShard()->runCommand(
opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,

View File

@ -333,8 +333,8 @@ std::vector<ShardId> getCurrentCollPlacement(OperationContext* opCtx, const UUID
distinctRequest.setReadConcern(repl::ReadConcernArgs::kLocal);
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto reply = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
opCtx,
auto reply = uassertStatusOK(
configShard->runCommand(opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly, TagSet{}),
DatabaseName::kConfig,
distinctRequest.toBSON(),

View File

@ -241,8 +241,8 @@ ExecutorFuture<void> ReshardCollectionCoordinator::_runImpl(
const auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
const auto cmdResponse = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
opCtx,
const auto cmdResponse = uassertStatusOK(
configShard->runCommand(opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
configsvrReshardCollection.toBSON(),

View File

@ -403,7 +403,8 @@ std::vector<BSONObj> ValidationBehaviorsShardCollection::loadIndexes(
void ValidationBehaviorsShardCollection::verifyUsefulNonMultiKeyIndex(
const NamespaceString& nss, const BSONObj& proposedKey) const {
uassertStatusOK(Shard::CommandResponse::getEffectiveStatus(_dataShard->runCommand(
uassertStatusOK(
Shard::CommandResponse::getEffectiveStatus(_dataShard->runCommandWithIndefiniteRetries(
_opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
@ -532,7 +533,8 @@ void ValidationBehaviorsReshardingBulkIndex::verifyUsefulNonMultiKeyIndex(
uassertStatusOK(Grid::get(_opCtx)->catalogCache()->getCollectionRoutingInfo(_opCtx, nss));
auto shard = uassertStatusOK(Grid::get(_opCtx)->shardRegistry()->getShard(
_opCtx, cri.getChunkManager().getMinKeyShardIdWithSimpleCollation()));
uassertStatusOK(Shard::CommandResponse::getEffectiveStatus(shard->runCommand(
uassertStatusOK(
Shard::CommandResponse::getEffectiveStatus(shard->runCommandWithIndefiniteRetries(
_opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,

View File

@ -83,8 +83,8 @@ StatusWith<long long> retrieveCollectionShardSize(OperationContext* opCtx,
const auto cmdObj =
BSON("dataSize" << NamespaceStringUtil::serialize(ns, SerializationContext::stateDefault())
<< "estimate" << estimate);
auto statStatus = shardStatus.getValue()->runCommandWithFixedRetryAttempts(
opCtx,
auto statStatus =
shardStatus.getValue()->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryPreferred},
ns.dbName(),
cmdObj,
@ -125,8 +125,8 @@ StatusWith<std::vector<BSONObj>> selectChunkSplitPoints(OperationContext* opCtx,
nss, shardKeyPattern.toBSON(), chunkRange.getMin(), chunkRange.getMax(), chunkSizeBytes);
req.setLimit(limit);
auto cmdStatus = shardStatus.getValue()->runCommandWithFixedRetryAttempts(
opCtx,
auto cmdStatus =
shardStatus.getValue()->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryPreferred},
nss.dbName(),
req.toBSON(),
@ -202,8 +202,8 @@ Status splitChunkAtMultiplePoints(OperationContext* opCtx,
if (!shardStatus.isOK()) {
status = shardStatus.getStatus();
} else {
auto cmdStatus = shardStatus.getValue()->runCommandWithFixedRetryAttempts(
opCtx,
auto cmdStatus =
shardStatus.getValue()->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
cmdObj,

View File

@ -610,8 +610,7 @@ Status ShardingCatalogManager::setFeatureCompatibilityVersionOnShards(OperationC
continue;
}
auto response = shard->runCommandWithFixedRetryAttempts(
opCtx,
auto response = shard->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
cmdObj,
@ -652,8 +651,7 @@ Status ShardingCatalogManager::runCloneAuthoritativeMetadataOnShards(OperationCo
request.setWriteConcern(defaultMajorityWriteConcernDoNotUse());
request.setDbName(DatabaseName::kAdmin);
auto response = shard->runCommandWithFixedRetryAttempts(
opCtx,
auto response = shard->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
request.toBSON(),

View File

@ -1896,8 +1896,7 @@ void ShardingCatalogManager::upgradeChunksHistory(OperationContext* opCtx,
for (const auto& shardId : shardsOwningChunks) {
auto shard = uassertStatusOK(shardRegistry->getShard(opCtx, shardId));
uassertStatusOK(
Shard::CommandResponse::getEffectiveStatus(shard->runCommandWithFixedRetryAttempts(
uassertStatusOK(Shard::CommandResponse::getEffectiveStatus(shard->runCommand(
opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,

View File

@ -811,7 +811,7 @@ void ShardingCatalogManager::initializePlacementHistory(OperationContext* opCtx)
}()});
deleteOp.setWriteConcern(ShardingCatalogClient::writeConcernLocalHavingUpstreamWaiter());
uassertStatusOK(_localConfigShard->runCommandWithFixedRetryAttempts(
uassertStatusOK(_localConfigShard->runCommand(
opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
NamespaceString::kConfigsvrPlacementHistoryNamespace.dbName(),
@ -1002,8 +1002,8 @@ void ShardingCatalogManager::cleanUpPlacementHistory(OperationContext* opCtx,
write_ops::DeleteCommandRequest deleteRequest(
NamespaceString::kConfigsvrPlacementHistoryNamespace);
deleteRequest.setDeletes(std::move(deleteStatements));
uassertStatusOK(_localConfigShard->runCommandWithFixedRetryAttempts(
opCtx,
uassertStatusOK(
_localConfigShard->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
NamespaceString::kConfigsvrPlacementHistoryNamespace.dbName(),
deleteRequest.toBSON(),

View File

@ -242,7 +242,7 @@ void setAllowMigrations(OperationContext* opCtx,
}
const auto swSetAllowMigrationsResult =
Grid::get(opCtx)->shardRegistry()->getConfigShard()->runCommandWithFixedRetryAttempts(
Grid::get(opCtx)->shardRegistry()->getConfigShard()->runCommand(
opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
@ -301,8 +301,8 @@ void removeTagsMetadataFromConfig(OperationContext* opCtx,
generic_argument_util::setMajorityWriteConcern(configsvrRemoveTagsCmd);
generic_argument_util::setOperationSessionInfo(configsvrRemoveTagsCmd, osi);
const auto swRemoveTagsResult = configShard->runCommandWithFixedRetryAttempts(
opCtx,
const auto swRemoveTagsResult =
configShard->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
configsvrRemoveTagsCmd.toBSON(),
@ -331,8 +331,8 @@ void removeQueryAnalyzerMetadata(OperationContext* opCtx,
NamespaceString::kConfigQueryAnalyzersNamespace);
generic_argument_util::setMajorityWriteConcern(deleteCmd);
deleteCmd.setDeletes(std::move(deleteOps));
const auto deleteResult = configShard->runCommandWithFixedRetryAttempts(
opCtx,
const auto deleteResult =
configShard->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kConfig,
deleteCmd.toBSON(),
@ -358,8 +358,8 @@ void removeQueryAnalyzerMetadata(OperationContext* opCtx,
<< NamespaceStringUtil::serialize(nss, SerializationContext::stateDefault())));
entry.setMulti(false);
deleteCmd.setDeletes({std::move(entry)});
const auto deleteResult = configShard->runCommandWithFixedRetryAttempts(
opCtx,
const auto deleteResult =
configShard->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kConfig,
deleteCmd.toBSON(),

View File

@ -266,8 +266,7 @@ void invokeCommandOnShardWithIdempotentRetryPolicy(OperationContext* opCtx,
LOGV2_DEBUG(22023, 1, "Sending request to recipient", "commandToSend"_attr = redact(cmd));
auto response = recipientShard->runCommandWithFixedRetryAttempts(
opCtx,
auto response = recipientShard->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
dbName,
cmd,

View File

@ -111,8 +111,8 @@ public:
defaultMajorityWriteConcernDoNotUse());
auto config = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto swCommandResponse = config->runCommandWithFixedRetryAttempts(
opCtx,
auto swCommandResponse =
config->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
configSvrCommitMergeAllChunksOnShard.toBSON(),

View File

@ -127,7 +127,10 @@ public:
request.setWriteConcern(defaultMajorityWriteConcernDoNotUse());
auto cmdResponse =
uassertStatusOK(Grid::get(opCtx)->shardRegistry()->getConfigShard()->runCommand(
uassertStatusOK(Grid::get(opCtx)
->shardRegistry()
->getConfigShard()
->runCommandWithIndefiniteRetries(
opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,

View File

@ -217,8 +217,7 @@ Status splitChunk(OperationContext* opCtx,
auto configCmdObj = request.toConfigCommandBSON(defaultMajorityWriteConcernDoNotUse().toBSON());
auto cmdResponseStatus =
Grid::get(opCtx)->shardRegistry()->getConfigShard()->runCommandWithFixedRetryAttempts(
auto cmdResponseStatus = Grid::get(opCtx)->shardRegistry()->getConfigShard()->runCommand(
opCtx,
kPrimaryOnlyReadPreference,
DatabaseName::kAdmin,

View File

@ -553,8 +553,8 @@ StatusWith<repl::OpTimeWith<DatabaseType>> ShardingCatalogClientImpl::_fetchData
HistoricalPlacement ShardingCatalogClientImpl::_fetchPlacementMetadata(
OperationContext* opCtx, ConfigsvrGetHistoricalPlacement&& request) {
auto remoteResponse = uassertStatusOK(_getConfigShard(opCtx)->runCommandWithFixedRetryAttempts(
opCtx,
auto remoteResponse = uassertStatusOK(
_getConfigShard(opCtx)->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
request.toBSON(),
@ -1197,8 +1197,8 @@ Status ShardingCatalogClientImpl::runUserManagementWriteCommand(OperationContext
cmdToRun = modifiedCmd.obj();
}
auto swResponse = _getConfigShard(opCtx)->runCommandWithFixedRetryAttempts(
opCtx,
auto swResponse =
_getConfigShard(opCtx)->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
dbname,
cmdToRun,
@ -1233,8 +1233,8 @@ bool ShardingCatalogClientImpl::runUserManagementReadCommand(OperationContext* o
const DatabaseName& dbname,
const BSONObj& cmdObj,
BSONObjBuilder* result) {
auto resultStatus = _getConfigShard(opCtx)->runCommandWithFixedRetryAttempts(
opCtx,
auto resultStatus =
_getConfigShard(opCtx)->runCommand(opCtx,
kConfigPrimaryPreferredReadPreference,
dbname,
cmdObj,

View File

@ -214,7 +214,7 @@ void ensureChunkVersionIsGreaterThan(OperationContext* opCtx,
hangInEnsureChunkVersionIsGreaterThanInterruptible.pauseWhileSet(opCtx);
const auto ensureChunkVersionIsGreaterThanResponse =
Grid::get(opCtx)->shardRegistry()->getConfigShard()->runCommandWithFixedRetryAttempts(
Grid::get(opCtx)->shardRegistry()->getConfigShard()->runCommand(
opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,

View File

@ -263,7 +263,8 @@ void ConfigServerHealthObserver::_runSmokeReadShardsCommand(std::shared_ptr<Chec
findOneShardResponse = Grid::get(ctx->opCtx.get())
->shardRegistry()
->getConfigShard()
->runCommand(ctx->opCtx.get(),
->runCommandWithIndefiniteRetries(
ctx->opCtx.get(),
readPref,
NamespaceString::kConfigsvrShardsNamespace.dbName(),
findCmdBuilder.done(),

View File

@ -1422,8 +1422,8 @@ bool ReplicationCoordinatorExternalStateImpl::isCWWCSetOnConfigShard(
OperationContext* opCtx) const {
GetDefaultRWConcern configsvrRequest;
configsvrRequest.setDbName(DatabaseName::kAdmin);
auto cmdResponse = uassertStatusOK(
Grid::get(opCtx)->shardRegistry()->getConfigShard()->runCommandWithFixedRetryAttempts(
auto cmdResponse =
uassertStatusOK(Grid::get(opCtx)->shardRegistry()->getConfigShard()->runCommand(
opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,

View File

@ -1310,8 +1310,8 @@ bool Balancer::_checkOIDs(OperationContext* opCtx) {
}
const auto s = std::move(shardStatus.getValue());
auto result = uassertStatusOK(
s->runCommandWithFixedRetryAttempts(opCtx,
auto result =
uassertStatusOK(s->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
BSON("features" << 1),
@ -1331,8 +1331,8 @@ bool Balancer::_checkOIDs(OperationContext* opCtx) {
"firstShardId"_attr = shardId,
"secondShardId"_attr = oids[x]);
result = uassertStatusOK(s->runCommandWithFixedRetryAttempts(
opCtx,
result = uassertStatusOK(
s->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
BSON("features" << 1 << "oidReset" << 1),
@ -1342,8 +1342,7 @@ bool Balancer::_checkOIDs(OperationContext* opCtx) {
auto otherShardStatus = shardingContext->shardRegistry()->getShard(opCtx, oids[x]);
if (otherShardStatus.isOK()) {
result = uassertStatusOK(
otherShardStatus.getValue()->runCommandWithFixedRetryAttempts(
result = uassertStatusOK(otherShardStatus.getValue()->runCommand(
opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,

View File

@ -270,8 +270,8 @@ public:
request.setWriteConcern(defaultMajorityWriteConcern());
const auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto swResponse = configShard->runCommandWithFixedRetryAttempts(
opCtx,
auto swResponse =
configShard->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kConfig,
request.toBSON(),

View File

@ -134,8 +134,9 @@ MigrationBatchFetcher<Inserter>::MigrationBatchFetcher(
template <typename Inserter>
BSONObj MigrationBatchFetcher<Inserter>::_fetchBatch(OperationContext* opCtx) {
auto commandResponse = uassertStatusOKWithContext(
_fromShard->runCommand(opCtx,
auto commandResponse =
uassertStatusOKWithContext(_fromShard->runCommandWithIndefiniteRetries(
opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
_migrateCloneRequest,

View File

@ -1563,7 +1563,8 @@ void MigrationDestinationManager::_migrateDriver(OperationContext* outerOpCtx,
auto fetchBatchFn = [&](OperationContext* opCtx, BSONObj* nextBatch) {
auto commandResponse = uassertStatusOKWithContext(
fromShard->runCommand(opCtx,
fromShard->runCommandWithIndefiniteRetries(
opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
xferModsRequest,
@ -1688,7 +1689,8 @@ void MigrationDestinationManager::_migrateDriver(OperationContext* outerOpCtx,
}
auto res = uassertStatusOKWithContext(
fromShard->runCommand(opCtx,
fromShard->runCommandWithIndefiniteRetries(
opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
xferModsRequest,

View File

@ -606,7 +606,7 @@ void MigrationSourceManager::commitChunkMetadataOnConfig() {
Timer t;
auto commitChunkMigrationResponse =
Grid::get(_opCtx)->shardRegistry()->getConfigShard()->runCommandWithFixedRetryAttempts(
Grid::get(_opCtx)->shardRegistry()->getConfigShard()->runCommand(
_opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,

View File

@ -425,7 +425,7 @@ ExecutorFuture<void> launchReleaseCriticalSectionOnRecipientFuture(
"release migration critical section on recipient",
[&](OperationContext* newOpCtx) {
try {
const auto response = recipientShard->runCommandWithFixedRetryAttempts(
const auto response = recipientShard->runCommand(
newOpCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,

View File

@ -454,8 +454,8 @@ void setupZonesForTempNss(OperationContext* opCtx,
cmdBuilder.append("writeConcern", resharding::kMajorityWriteConcern.toBSON());
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto cmdResponseStatus = uassertStatusOK(
configShard->runCommandWithFixedRetryAttempts(opCtx,
auto cmdResponseStatus =
uassertStatusOK(configShard->runCommand(opCtx,
kPrimaryOnlyReadPreference,
DatabaseName::kAdmin,
cmdBuilder.obj(),

View File

@ -202,7 +202,8 @@ BSONObj getNextSessionOplogBatch(OperationContext* opCtx,
uassertStatusOK(shardStatus.getStatus());
auto shard = shardStatus.getValue();
auto responseStatus = shard->runCommand(opCtx,
auto responseStatus =
shard->runCommandWithIndefiniteRetries(opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
buildMigrateSessionCmd(migrationSessionId),

View File

@ -169,7 +169,8 @@ TEST_F(ConfigShardWrapperTest, RunCommandAttachesMinClusterTime) {
expectedMinClusterTime.addTicks(10);
VectorClock::get(operationContext())->advanceConfigTime_forTest(expectedMinClusterTime);
auto result = _configShardWrapper->runCommand(operationContext(),
auto result =
_configShardWrapper->runCommandWithIndefiniteRetries(operationContext(),
ReadPreferenceSetting{},
DatabaseName::kConfig,
BSONObj{},

View File

@ -187,15 +187,18 @@ bool Shard::remoteIsRetriableError(ErrorCodes::Error code, RetryPolicy options)
MONGO_UNREACHABLE;
}
StatusWith<Shard::CommandResponse> Shard::runCommand(OperationContext* opCtx,
StatusWith<Shard::CommandResponse> Shard::runCommandWithIndefiniteRetries(
OperationContext* opCtx,
const ReadPreferenceSetting& readPref,
const DatabaseName& dbName,
const BSONObj& cmdObj,
RetryPolicy retryPolicy) {
return runCommand(opCtx, readPref, dbName, cmdObj, Milliseconds::max(), retryPolicy);
return runCommandWithIndefiniteRetries(
opCtx, readPref, dbName, cmdObj, Milliseconds::max(), retryPolicy);
}
StatusWith<Shard::CommandResponse> Shard::runCommand(OperationContext* opCtx,
StatusWith<Shard::CommandResponse> Shard::runCommandWithIndefiniteRetries(
OperationContext* opCtx,
const ReadPreferenceSetting& readPref,
const DatabaseName& dbName,
const BSONObj& cmdObj,
@ -223,18 +226,15 @@ StatusWith<Shard::CommandResponse> Shard::runCommand(OperationContext* opCtx,
MONGO_UNREACHABLE;
}
StatusWith<Shard::CommandResponse> Shard::runCommandWithFixedRetryAttempts(
OperationContext* opCtx,
StatusWith<Shard::CommandResponse> Shard::runCommand(OperationContext* opCtx,
const ReadPreferenceSetting& readPref,
const DatabaseName& dbName,
const BSONObj& cmdObj,
RetryPolicy retryPolicy) {
return runCommandWithFixedRetryAttempts(
opCtx, readPref, dbName, cmdObj, Milliseconds::max(), retryPolicy);
return runCommand(opCtx, readPref, dbName, cmdObj, Milliseconds::max(), retryPolicy);
}
StatusWith<Shard::CommandResponse> Shard::runCommandWithFixedRetryAttempts(
OperationContext* opCtx,
StatusWith<Shard::CommandResponse> Shard::runCommand(OperationContext* opCtx,
const ReadPreferenceSetting& readPref,
const DatabaseName& dbName,
const BSONObj& cmdObj,

View File

@ -214,18 +214,20 @@ public:
* given "retryPolicy". Retries indefinitely until/unless a non-retriable error is encountered,
* the maxTimeMs on the OperationContext expires, or the operation is interrupted.
*/
StatusWith<CommandResponse> runCommand(OperationContext* opCtx,
StatusWith<CommandResponse> runCommandWithIndefiniteRetries(
OperationContext* opCtx,
const ReadPreferenceSetting& readPref,
const DatabaseName& dbName,
const BSONObj& cmdObj,
RetryPolicy retryPolicy);
/**
* Same as the other variant of runCommand, but allows the operation timeout to be overriden.
* Runs for the lesser of the remaining time on the operation context or the specified maxTimeMS
* override.
* Same as the other variant of runCommandWithIndefiniteRetries, but allows the operation
* timeout to be overriden. Runs for the lesser of the remaining time on the operation
* context or the specified maxTimeMS override.
*/
StatusWith<CommandResponse> runCommand(OperationContext* opCtx,
StatusWith<CommandResponse> runCommandWithIndefiniteRetries(
OperationContext* opCtx,
const ReadPreferenceSetting& readPref,
const DatabaseName& dbName,
const BSONObj& cmdObj,
@ -233,24 +235,22 @@ public:
RetryPolicy retryPolicy);
/**
* Same as runCommand, but will only retry failed operations up to 3 times, regardless of
* the retryPolicy or the remaining maxTimeMs.
* Wherever possible this method should be avoided in favor of runCommand.
* Same as runCommandWithIndefiniteRetries, but will only retry failed operations up to 3
* times, regardless of the retryPolicy or the remaining maxTimeMs.
* Wherever possible this method should be avoided in favor of runCommandWithIndefiniteRetries.
*/
StatusWith<CommandResponse> runCommandWithFixedRetryAttempts(
OperationContext* opCtx,
StatusWith<CommandResponse> runCommand(OperationContext* opCtx,
const ReadPreferenceSetting& readPref,
const DatabaseName& dbName,
const BSONObj& cmdObj,
RetryPolicy retryPolicy);
/**
* Same as runCommand, but will only retry failed operations up to 3 times, regardless of
* the retryPolicy or the remaining maxTimeMs.
* Wherever possible this method should be avoided in favor of runCommand.
* Same as runCommandWithIndefiniteRetries, but will only retry failed operations up to 3
* times, regardless of the retryPolicy or the remaining maxTimeMs.
* Wherever possible this method should be avoided in favor of runCommandWithIndefiniteRetries.
*/
StatusWith<CommandResponse> runCommandWithFixedRetryAttempts(
OperationContext* opCtx,
StatusWith<CommandResponse> runCommand(OperationContext* opCtx,
const ReadPreferenceSetting& readPref,
const DatabaseName& dbName,
const BSONObj& cmdObj,

View File

@ -93,8 +93,8 @@ protected:
void runDummyCommandOnShard(ShardId shardId) {
auto shard = unittest::assertGet(shardRegistry()->getShard(operationContext(), shardId));
uassertStatusOK(
shard->runCommand(operationContext(),
uassertStatusOK(shard->runCommandWithIndefiniteRetries(
operationContext(),
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::createDatabaseName_forTest(boost::none, "unusedDb"),
BSON("unused" << "cmd"),
@ -103,8 +103,8 @@ protected:
void runDummyCommandOnShardWithMaxTimeMS(ShardId shardId, Milliseconds maxTimeMS) {
auto shard = unittest::assertGet(shardRegistry()->getShard(operationContext(), shardId));
uassertStatusOK(
shard->runCommand(operationContext(),
uassertStatusOK(shard->runCommandWithIndefiniteRetries(
operationContext(),
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::createDatabaseName_forTest(boost::none, "unusedDb"),
BSON("unused" << "cmd"),

View File

@ -196,7 +196,7 @@ std::shared_ptr<Shard> ConfigServerTestFixture::getConfigShard() const {
Status ConfigServerTestFixture::insertToConfigCollection(OperationContext* opCtx,
const NamespaceString& ns,
const BSONObj& doc) {
auto insertResponse = getConfigShard()->runCommand(
auto insertResponse = getConfigShard()->runCommandWithIndefiniteRetries(
opCtx,
kReadPref,
ns.dbName(),
@ -218,7 +218,7 @@ Status ConfigServerTestFixture::updateToConfigCollection(OperationContext* opCtx
const BSONObj& query,
const BSONObj& update,
const bool upsert) {
auto updateResponse = getConfigShard()->runCommand(
auto updateResponse = getConfigShard()->runCommandWithIndefiniteRetries(
opCtx,
kReadPref,
ns.dbName(),
@ -246,7 +246,7 @@ Status ConfigServerTestFixture::deleteToConfigCollection(OperationContext* opCtx
const NamespaceString& ns,
const BSONObj& doc,
const bool multi) {
auto deleteResponse = getConfigShard()->runCommand(
auto deleteResponse = getConfigShard()->runCommandWithIndefiniteRetries(
opCtx,
kReadPref,
ns.dbName(),
@ -419,7 +419,8 @@ StatusWith<std::vector<BSONObj>> ConfigServerTestFixture::getIndexes(OperationCo
const NamespaceString& ns) {
auto configShard = getConfigShard();
auto response = configShard->runCommand(opCtx,
auto response = configShard->runCommandWithIndefiniteRetries(
opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
ns.dbName(),
BSON("listIndexes" << ns.coll()),

View File

@ -113,8 +113,7 @@ protected:
findAndModifyRequest.setWriteConcern(WriteConcernOptions(
WriteConcernOptions::kMajority, WriteConcernOptions::SyncMode::UNSET, Seconds(15)));
return _shardLocal->runCommandWithFixedRetryAttempts(
_opCtx.get(),
return _shardLocal->runCommand(_opCtx.get(),
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
nss.dbName(),
findAndModifyRequest.toBSON(),
@ -134,8 +133,7 @@ protected:
* Returns the index definitions that exist for the given collection.
*/
StatusWith<std::vector<BSONObj>> getIndexes(NamespaceString nss) {
auto response = _shardLocal->runCommandWithFixedRetryAttempts(
_opCtx.get(),
auto response = _shardLocal->runCommand(_opCtx.get(),
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
nss.dbName(),
BSON("listIndexes" << nss.coll()),

View File

@ -215,8 +215,7 @@ Status ShardingLogging::_createCappedConfigCollection(OperationContext* opCtx,
<< WriteConcernOptions::kWriteConcernField << writeConcern.toBSON());
while (true) {
auto result = configShard->runCommandWithFixedRetryAttempts(
opCtx,
auto result = configShard->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kConfig,
createCmd,

View File

@ -82,10 +82,7 @@ public:
configsvrRequest.setDbName(request().getDbName());
const auto cmdResponseWithStatus =
Grid::get(opCtx)
->shardRegistry()
->getConfigShard()
->runCommandWithFixedRetryAttempts(
Grid::get(opCtx)->shardRegistry()->getConfigShard()->runCommand(
opCtx,
kPrimaryOnlyReadPreference,
DatabaseName::kAdmin,

View File

@ -71,10 +71,7 @@ public:
configsvrRequest.setDbName(request().getDbName());
const auto cmdResponseWithStatus =
Grid::get(opCtx)
->shardRegistry()
->getConfigShard()
->runCommandWithFixedRetryAttempts(
Grid::get(opCtx)->shardRegistry()->getConfigShard()->runCommand(
opCtx,
kPrimaryOnlyReadPreference,
DatabaseName::kAdmin,

View File

@ -120,7 +120,7 @@ public:
generic_argument_util::setMajorityWriteConcern(configsvrRequest, &opCtx->getWriteConcern());
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto cmdResponseStatus = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
auto cmdResponseStatus = uassertStatusOK(configShard->runCommand(
opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,

View File

@ -72,15 +72,11 @@ public:
configsvrRequest.setDbName(request().getDbName());
const auto cmdResponseWithStatus =
Grid::get(opCtx)
->shardRegistry()
->getConfigShard()
->runCommandWithFixedRetryAttempts(
Grid::get(opCtx)->shardRegistry()->getConfigShard()->runCommand(
opCtx,
kPrimaryOnlyReadPreference,
DatabaseName::kAdmin,
CommandHelpers::filterCommandRequestForPassthrough(
configsvrRequest.toBSON()),
CommandHelpers::filterCommandRequestForPassthrough(configsvrRequest.toBSON()),
Shard::RetryPolicy::kIdempotent);
const auto cmdResponse = uassertStatusOK(cmdResponseWithStatus);

View File

@ -71,10 +71,7 @@ public:
configsvrRequest.setDbName(request().getDbName());
const auto cmdResponseWithStatus =
Grid::get(opCtx)
->shardRegistry()
->getConfigShard()
->runCommandWithFixedRetryAttempts(
Grid::get(opCtx)->shardRegistry()->getConfigShard()->runCommand(
opCtx,
kPrimaryOnlyReadPreference,
DatabaseName::kAdmin,

View File

@ -70,10 +70,7 @@ public:
configsvrRequest.setDbName(request().getDbName());
const auto cmdResponseWithStatus =
Grid::get(opCtx)
->shardRegistry()
->getConfigShard()
->runCommandWithFixedRetryAttempts(
Grid::get(opCtx)->shardRegistry()->getConfigShard()->runCommand(
opCtx,
kPrimaryOnlyReadPreference,
DatabaseName::kAdmin,

View File

@ -569,7 +569,7 @@ SharedSemiFuture<ShardRegistry::Cache::ValueHandle> ShardRegistry::_reloadAsync(
Status ShardRegistry::_pingForNewTopologyTime(OperationContext* opCtx) {
return getConfigShard()
->runCommand(opCtx,
->runCommandWithIndefiniteRetries(opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryPreferred),
DatabaseName::kAdmin,
BSON("ping" << 1),

View File

@ -1400,7 +1400,7 @@ long long runCountCommandOnConfig(OperationContext* opCtx,
countBuilder.append("count", nss.coll());
countBuilder.append("query", query);
auto resultStatus = localConfigShard->runCommandWithFixedRetryAttempts(
auto resultStatus = localConfigShard->runCommand(
opCtx,
kConfigReadSelector,
nss.dbName(),
@ -1677,7 +1677,7 @@ void updateClusterCardinalityParameter(const Lock::ExclusiveLock&, OperationCont
configsvrSetClusterParameter.set_compatibleWithTopologyChange(true);
while (true) {
const auto cmdResponse = shardRegistry->getConfigShard()->runCommandWithFixedRetryAttempts(
const auto cmdResponse = shardRegistry->getConfigShard()->runCommand(
opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,

View File

@ -86,8 +86,8 @@ public:
&opCtx->getWriteConcern());
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto cmdResponse = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
opCtx,
auto cmdResponse = uassertStatusOK(
configShard->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
configsvrSetUserWriteBlockModeCmd.toBSON(),

View File

@ -41,8 +41,8 @@ HistoricalPlacement HistoricalPlacementFetcherImpl::fetch(
ConfigsvrGetHistoricalPlacement request(nss.value_or(NamespaceString::kEmpty), atClusterTime);
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto remoteResponse = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
opCtx,
auto remoteResponse = uassertStatusOK(
configShard->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
request.toBSON(),

View File

@ -83,8 +83,8 @@ public:
}
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto cmdResponse = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
opCtx,
auto cmdResponse = uassertStatusOK(
configShard->runCommand(opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
configsvrAbortReshardCollection.toBSON(),

View File

@ -73,8 +73,8 @@ public:
configsvrRequest.setDbName(request().getDbName());
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto cmdResponse = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
opCtx,
auto cmdResponse = uassertStatusOK(
configShard->runCommand(opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
configsvrRequest.toBSON(),

View File

@ -71,8 +71,8 @@ public:
configsvrCleanupReshardCollection.setDbName(request().getDbName());
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto cmdResponse = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
opCtx,
auto cmdResponse = uassertStatusOK(
configShard->runCommand(opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
configsvrCleanupReshardCollection.toBSON(),

View File

@ -141,8 +141,8 @@ public:
generic_argument_util::setMajorityWriteConcern(configCmd, &opCtx->getWriteConcern());
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto cmdResponse = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
opCtx,
auto cmdResponse = uassertStatusOK(
configShard->runCommand(opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
configCmd.toBSON(),

View File

@ -77,8 +77,8 @@ public:
configsvrRequest.setDbName(request().getDbName());
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto cmdResponse = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
opCtx,
auto cmdResponse = uassertStatusOK(
configShard->runCommand(opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
configsvrRequest.toBSON(),

View File

@ -112,8 +112,8 @@ public:
"About to run balancer control command",
"cmd"_attr = _configsvrCommandName);
auto cmdResponse = uassertStatusOK(
configShard->runCommandWithFixedRetryAttempts(opCtx,
auto cmdResponse =
uassertStatusOK(configShard->runCommand(opCtx,
kPrimaryOnlyReadPreference,
DatabaseName::kAdmin,
BSON(_configsvrCommandName << 1),

View File

@ -121,7 +121,7 @@ private:
auto cmdToSend = BSON("killOp" << 1 << "op" << opId);
shard
->runCommand(opCtx,
->runCommandWithIndefiniteRetries(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
cmdToSend,

View File

@ -230,8 +230,8 @@ public:
generic_argument_util::setMajorityWriteConcern(configsvrRequest);
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto commandResponse =
configShard->runCommand(opCtx,
auto commandResponse = configShard->runCommandWithIndefiniteRetries(
opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
configsvrRequest.toBSON(),

View File

@ -100,8 +100,9 @@ public:
configsvrRequest.setWriteConcern(opCtx->getWriteConcern());
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
const auto commandResponse = uassertStatusOK(
configShard->runCommand(opCtx,
const auto commandResponse =
uassertStatusOK(configShard->runCommandWithIndefiniteRetries(
opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
configsvrRequest.toBSON(),

View File

@ -105,7 +105,7 @@ public:
SetQuerySettingsCommandReply typedRun(OperationContext* opCtx) {
const auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
const auto cmdResponse = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
const auto cmdResponse = uassertStatusOK(configShard->runCommand(
opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
@ -168,7 +168,7 @@ public:
void typedRun(OperationContext* opCtx) {
const auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
const auto cmdResponse = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
const auto cmdResponse = uassertStatusOK(configShard->runCommand(
opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,

View File

@ -83,8 +83,8 @@ public:
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto cmdResponse = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
opCtx,
auto cmdResponse = uassertStatusOK(
configShard->runCommand(opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
// TODO SERVER-91373: Remove appendMajorityWriteConcern
@ -176,8 +176,8 @@ public:
setReadWriteConcern(opCtx, configsvrRequest, this);
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto cmdResponse = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
opCtx,
auto cmdResponse = uassertStatusOK(
configShard->runCommand(opCtx,
ReadPreferenceSetting(ReadPreference::PrimaryOnly),
DatabaseName::kAdmin,
configsvrRequest.toBSON(),

View File

@ -110,7 +110,7 @@ public:
// Forward to config shard, which will forward to all shards.
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto response = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
auto response = uassertStatusOK(configShard->runCommand(
opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
cmd.getDbName(),

View File

@ -98,8 +98,8 @@ BSONObj selectMedianKey(OperationContext* opCtx,
auto shard = uassertStatusOK(Grid::get(opCtx)->shardRegistry()->getShard(opCtx, shardId));
auto cmdResponse = uassertStatusOK(
shard->runCommandWithFixedRetryAttempts(opCtx,
auto cmdResponse =
uassertStatusOK(shard->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
cmd.obj(),

View File

@ -92,8 +92,7 @@ public:
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
// Force a reload of this node's shard list cache at the end of this command.
auto cmdResponseWithStatus =
configShard->runCommandWithFixedRetryAttempts(opCtx,
auto cmdResponseWithStatus = configShard->runCommand(opCtx,
kPrimaryOnlyReadPreference,
DatabaseName::kAdmin,
cmdToSend.toBSON(),

View File

@ -90,8 +90,8 @@ public:
// Force a reload of this node's shard list cache at the end of this command.
auto cmdResponseWithStatus = configShard->runCommandWithFixedRetryAttempts(
opCtx,
auto cmdResponseWithStatus =
configShard->runCommand(opCtx,
kPrimaryOnlyReadPreference,
DatabaseName::kAdmin,
CommandHelpers::filterCommandRequestForPassthrough(

View File

@ -75,8 +75,8 @@ public:
cmd.serialize(&cmdBuilder);
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto cmdResponseStatus = uassertStatusOK(
configShard->runCommandWithFixedRetryAttempts(opCtx,
auto cmdResponseStatus =
uassertStatusOK(configShard->runCommand(opCtx,
kPrimaryOnlyReadPreference,
DatabaseName::kAdmin,
cmdBuilder.obj(),

View File

@ -109,8 +109,8 @@ StatusWith<std::vector<CollectionQueryAnalyzerConfiguration>> executeRefreshComm
if (serverGlobalParams.clusterRole.hasExclusively(ClusterRole::RouterServer) ||
serverGlobalParams.clusterRole.has(ClusterRole::ShardServer)) {
const auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto swResponse = configShard->runCommandWithFixedRetryAttempts(
opCtx,
auto swResponse =
configShard->runCommand(opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
DatabaseName::kAdmin,
cmd.toBSON(),

View File

@ -51,8 +51,8 @@ boost::optional<RWConcernDefault> readWriteConcernDefaultsCacheLookupMongoS(
configsvrRequest.setDbName(DatabaseName::kAdmin);
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
auto cmdResponse = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
opCtx,
auto cmdResponse =
uassertStatusOK(configShard->runCommand(opCtx,
ReadPreferenceSetting(ReadPreference::Nearest),
DatabaseName::kAdmin,
configsvrRequest.toBSON(),