SERVER-77896 Enable performance-no-automatic-move clang-tidy check
This commit is contained in:
parent
a8bedea2fb
commit
ddb337d062
@ -53,6 +53,7 @@ Checks: '-*,
|
||||
performance-faster-string-find,
|
||||
performance-implicit-conversion-in-loop,
|
||||
performance-inefficient-algorithm,
|
||||
performance-no-automatic-move,
|
||||
bugprone-signed-char-misuse,
|
||||
bugprone-suspicious-string-compare,
|
||||
performance-for-range-copy,
|
||||
|
||||
@ -204,11 +204,11 @@ Status V2UserDocumentParser::checkValidUserDocument(const BSONObj& doc) const {
|
||||
return Status::OK();
|
||||
};
|
||||
|
||||
const auto sha1status = validateScram(SCRAMSHA1_CREDENTIAL_FIELD_NAME);
|
||||
auto sha1status = validateScram(SCRAMSHA1_CREDENTIAL_FIELD_NAME);
|
||||
if (!sha1status.isOK() && (sha1status.code() != ErrorCodes::NoSuchKey)) {
|
||||
return sha1status;
|
||||
}
|
||||
const auto sha256status = validateScram(SCRAMSHA256_CREDENTIAL_FIELD_NAME);
|
||||
auto sha256status = validateScram(SCRAMSHA256_CREDENTIAL_FIELD_NAME);
|
||||
if (!sha256status.isOK() && (sha256status.code() != ErrorCodes::NoSuchKey)) {
|
||||
return sha256status;
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ Status validateIsNotInDbs(const NamespaceString& ns,
|
||||
// Validates that the option is not used on admin, local or config db as well as not being used on
|
||||
// config servers.
|
||||
Status validateChangeStreamPreAndPostImagesOptionIsPermitted(const NamespaceString& ns) {
|
||||
const auto validationStatus =
|
||||
auto validationStatus =
|
||||
validateIsNotInDbs(ns,
|
||||
{DatabaseName::kAdmin, DatabaseName::kLocal, DatabaseName::kConfig},
|
||||
"changeStreamPreAndPostImages");
|
||||
|
||||
@ -367,7 +367,7 @@ Status DatabaseImpl::dropCollection(OperationContext* opCtx,
|
||||
|
||||
invariant(nss.dbName() == _name);
|
||||
|
||||
if (const auto droppable = isDroppableCollection(opCtx, nss); !droppable.isOK()) {
|
||||
if (auto droppable = isDroppableCollection(opCtx, nss); !droppable.isOK()) {
|
||||
return droppable;
|
||||
}
|
||||
|
||||
|
||||
@ -541,7 +541,7 @@ Status ValidateAdaptor::validateRecord(OperationContext* opCtx,
|
||||
long long* nNonCompliantDocuments,
|
||||
size_t* dataSize,
|
||||
ValidateResults* results) {
|
||||
const Status status =
|
||||
Status status =
|
||||
validateBSON(record.data(), record.size(), _validateState->getBSONValidateMode());
|
||||
if (!status.isOK()) {
|
||||
if (status.code() != ErrorCodes::NonConformantBSON) {
|
||||
|
||||
@ -297,7 +297,7 @@ NamespaceString CommandHelpers::parseNsCollectionRequired(const DatabaseName& db
|
||||
uassert(ErrorCodes::InvalidNamespace,
|
||||
str::stream() << "collection name has invalid type " << typeName(first.type()),
|
||||
first.canonicalType() == canonicalizeBSONType(mongo::String));
|
||||
const NamespaceString nss(
|
||||
NamespaceString nss(
|
||||
NamespaceStringUtil::parseNamespaceFromRequest(dbName, first.valueStringData()));
|
||||
uassert(ErrorCodes::InvalidNamespace,
|
||||
str::stream() << "Invalid namespace specified '" << nss.toStringForErrorMsg() << "'",
|
||||
|
||||
@ -275,7 +275,7 @@ std::unique_ptr<DbCheckRun> getRun(OperationContext* opCtx,
|
||||
std::shared_ptr<const CollectionCatalog> getConsistentCatalogAndSnapshot(OperationContext* opCtx) {
|
||||
// Loop until we get a consistent catalog and snapshot
|
||||
while (true) {
|
||||
const auto catalogBeforeSnapshot = CollectionCatalog::get(opCtx);
|
||||
auto catalogBeforeSnapshot = CollectionCatalog::get(opCtx);
|
||||
opCtx->recoveryUnit()->preallocateSnapshot();
|
||||
const auto catalogAfterSnapshot = CollectionCatalog::get(opCtx);
|
||||
if (catalogBeforeSnapshot == catalogAfterSnapshot) {
|
||||
|
||||
@ -67,7 +67,7 @@ std::shared_ptr<const CollectionCatalog> getConsistentCatalogAndSnapshot(Operati
|
||||
// Loop until we get a consistent catalog and snapshot. This is only used for the lock-free
|
||||
// implementation of dbHash which skips acquiring database and collection locks.
|
||||
while (true) {
|
||||
const auto catalogBeforeSnapshot = CollectionCatalog::get(opCtx);
|
||||
auto catalogBeforeSnapshot = CollectionCatalog::get(opCtx);
|
||||
opCtx->recoveryUnit()->preallocateSnapshot();
|
||||
const auto catalogAfterSnapshot = CollectionCatalog::get(opCtx);
|
||||
if (catalogBeforeSnapshot == catalogAfterSnapshot) {
|
||||
|
||||
@ -1294,13 +1294,13 @@ static SingleWriteResult performSingleUpdateOpWithDupKeyRetry(
|
||||
|
||||
try {
|
||||
bool containsDotsAndDollarsField = false;
|
||||
const auto ret = performSingleUpdateOp(opCtx,
|
||||
ns,
|
||||
opCollectionUUID,
|
||||
&request,
|
||||
source,
|
||||
&containsDotsAndDollarsField,
|
||||
forgoOpCounterIncrements);
|
||||
auto ret = performSingleUpdateOp(opCtx,
|
||||
ns,
|
||||
opCollectionUUID,
|
||||
&request,
|
||||
source,
|
||||
&containsDotsAndDollarsField,
|
||||
forgoOpCounterIncrements);
|
||||
|
||||
if (containsDotsAndDollarsField) {
|
||||
// If it's an upsert, increment 'inserts' metric, otherwise increment 'updates'.
|
||||
|
||||
@ -143,7 +143,7 @@ NamespaceString parseNs(const DatabaseName& dbName, const BSONObj& cmdObj) {
|
||||
<< typeName(firstElement.type()),
|
||||
firstElement.type() == BSONType::String);
|
||||
|
||||
const NamespaceString nss(
|
||||
NamespaceString nss(
|
||||
NamespaceStringUtil::parseNamespaceFromRequest(dbName, firstElement.valueStringData()));
|
||||
|
||||
uassert(ErrorCodes::InvalidNamespace,
|
||||
|
||||
@ -92,7 +92,7 @@ const char* DocumentSourceBucketAuto::getSourceName() const {
|
||||
|
||||
DocumentSource::GetNextResult DocumentSourceBucketAuto::doGetNext() {
|
||||
if (!_populated) {
|
||||
const auto populationResult = populateSorter();
|
||||
auto populationResult = populateSorter();
|
||||
if (populationResult.isPaused()) {
|
||||
return populationResult;
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ DocumentSource::GetNextResult DocumentSourceChangeStreamCheckInvalidate::doGetNe
|
||||
// then throws a 'ChangeStreamInvalidated' exception on the next call to this method.
|
||||
|
||||
if (_queuedInvalidate) {
|
||||
const auto res = DocumentSource::GetNextResult(std::move(_queuedInvalidate.value()));
|
||||
auto res = DocumentSource::GetNextResult(std::move(_queuedInvalidate.value()));
|
||||
_queuedInvalidate.reset();
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ DocumentSource::GetNextResult DocumentSourceChangeStreamEnsureResumeTokenPresent
|
||||
const auto extraInfo = ex.extraInfo<ChangeStreamStartAfterInvalidateInfo>();
|
||||
tassert(5779200, "Missing ChangeStreamStartAfterInvalidationInfo on exception", extraInfo);
|
||||
|
||||
const DocumentSource::GetNextResult nextInput =
|
||||
DocumentSource::GetNextResult nextInput =
|
||||
Document::fromBsonWithMetaData(extraInfo->getStartAfterInvalidateEvent());
|
||||
|
||||
_resumeStatus =
|
||||
|
||||
@ -93,7 +93,7 @@ boost::intrusive_ptr<DocumentSource> DocumentSourceGroup::createFromBsonWithMaxM
|
||||
|
||||
DocumentSource::GetNextResult DocumentSourceGroup::doGetNext() {
|
||||
if (!_groupsReady) {
|
||||
const auto initializationResult = performBlockingGroup();
|
||||
auto initializationResult = performBlockingGroup();
|
||||
if (initializationResult.isPaused()) {
|
||||
return initializationResult;
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ DocumentSource::GetNextResult DocumentSourceSort::doGetNext() {
|
||||
}
|
||||
|
||||
if (!_populated) {
|
||||
const auto populationResult = populate();
|
||||
auto populationResult = populate();
|
||||
if (populationResult.isPaused()) {
|
||||
return populationResult;
|
||||
}
|
||||
|
||||
@ -2770,7 +2770,7 @@ Value ExpressionFilter::serialize(SerializationOptions options) const {
|
||||
|
||||
Value ExpressionFilter::evaluate(const Document& root, Variables* variables) const {
|
||||
// We are guaranteed at parse time that this isn't using our _varId.
|
||||
const Value inputVal = _children[_kInput]->evaluate(root, variables);
|
||||
Value inputVal = _children[_kInput]->evaluate(root, variables);
|
||||
|
||||
if (inputVal.nullish())
|
||||
return Value(BSONNULL);
|
||||
@ -3049,7 +3049,7 @@ Value ExpressionMap::serialize(SerializationOptions options) const {
|
||||
|
||||
Value ExpressionMap::evaluate(const Document& root, Variables* variables) const {
|
||||
// guaranteed at parse time that this isn't using our _varId
|
||||
const Value inputVal = _children[_kInput]->evaluate(root, variables);
|
||||
Value inputVal = _children[_kInput]->evaluate(root, variables);
|
||||
if (inputVal.nullish())
|
||||
return Value(BSONNULL);
|
||||
|
||||
|
||||
@ -139,8 +139,7 @@ bool LiteParsedDocumentSourceNestedPipelines::allowedToPassthroughFromMongos() c
|
||||
Status LiteParsedDocumentSourceNestedPipelines::checkShardedForeignCollAllowed(
|
||||
NamespaceString nss, bool inMultiDocumentTransaction) const {
|
||||
for (auto&& pipeline : _pipelines) {
|
||||
if (const auto status =
|
||||
pipeline.checkShardedForeignCollAllowed(nss, inMultiDocumentTransaction);
|
||||
if (auto status = pipeline.checkShardedForeignCollAllowed(nss, inMultiDocumentTransaction);
|
||||
!status.isOK()) {
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -154,8 +154,7 @@ public:
|
||||
Status checkShardedForeignCollAllowed(NamespaceString nss,
|
||||
bool isMultiDocumentTransaction) const {
|
||||
for (auto&& spec : _stageSpecs) {
|
||||
if (const auto status =
|
||||
spec->checkShardedForeignCollAllowed(nss, isMultiDocumentTransaction);
|
||||
if (auto status = spec->checkShardedForeignCollAllowed(nss, isMultiDocumentTransaction);
|
||||
!status.isOK()) {
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ namespace mongo::optimizer {
|
||||
|
||||
template <class T>
|
||||
struct TassertNegator {
|
||||
T operator()(const T v) const {
|
||||
T operator()(T v) const {
|
||||
tassert(7453909, "No negator specified", false);
|
||||
return v;
|
||||
}
|
||||
|
||||
@ -152,7 +152,7 @@ Status CollectionBulkLoaderImpl::_insertDocumentsForUncappedCollection(
|
||||
const auto& doc = *insertIter++;
|
||||
bytesInBlock += doc.objsize();
|
||||
// This version of insert will not update any indexes.
|
||||
const auto status = collection_internal::insertDocumentForBulkLoader(
|
||||
auto status = collection_internal::insertDocumentForBulkLoader(
|
||||
_opCtx.get(), _acquisition.getCollectionPtr(), doc, onRecordInserted);
|
||||
if (!status.isOK()) {
|
||||
return status;
|
||||
@ -199,7 +199,7 @@ Status CollectionBulkLoaderImpl::_insertDocumentsForCappedCollection(
|
||||
WriteUnitOfWork wunit(_opCtx.get());
|
||||
// For capped collections, we use regular insertDocument, which
|
||||
// will update pre-existing indexes.
|
||||
const auto status = collection_internal::insertDocument(
|
||||
auto status = collection_internal::insertDocument(
|
||||
_opCtx.get(), _acquisition.getCollectionPtr(), InsertStatement(doc), nullptr);
|
||||
if (!status.isOK()) {
|
||||
return status;
|
||||
@ -384,7 +384,7 @@ Status CollectionBulkLoaderImpl::_runTaskReleaseResourcesOnFailure(const F& task
|
||||
AlternativeClientRegion acr(_client);
|
||||
ScopeGuard guard([this] { _releaseResources(); });
|
||||
try {
|
||||
const auto status = task();
|
||||
auto status = task();
|
||||
if (status.isOK()) {
|
||||
guard.dismiss();
|
||||
}
|
||||
|
||||
@ -561,7 +561,7 @@ Status OplogApplierUtils::applyOplogBatchCommon(
|
||||
|
||||
// If we didn't create a group, try to apply the op individually.
|
||||
try {
|
||||
const Status status =
|
||||
Status status =
|
||||
applyOplogEntryOrGroupedInserts(opCtx, op, oplogApplicationMode, isDataConsistent);
|
||||
|
||||
if (!status.isOK()) {
|
||||
|
||||
@ -1968,7 +1968,7 @@ Status _syncRollback(OperationContext* opCtx,
|
||||
auto res = syncRollBackLocalOperations(
|
||||
localOplog, rollbackSource.getOplog(), processOperationForFixUp);
|
||||
if (!res.isOK()) {
|
||||
const auto status = res.getStatus();
|
||||
auto status = res.getStatus();
|
||||
switch (status.code()) {
|
||||
case ErrorCodes::OplogStartMissing:
|
||||
case ErrorCodes::UnrecoverableRollbackError:
|
||||
|
||||
@ -525,7 +525,7 @@ Status StorageInterfaceImpl::dropCollection(OperationContext* opCtx, const Names
|
||||
return Status::OK();
|
||||
}
|
||||
WriteUnitOfWork wunit(opCtx);
|
||||
const auto status = autoDb.getDb()->dropCollectionEvenIfSystem(opCtx, nss);
|
||||
auto status = autoDb.getDb()->dropCollectionEvenIfSystem(opCtx, nss);
|
||||
if (!status.isOK()) {
|
||||
return status;
|
||||
}
|
||||
@ -548,7 +548,7 @@ Status StorageInterfaceImpl::truncateCollection(OperationContext* opCtx,
|
||||
}
|
||||
|
||||
WriteUnitOfWork wunit(opCtx);
|
||||
const auto status = autoColl.getWritableCollection(opCtx)->truncate(opCtx);
|
||||
auto status = autoColl.getWritableCollection(opCtx)->truncate(opCtx);
|
||||
if (!status.isOK()) {
|
||||
return status;
|
||||
}
|
||||
@ -578,7 +578,7 @@ Status StorageInterfaceImpl::renameCollection(OperationContext* opCtx,
|
||||
<< fromNS.dbName().toStringForErrorMsg() << " not found.");
|
||||
}
|
||||
WriteUnitOfWork wunit(opCtx);
|
||||
const auto status = autoDB.getDb()->renameCollection(opCtx, fromNS, toNS, stayTemp);
|
||||
auto status = autoDB.getDb()->renameCollection(opCtx, fromNS, toNS, stayTemp);
|
||||
if (!status.isOK()) {
|
||||
return status;
|
||||
}
|
||||
@ -1488,7 +1488,7 @@ boost::optional<Timestamp> StorageInterfaceImpl::getLastStableRecoveryTimestamp(
|
||||
return boost::none;
|
||||
}
|
||||
|
||||
const auto ret = serviceCtx->getStorageEngine()->getLastStableRecoveryTimestamp();
|
||||
auto ret = serviceCtx->getStorageEngine()->getLastStableRecoveryTimestamp();
|
||||
if (ret == boost::none) {
|
||||
return Timestamp::min();
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ Status CollectionBulkLoaderMock::init(const std::vector<BSONObj>& secondaryIndex
|
||||
Status CollectionBulkLoaderMock::insertDocuments(const std::vector<BSONObj>::const_iterator begin,
|
||||
const std::vector<BSONObj>::const_iterator end) {
|
||||
LOGV2_DEBUG(21758, 1, "CollectionBulkLoaderMock::insertDocuments called");
|
||||
const auto status = insertDocsFn(begin, end);
|
||||
auto status = insertDocsFn(begin, end);
|
||||
|
||||
// Only count if it succeeds.
|
||||
if (status.isOK()) {
|
||||
|
||||
@ -147,7 +147,7 @@ getDataSizeInfoForCollections(OperationContext* opCtx,
|
||||
for (auto&& response : responsesFromShards) {
|
||||
try {
|
||||
const auto& shardId = response.shardId;
|
||||
const auto errorContext =
|
||||
auto errorContext =
|
||||
"Failed to get stats for balancing from shard '{}'"_format(shardId.toString());
|
||||
const auto responseValue =
|
||||
uassertStatusOKWithContext(std::move(response.swResponse), errorContext);
|
||||
|
||||
@ -618,7 +618,7 @@ std::vector<NamespaceString> MovePrimaryCoordinator::cloneDataToRecipient(
|
||||
"movePrimary operation on database {} failed to clone data to recipient {}"_format(
|
||||
_dbName.toStringForErrorMsg(), toShardId.toString()));
|
||||
|
||||
const auto clonedCollections = [&] {
|
||||
auto clonedCollections = [&] {
|
||||
std::vector<NamespaceString> colls;
|
||||
for (const auto& bsonElem : cloneResponse.getValue().response["clonedColls"].Obj()) {
|
||||
if (bsonElem.type() == String) {
|
||||
|
||||
@ -158,12 +158,12 @@ CoordinatorCommitMonitor::queryRemainingOperationTimeForRecipients() const {
|
||||
!_cancelToken.isCanceled());
|
||||
|
||||
auto response = ars.next();
|
||||
const auto errorContext =
|
||||
auto errorContext =
|
||||
"Failed command: {} on {}"_format(cmdObj.toString(), response.shardId.toString());
|
||||
|
||||
const auto shardResponse =
|
||||
auto shardResponse =
|
||||
uassertStatusOKWithContext(std::move(response.swResponse), errorContext);
|
||||
const auto status = getStatusFromCommandResult(shardResponse.data);
|
||||
auto status = getStatusFromCommandResult(shardResponse.data);
|
||||
uassertStatusOKWithContext(status, errorContext);
|
||||
|
||||
const auto remainingTime = extractOperationRemainingTime(shardResponse.data);
|
||||
|
||||
@ -91,17 +91,16 @@ std::vector<AsyncRequestsSender::Response> processShardResponses(
|
||||
auto response = ars.next();
|
||||
|
||||
if (throwOnError) {
|
||||
const auto errorContext =
|
||||
"Failed command {} for database '{}' on shard '{}'"_format(
|
||||
command.toString(), dbName, StringData{response.shardId});
|
||||
auto errorContext = "Failed command {} for database '{}' on shard '{}'"_format(
|
||||
command.toString(), dbName, StringData{response.shardId});
|
||||
|
||||
uassertStatusOKWithContext(response.swResponse.getStatus(), errorContext);
|
||||
const auto& respBody = response.swResponse.getValue().data;
|
||||
|
||||
const auto status = getStatusFromCommandResult(respBody);
|
||||
auto status = getStatusFromCommandResult(respBody);
|
||||
uassertStatusOKWithContext(status, errorContext);
|
||||
|
||||
const auto wcStatus = getWriteConcernStatusFromCommandResult(respBody);
|
||||
auto wcStatus = getWriteConcernStatusFromCommandResult(respBody);
|
||||
uassertStatusOKWithContext(wcStatus, errorContext);
|
||||
}
|
||||
|
||||
|
||||
@ -116,7 +116,7 @@ public:
|
||||
repl::ReplicationCoordinator::get(opCtx)->getMemberState().primary());
|
||||
}
|
||||
|
||||
const auto response = [&] {
|
||||
auto response = [&] {
|
||||
const auto nss = ns();
|
||||
switch (metadata_consistency_util::getCommandLevel(nss)) {
|
||||
case MetadataConsistencyCommandLevelEnum::kClusterLevel:
|
||||
|
||||
@ -421,7 +421,7 @@ TEST_F(AsyncWorkSchedulerTest, ScheduledRemoteCommandRespondsOK) {
|
||||
kShardIds[1], ReadPreferenceSetting{ReadPreference::PrimaryOnly}, BSON("TestCommand" << 1));
|
||||
ASSERT(!future.isReady());
|
||||
|
||||
const auto objResponse = BSON("ok" << 1 << "responseData" << 2);
|
||||
auto objResponse = BSON("ok" << 1 << "responseData" << 2);
|
||||
onCommand([&](const executor::RemoteCommandRequest& request) {
|
||||
ASSERT_BSONOBJ_EQ(BSON("TestCommand" << 1), request.cmdObj);
|
||||
return objResponse;
|
||||
@ -439,7 +439,7 @@ TEST_F(AsyncWorkSchedulerTest, ScheduledRemoteCommandRespondsNotOK) {
|
||||
kShardIds[1], ReadPreferenceSetting{ReadPreference::PrimaryOnly}, BSON("TestCommand" << 2));
|
||||
ASSERT(!future.isReady());
|
||||
|
||||
const auto objResponse = BSON("ok" << 0 << "responseData" << 3);
|
||||
auto objResponse = BSON("ok" << 0 << "responseData" << 3);
|
||||
onCommand([&](const executor::RemoteCommandRequest& request) {
|
||||
ASSERT_BSONOBJ_EQ(BSON("TestCommand" << 2), request.cmdObj);
|
||||
return objResponse;
|
||||
|
||||
@ -460,7 +460,7 @@ Status storeServerOptions(const moe::Environment& params) {
|
||||
}
|
||||
|
||||
if (params.count("net.compression.compressors")) {
|
||||
const auto ret =
|
||||
auto ret =
|
||||
storeMessageCompressionOptions(params["net.compression.compressors"].as<string>());
|
||||
if (!ret.isOK()) {
|
||||
return ret;
|
||||
|
||||
@ -319,7 +319,7 @@ public:
|
||||
Status validateValue(const element_type& newValue,
|
||||
const boost::optional<TenantId>& tenantId) const {
|
||||
for (const auto& validator : _validators) {
|
||||
const auto status = validator(newValue, tenantId);
|
||||
auto status = validator(newValue, tenantId);
|
||||
if (!status.isOK()) {
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ boost::optional<InternalSessionPool::Session> InternalSessionPool::_acquireSessi
|
||||
}
|
||||
|
||||
InternalSessionPool::Session InternalSessionPool::acquireSystemSession() {
|
||||
const InternalSessionPool::Session session = [&] {
|
||||
InternalSessionPool::Session session = [&] {
|
||||
stdx::lock_guard<Latch> lock(_mutex);
|
||||
|
||||
const auto& systemSession = makeSystemLogicalSessionId();
|
||||
@ -116,7 +116,7 @@ InternalSessionPool::Session InternalSessionPool::acquireSystemSession() {
|
||||
|
||||
InternalSessionPool::Session InternalSessionPool::acquireStandaloneSession(
|
||||
OperationContext* opCtx) {
|
||||
const InternalSessionPool::Session session = [&] {
|
||||
InternalSessionPool::Session session = [&] {
|
||||
stdx::lock_guard<Latch> lock(_mutex);
|
||||
|
||||
const auto& userDigest = getLogicalSessionUserDigestForLoggedInUser(opCtx);
|
||||
@ -136,7 +136,7 @@ InternalSessionPool::Session InternalSessionPool::acquireStandaloneSession(
|
||||
|
||||
InternalSessionPool::Session InternalSessionPool::acquireChildSession(
|
||||
OperationContext* opCtx, const LogicalSessionId& parentLsid) {
|
||||
const InternalSessionPool::Session session = [&] {
|
||||
InternalSessionPool::Session session = [&] {
|
||||
stdx::lock_guard<Latch> lock(_mutex);
|
||||
|
||||
auto it = _childSessions.find(parentLsid);
|
||||
|
||||
@ -490,8 +490,7 @@ TEST_F(AsyncRPCTestFixture, WriteConcernError) {
|
||||
|
||||
const BSONObj writeConcernError = BSON("code" << ErrorCodes::WriteConcernFailed << "errmsg"
|
||||
<< "mock");
|
||||
const BSONObj resWithWriteConcernError =
|
||||
BSON("ok" << 1 << "writeConcernError" << writeConcernError);
|
||||
BSONObj resWithWriteConcernError = BSON("ok" << 1 << "writeConcernError" << writeConcernError);
|
||||
|
||||
auto opCtxHolder = makeOperationContext();
|
||||
auto options = std::make_shared<AsyncRPCOptions<HelloCommand>>(
|
||||
@ -533,7 +532,7 @@ TEST_F(AsyncRPCTestFixture, WriteError) {
|
||||
const BSONObj writeError = BSON("code" << ErrorCodes::DocumentValidationFailure << "errInfo"
|
||||
<< writeErrorExtraInfo << "errmsg"
|
||||
<< "Document failed validation");
|
||||
const BSONObj resWithWriteError = BSON("ok" << 1 << "writeErrors" << BSON_ARRAY(writeError));
|
||||
BSONObj resWithWriteError = BSON("ok" << 1 << "writeErrors" << BSON_ARRAY(writeError));
|
||||
auto opCtxHolder = makeOperationContext();
|
||||
auto options = std::make_shared<AsyncRPCOptions<HelloCommand>>(
|
||||
helloCmd, getExecutorPtr(), _cancellationToken);
|
||||
|
||||
@ -303,8 +303,8 @@ TEST_F(AsyncRPCShardingTestFixture, ShardIdOverload) {
|
||||
NamespaceString::createNamespaceString_forTest("testdb", "testcoll");
|
||||
const BSONObj testFirstBatch = BSON("x" << 1);
|
||||
const FindCommandRequest findCmd = FindCommandRequest(testNS);
|
||||
const BSONObj findReply = CursorResponse(testNS, 0LL, {testFirstBatch})
|
||||
.toBSON(CursorResponse::ResponseType::InitialResponse);
|
||||
BSONObj findReply = CursorResponse(testNS, 0LL, {testFirstBatch})
|
||||
.toBSON(CursorResponse::ResponseType::InitialResponse);
|
||||
|
||||
auto options = std::make_shared<AsyncRPCOptions<FindCommandRequest>>(
|
||||
findCmd, executor(), CancellationToken::uncancelable());
|
||||
|
||||
@ -392,7 +392,7 @@ TEST_F(ShardingCatalogClientTest, GetChunksForNSWithSortAndLimit) {
|
||||
auto future = launchAsync([this, &chunksQuery, newOpTime, &collEpoch, &collTimestamp] {
|
||||
OpTime opTime;
|
||||
|
||||
const auto chunks =
|
||||
auto chunks =
|
||||
assertGet(catalogClient()->getChunks(operationContext(),
|
||||
chunksQuery,
|
||||
BSON(ChunkType::lastmod() << -1),
|
||||
@ -460,7 +460,7 @@ TEST_F(ShardingCatalogClientTest, GetChunksForUUIDNoSortNoLimit) {
|
||||
<< BSON("$gte" << static_cast<long long>(queryChunkVersion.toLong()))));
|
||||
|
||||
auto future = launchAsync([this, &chunksQuery, &collEpoch, &collTimestamp] {
|
||||
const auto chunks =
|
||||
auto chunks =
|
||||
assertGet(catalogClient()->getChunks(operationContext(),
|
||||
chunksQuery,
|
||||
BSONObj(),
|
||||
|
||||
@ -134,7 +134,7 @@ protected:
|
||||
}
|
||||
|
||||
CollectionType loadCollection(const ShardVersion& version) {
|
||||
const auto coll = makeCollectionType(version);
|
||||
auto coll = makeCollectionType(version);
|
||||
const auto scopedCollProv = scopedCollectionProvider(coll);
|
||||
const auto scopedChunksProv = scopedChunksProvider(makeChunks(version.placementVersion()));
|
||||
auto future = launchAsync([&] {
|
||||
|
||||
@ -45,8 +45,7 @@ public:
|
||||
|
||||
ConnectionString getConnString() const override {
|
||||
const HostAndPort configHost{"configHost1"};
|
||||
const ConnectionString configCS{
|
||||
ConnectionString::forReplicaSet("configReplSet", {configHost})};
|
||||
ConnectionString configCS{ConnectionString::forReplicaSet("configReplSet", {configHost})};
|
||||
return configCS;
|
||||
}
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ public:
|
||||
|
||||
const auto& catalogCache = Grid::get(opCtx)->catalogCache();
|
||||
const auto cri = uassertStatusOK(catalogCache->getCollectionRoutingInfo(opCtx, nss));
|
||||
const auto primaryShardId = cri.cm.dbPrimary();
|
||||
auto primaryShardId = cri.cm.dbPrimary();
|
||||
|
||||
std::set<ShardId> candidateShardIds;
|
||||
if (cri.cm.isSharded()) {
|
||||
|
||||
@ -67,7 +67,7 @@ protected:
|
||||
"values",
|
||||
profilingLevel == -1 || profilingLevel == 0);
|
||||
|
||||
const auto oldSettings = CollectionCatalog::get(opCtx)->getDatabaseProfileSettings(dbName);
|
||||
auto oldSettings = CollectionCatalog::get(opCtx)->getDatabaseProfileSettings(dbName);
|
||||
|
||||
if (auto filterOrUnset = request.getFilter()) {
|
||||
auto newSettings = oldSettings;
|
||||
|
||||
@ -106,7 +106,7 @@ bool MultiStatementTransactionRequestsSender::done() {
|
||||
}
|
||||
|
||||
AsyncRequestsSender::Response MultiStatementTransactionRequestsSender::next() {
|
||||
const auto response = _ars->next();
|
||||
auto response = _ars->next();
|
||||
processReplyMetadata(_opCtx, response);
|
||||
return response;
|
||||
}
|
||||
|
||||
@ -502,7 +502,7 @@ Status AsyncResultsMerger::_scheduleGetMores(WithLock lk) {
|
||||
|
||||
// Reveal opCtx errors (such as MaxTimeMSExpired) and reflect them in the remote status.
|
||||
invariant(_opCtx, "Cannot schedule a getMore without an OperationContext");
|
||||
const auto interruptStatus = _opCtx->checkForInterruptNoAssert();
|
||||
auto interruptStatus = _opCtx->checkForInterruptNoAssert();
|
||||
if (!interruptStatus.isOK()) {
|
||||
for (size_t i = 0; i < _remotes.size(); ++i) {
|
||||
if (!_remotes[i].exhausted()) {
|
||||
|
||||
@ -104,7 +104,7 @@ AsyncRequestsSender::Response establishMergingShardCursor(OperationContext* opCt
|
||||
{{mergingShardId, mergeCmdObj}},
|
||||
ReadPreferenceSetting::get(opCtx),
|
||||
sharded_agg_helpers::getDesiredRetryPolicy(opCtx));
|
||||
const auto response = ars.next();
|
||||
auto response = ars.next();
|
||||
tassert(6273807,
|
||||
"requested and received data from just one shard, but results are still pending",
|
||||
ars.done());
|
||||
|
||||
@ -295,8 +295,7 @@ Status storeMongoShellOptions(const moe::Environment& params,
|
||||
}
|
||||
|
||||
if (!shellGlobalParams.networkMessageCompressors.empty()) {
|
||||
const auto ret =
|
||||
storeMessageCompressionOptions(shellGlobalParams.networkMessageCompressors);
|
||||
auto ret = storeMessageCompressionOptions(shellGlobalParams.networkMessageCompressors);
|
||||
if (!ret.isOK()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ TEST(DNSNameTest, Resolution) {
|
||||
const ::mongo::dns::HostName subdomain(test.subdomain);
|
||||
const ::mongo::dns::HostName resolved = [&] {
|
||||
try {
|
||||
const ::mongo::dns::HostName rv = subdomain.resolvedIn(domain);
|
||||
::mongo::dns::HostName rv = subdomain.resolvedIn(domain);
|
||||
return rv;
|
||||
} catch (const ExceptionFor<ErrorCodes::DNSRecordTypeMismatch>&) {
|
||||
ASSERT(test.fails);
|
||||
|
||||
@ -2590,7 +2590,7 @@ Status SSLManagerOpenSSL::initSSLContext(SSL_CTX* context,
|
||||
if (direction == ConnectionDirection::kIncoming && !params.sslClusterCAFile.empty()) {
|
||||
cafile = params.sslClusterCAFile;
|
||||
}
|
||||
const auto status = cafile.empty() ? _setupSystemCA(context) : _setupCA(context, cafile);
|
||||
auto status = cafile.empty() ? _setupSystemCA(context) : _setupCA(context, cafile);
|
||||
if (!status.isOK()) {
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -736,7 +736,7 @@ Status YAMLNodeToValue(const YAML::Node& YAMLNode,
|
||||
auto swExpansion = runYAMLExpansion(
|
||||
elementVal, str::stream() << key << "." << elementKey, configExpand);
|
||||
if (swExpansion.isOK()) {
|
||||
const auto status = addPair(elementKey, swExpansion.getValue());
|
||||
auto status = addPair(elementKey, swExpansion.getValue());
|
||||
if (!status.isOK()) {
|
||||
return status;
|
||||
}
|
||||
@ -746,7 +746,7 @@ Status YAMLNodeToValue(const YAML::Node& YAMLNode,
|
||||
} // else not an expansion block.
|
||||
}
|
||||
|
||||
const auto status = addPair(std::move(elementKey), elementVal);
|
||||
auto status = addPair(std::move(elementKey), elementVal);
|
||||
if (!status.isOK()) {
|
||||
return status;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user