diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 0ed299e4c4d..ac1e2367f29 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -249,7 +249,7 @@ "moduleExtensions": { "//bazel:bzlmod.bzl%bazel_features_deps": { "general": { - "bzlTransitiveDigest": "G/WD+JnQT596GnXuqRV363uynmjbkk1qeefCHRtgT3Y=", + "bzlTransitiveDigest": "dfSpTD7th7o+ah0Usp81y/clMRt3Eyfz/Ey59BcBl68=", "usagesDigest": "c91kQ0HotoA1cfwWU4KaqCoQU7lT6pGi6XPGIiMGkb0=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, @@ -356,7 +356,7 @@ }, "//bazel:bzlmod.bzl%setup_mongo_python_toolchains": { "general": { - "bzlTransitiveDigest": "G/WD+JnQT596GnXuqRV363uynmjbkk1qeefCHRtgT3Y=", + "bzlTransitiveDigest": "dfSpTD7th7o+ah0Usp81y/clMRt3Eyfz/Ey59BcBl68=", "usagesDigest": "bUxjq9n+hj2YwYT/lcSP4lHyQ2GVy5JpFgSmddUqUZg=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, diff --git a/src/mongo/base/string_data_test.cpp b/src/mongo/base/string_data_test.cpp index ccf6780ea71..6b590c892b4 100644 --- a/src/mongo/base/string_data_test.cpp +++ b/src/mongo/base/string_data_test.cpp @@ -426,12 +426,29 @@ TEST(Ostream, StringDataMatchesStdString) { std::function manip; }; const TestCase testCases[] = { - {__LINE__, [](std::ostream& os) {}}, - {__LINE__, [](std::ostream& os) { os << std::setw(5); }}, - {__LINE__, [](std::ostream& os) { os << std::left << std::setw(5); }}, - {__LINE__, [](std::ostream& os) { os << std::right << std::setw(5); }}, - {__LINE__, [](std::ostream& os) { os << std::setfill('.') << std::left << std::setw(5); }}, - {__LINE__, [](std::ostream& os) { os << std::setfill('.') << std::right << std::setw(5); }}, + {__LINE__, + [](std::ostream& os) { + }}, + {__LINE__, + [](std::ostream& os) { + os << std::setw(5); + }}, + {__LINE__, + [](std::ostream& os) { + os << std::left << std::setw(5); + }}, + {__LINE__, + [](std::ostream& os) { + os << std::right << std::setw(5); + }}, + {__LINE__, + [](std::ostream& os) { + os << std::setfill('.') << std::left << std::setw(5); + }}, + {__LINE__, + [](std::ostream& os) { + os << std::setfill('.') << std::right << std::setw(5); + }}, }; for (const auto& testCase : testCases) { const std::string location = std::string(" at line:") + std::to_string(testCase.line); @@ -440,8 +457,12 @@ TEST(Ostream, StringDataMatchesStdString) { std::function putter; std::ostringstream os; }; - Experiment expected{[&](std::ostream& os) { os << s; }}; - Experiment actual{[&](std::ostream& os) { os << StringData(s); }}; + Experiment expected{[&](std::ostream& os) { + os << s; + }}; + Experiment actual{[&](std::ostream& os) { + os << StringData(s); + }}; for (auto& x : {&expected, &actual}) { x->os << ">>"; testCase.manip(x->os); diff --git a/src/mongo/bson/column/bsoncolumn.cpp b/src/mongo/bson/column/bsoncolumn.cpp index e4fbd313663..8e2071bc0fb 100644 --- a/src/mongo/bson/column/bsoncolumn.cpp +++ b/src/mongo/bson/column/bsoncolumn.cpp @@ -260,7 +260,9 @@ BSONColumn::Iterator& BSONColumn::Iterator::operator++() { ++_index; visit(OverloadedVisitor{[&](Regular& regular) { _incrementRegular(regular); }, - [&](Interleaved& interleaved) { _incrementInterleaved(interleaved); }}, + [&](Interleaved& interleaved) { + _incrementInterleaved(interleaved); + }}, _mode); return *this; diff --git a/src/mongo/bson/column/bsoncolumnbuilder.cpp b/src/mongo/bson/column/bsoncolumnbuilder.cpp index 7ea91655b43..d9675d67975 100644 --- a/src/mongo/bson/column/bsoncolumnbuilder.cpp +++ b/src/mongo/bson/column/bsoncolumnbuilder.cpp @@ -1196,11 +1196,12 @@ typename BSONColumnBuilder::BinaryDiff BSONColumnBuilder:: // Save some state related to last control byte so we can see how it changes after finalize() is // called. ptrdiff_t controlOffset = - visit(OverloadedVisitor{ - [](const typename InternalState::Regular& regular) { - return regular._controlByteOffset; - }, - [](const typename InternalState::Interleaved&) { return kNoSimple8bControl; }}, + visit(OverloadedVisitor{[](const typename InternalState::Regular& regular) { + return regular._controlByteOffset; + }, + [](const typename InternalState::Interleaved&) { + return kNoSimple8bControl; + }}, _is.state); uint8_t lastControlByte = controlOffset != kNoSimple8bControl ? *(_bufBuilder.buf() + controlOffset) : 0; @@ -1347,7 +1348,9 @@ BSONElement BSONColumnBuilder::last() const { *regular._prev.data() == stdx::to_underlying(BSONType::eoo) ? 0 : 1, BSONElement::TrustedInitTag{}}; }, - [](const typename InternalState::Interleaved&) { return BSONElement{}; }}, + [](const typename InternalState::Interleaved&) { + return BSONElement{}; + }}, _is.state); } diff --git a/src/mongo/bson/column/simple8b_builder.h b/src/mongo/bson/column/simple8b_builder.h index d7688bb242e..8261d324505 100644 --- a/src/mongo/bson/column/simple8b_builder.h +++ b/src/mongo/bson/column/simple8b_builder.h @@ -427,7 +427,7 @@ Simple8bBuilder::PendingValue::PendingValue( boost::optional val, std::array bitCount, std::array trailingZerosCount) - : val(val), bitCount(bitCount), trailingZerosCount(trailingZerosCount) {}; + : val(val), bitCount(bitCount), trailingZerosCount(trailingZerosCount){}; template Simple8bBuilder::PendingIterator::PendingIterator( diff --git a/src/mongo/client/retry_strategy.h b/src/mongo/client/retry_strategy.h index 161627c9936..677be508c06 100644 --- a/src/mongo/client/retry_strategy.h +++ b/src/mongo/client/retry_strategy.h @@ -549,8 +549,8 @@ public: RetryBudget& budget, RetryCriteria retryCriteria = defaultRetryCriteria, RetryParameters parameters = DefaultRetryStrategy::getRetryParametersFromServerParameters()) - : _underlyingStrategy{ - std::make_unique(std::move(retryCriteria), parameters)}, + : _underlyingStrategy{std::make_unique(std::move(retryCriteria), + parameters)}, _budget{&budget} {} /** diff --git a/src/mongo/db/admission/ingress_admission_controller.cpp b/src/mongo/db/admission/ingress_admission_controller.cpp index ea629c81df1..af9e303035a 100644 --- a/src/mongo/db/admission/ingress_admission_controller.cpp +++ b/src/mongo/db/admission/ingress_admission_controller.cpp @@ -43,8 +43,9 @@ const auto getIngressAdmissionController = ServiceContext::declareDecoration(); const ConstructorActionRegistererType onServiceContextCreate{ - "InitIngressAdmissionController", - [](ServiceContext* ctx) { getIngressAdmissionController(ctx).init(); }}; + "InitIngressAdmissionController", [](ServiceContext* ctx) { + getIngressAdmissionController(ctx).init(); + }}; } // namespace void IngressAdmissionController::init() { diff --git a/src/mongo/db/admission/ingress_request_rate_limiter.cpp b/src/mongo/db/admission/ingress_request_rate_limiter.cpp index 61d28759776..d7172127c44 100644 --- a/src/mongo/db/admission/ingress_request_rate_limiter.cpp +++ b/src/mongo/db/admission/ingress_request_rate_limiter.cpp @@ -56,8 +56,9 @@ const auto getIngressRequestRateLimiter = ServiceContext::declareDecoration>(); const ConstructorActionRegistererType onServiceContextCreate{ - "InitIngressRequestRateLimiter", - [](ServiceContext* ctx) { getIngressRequestRateLimiter(ctx).emplace(); }}; + "InitIngressRequestRateLimiter", [](ServiceContext* ctx) { + getIngressRequestRateLimiter(ctx).emplace(); + }}; class ClientAdmissionControlState { public: diff --git a/src/mongo/db/audit.cpp b/src/mongo/db/audit.cpp index 356b7fa268b..328acf0f756 100644 --- a/src/mongo/db/audit.cpp +++ b/src/mongo/db/audit.cpp @@ -49,8 +49,9 @@ void rotateAuditLog() {} namespace { const auto getAuditInterface = ServiceContext::declareDecoration>(); ServiceContext::ConstructorActionRegisterer registerCreateNoopAudit{ - "initializeNoopAuditInterface", - [](ServiceContext* svcCtx) { AuditInterface::set(svcCtx, std::make_unique()); }}; + "initializeNoopAuditInterface", [](ServiceContext* svcCtx) { + AuditInterface::set(svcCtx, std::make_unique()); + }}; } // namespace AuditInterface* AuditInterface::get(ServiceContext* service) { diff --git a/src/mongo/db/commands/dbcheck_command.cpp b/src/mongo/db/commands/dbcheck_command.cpp index d92dcc4ac22..cb02780fbe7 100644 --- a/src/mongo/db/commands/dbcheck_command.cpp +++ b/src/mongo/db/commands/dbcheck_command.cpp @@ -433,8 +433,9 @@ std::unique_ptr singleCollectionRun(OperationContext* opCtx, maxBatchTimeMillis, _getBatchWriteConcern(opCtx, invocation.getBatchWriteConcern()), secondaryIndexCheckParameters, - {opCtx->fastClockSource().now().toMillisSinceEpoch(), - [&]() { return gMaxDbCheckMBperSec.load(); }}}; + {opCtx->fastClockSource().now().toMillisSinceEpoch(), [&]() { + return gMaxDbCheckMBperSec.load(); + }}}; auto result = std::make_unique(); result->push_back(info); return result; @@ -471,8 +472,9 @@ std::unique_ptr fullDatabaseRun(OperationContext* opCtx, maxBatchTimeMillis, _getBatchWriteConcern(opCtx, invocation.getBatchWriteConcern()), boost::none, - {opCtx->fastClockSource().now().toMillisSinceEpoch(), - [&]() { return gMaxDbCheckMBperSec.load(); }}}; + {opCtx->fastClockSource().now().toMillisSinceEpoch(), [&]() { + return gMaxDbCheckMBperSec.load(); + }}}; result->push_back(info); return true; }; diff --git a/src/mongo/db/exec/sbe/makeobj_spec.h b/src/mongo/db/exec/sbe/makeobj_spec.h index 3dc01a3f572..95d00bc8a84 100644 --- a/src/mongo/db/exec/sbe/makeobj_spec.h +++ b/src/mongo/db/exec/sbe/makeobj_spec.h @@ -121,7 +121,9 @@ struct MakeObjSpec { [](SetArg) { return Type::kSetArg; }, [](AddArg) { return Type::kAddArg; }, [](LambdaArg) { return Type::kLambdaArg; }, - [](const MakeObj&) { return Type::kMakeObj; }}, + [](const MakeObj&) { + return Type::kMakeObj; + }}, _data); } diff --git a/src/mongo/db/exec/sbe/stages/ix_scan.cpp b/src/mongo/db/exec/sbe/stages/ix_scan.cpp index a8c269b6cac..23a6d38e9b2 100644 --- a/src/mongo/db/exec/sbe/stages/ix_scan.cpp +++ b/src/mongo/db/exec/sbe/stages/ix_scan.cpp @@ -467,7 +467,7 @@ IndexScanStageBaseImpl::IndexScanStageBaseImpl( vars, yieldPolicy, nodeId, - participateInTrialRunTracking) {}; + participateInTrialRunTracking){}; SimpleIndexScanStage::SimpleIndexScanStage(UUID collUuid, DatabaseName dbName, diff --git a/src/mongo/db/exec/sbe/stages/scan.cpp b/src/mongo/db/exec/sbe/stages/scan.cpp index ae5f2d35aa8..a7c3fb30f9d 100644 --- a/src/mongo/db/exec/sbe/stages/scan.cpp +++ b/src/mongo/db/exec/sbe/stages/scan.cpp @@ -455,7 +455,7 @@ ScanStageBaseImpl::ScanStageBaseImpl(UUID collUuid, scanOpenCallback, forward, // Optional arguments: - participateInTrialRunTracking) {}; + participateInTrialRunTracking){}; template @@ -463,7 +463,7 @@ ScanStageBaseImpl::ScanStageBaseImpl(std::shared_ptr std::unique_ptr { return nullptr; }}; + []() -> std::unique_ptr { + return nullptr; + }}; } class VersionedExtensionGreaterComparatorTest : public unittest::Test { diff --git a/src/mongo/db/ftdc/ftdc_server.cpp b/src/mongo/db/ftdc/ftdc_server.cpp index bd5818ff611..13847d60991 100644 --- a/src/mongo/db/ftdc/ftdc_server.cpp +++ b/src/mongo/db/ftdc/ftdc_server.cpp @@ -114,7 +114,7 @@ boost::filesystem::path getFTDCDirectoryPathParameter() { } Status onUpdateFTDCEnabled(const bool value) { - if (FTDCController* controller; + if (FTDCController * controller; hasGlobalServiceContext() && (controller = getFTDCController(getGlobalServiceContext()))) { return controller->setEnabled(value); } @@ -123,7 +123,7 @@ Status onUpdateFTDCEnabled(const bool value) { } Status onUpdateFTDCMetadataCaptureFrequency(const std::int32_t potentialNewValue) { - if (FTDCController* controller; + if (FTDCController * controller; hasGlobalServiceContext() && (controller = getFTDCController(getGlobalServiceContext()))) { controller->setMetadataCaptureFrequency(potentialNewValue); } @@ -132,7 +132,7 @@ Status onUpdateFTDCMetadataCaptureFrequency(const std::int32_t potentialNewValue } Status onUpdateFTDCPeriod(const std::int32_t potentialNewValue) { - if (FTDCController* controller; + if (FTDCController * controller; hasGlobalServiceContext() && (controller = getFTDCController(getGlobalServiceContext()))) { controller->setPeriod(Milliseconds(potentialNewValue)); FTDCCollectionMetrics::get(getGlobalServiceContext()) @@ -152,7 +152,7 @@ Status onUpdateFTDCDirectorySize(const std::int32_t potentialNewValue) { << "' which is the current value of diagnosticDataCollectionFileSizeMB."); } - if (FTDCController* controller; + if (FTDCController * controller; hasGlobalServiceContext() && (controller = getFTDCController(getGlobalServiceContext()))) { controller->setMaxDirectorySizeBytes(potentialNewValue * 1024 * 1024); } @@ -170,7 +170,7 @@ Status onUpdateFTDCFileSize(const std::int32_t potentialNewValue) { << "' which is the current value of diagnosticDataCollectionDirectorySizeMB."); } - if (FTDCController* controller; + if (FTDCController * controller; hasGlobalServiceContext() && (controller = getFTDCController(getGlobalServiceContext()))) { controller->setMaxFileSizeBytes(potentialNewValue * 1024 * 1024); } @@ -179,7 +179,7 @@ Status onUpdateFTDCFileSize(const std::int32_t potentialNewValue) { } Status onUpdateFTDCSamplesPerChunk(const std::int32_t potentialNewValue) { - if (FTDCController* controller; + if (FTDCController * controller; hasGlobalServiceContext() && (controller = getFTDCController(getGlobalServiceContext()))) { controller->setMaxSamplesPerArchiveMetricChunk(potentialNewValue); } @@ -188,7 +188,7 @@ Status onUpdateFTDCSamplesPerChunk(const std::int32_t potentialNewValue) { } Status onUpdateFTDCPerInterimUpdate(const std::int32_t potentialNewValue) { - if (FTDCController* controller; + if (FTDCController * controller; hasGlobalServiceContext() && (controller = getFTDCController(getGlobalServiceContext()))) { controller->setMaxSamplesPerInterimMetricChunk(potentialNewValue); } @@ -197,7 +197,7 @@ Status onUpdateFTDCPerInterimUpdate(const std::int32_t potentialNewValue) { } Status onUpdateFTDCSampleTimeout(std::int32_t potentialNewValue) { - if (FTDCController* controller; + if (FTDCController * controller; hasGlobalServiceContext() && (controller = getFTDCController(getGlobalServiceContext()))) { return controller->setSampleTimeout(Milliseconds(potentialNewValue)); } @@ -206,7 +206,7 @@ Status onUpdateFTDCSampleTimeout(std::int32_t potentialNewValue) { } Status onUpdateFTDCMinThreads(std::int32_t potentialNewValue) { - if (FTDCController* controller; + if (FTDCController * controller; hasGlobalServiceContext() && (controller = getFTDCController(getGlobalServiceContext()))) { return controller->setMinThreads(potentialNewValue); } @@ -215,7 +215,7 @@ Status onUpdateFTDCMinThreads(std::int32_t potentialNewValue) { } Status onUpdateFTDCMaxThreads(std::int32_t potentialNewValue) { - if (FTDCController* controller; + if (FTDCController * controller; hasGlobalServiceContext() && (controller = getFTDCController(getGlobalServiceContext()))) { return controller->setMaxThreads(potentialNewValue); } @@ -471,7 +471,7 @@ void startFTDC(ServiceContext* serviceContext, } void stopFTDC() { - if (FTDCController* controller; + if (FTDCController * controller; hasGlobalServiceContext() && (controller = getFTDCController(getGlobalServiceContext()))) { controller->stop(); } diff --git a/src/mongo/db/global_catalog/ddl/sharding_coordinator_service.h b/src/mongo/db/global_catalog/ddl/sharding_coordinator_service.h index 83a8703ade8..6901e335aa2 100644 --- a/src/mongo/db/global_catalog/ddl/sharding_coordinator_service.h +++ b/src/mongo/db/global_catalog/ddl/sharding_coordinator_service.h @@ -127,7 +127,9 @@ public: */ void waitForOngoingCoordinatorsToFinish(OperationContext* opCtx, std::function pred = { - [](const ShardingCoordinator&) { return true; }}); + [](const ShardingCoordinator&) { + return true; + }}); void waitForRecovery(OperationContext* opCtx) const override; diff --git a/src/mongo/db/global_catalog/type_changelog_test.cpp b/src/mongo/db/global_catalog/type_changelog_test.cpp index 16169238eac..939c6769090 100644 --- a/src/mongo/db/global_catalog/type_changelog_test.cpp +++ b/src/mongo/db/global_catalog/type_changelog_test.cpp @@ -84,10 +84,14 @@ private: }}}, {"server", {BSON(ChangeLogType::server() << _kServer), - [&](const ChangeLogType& changelog) { ASSERT_EQUALS(changelog.getServer(), _kServer); }}}, + [&](const ChangeLogType& changelog) { + ASSERT_EQUALS(changelog.getServer(), _kServer); + }}}, {"shard", {BSON(ChangeLogType::shard() << _kShard), - [&](const ChangeLogType& changelog) { ASSERT_EQUALS(changelog.getShard(), _kShard); }}}, + [&](const ChangeLogType& changelog) { + ASSERT_EQUALS(changelog.getShard(), _kShard); + }}}, {"clientAddr", {BSON(ChangeLogType::clientAddr() << _kClientAddr), [&](const ChangeLogType& changelog) { @@ -95,10 +99,14 @@ private: }}}, {"time", {BSON(ChangeLogType::time() << _kTime), - [&](const ChangeLogType& changelog) { ASSERT_EQUALS(changelog.getTime(), _kTime); }}}, + [&](const ChangeLogType& changelog) { + ASSERT_EQUALS(changelog.getTime(), _kTime); + }}}, {"what", {BSON(ChangeLogType::what() << _kWhat), - [&](const ChangeLogType& changelog) { ASSERT_EQUALS(changelog.getWhat(), _kWhat); }}}, + [&](const ChangeLogType& changelog) { + ASSERT_EQUALS(changelog.getWhat(), _kWhat); + }}}, {"versionContext", {BSON(ChangeLogType::versionContext() << _kVersionContext.toBSON()), [&](const ChangeLogType& changelog) { diff --git a/src/mongo/db/index/index_access_method_test.cpp b/src/mongo/db/index/index_access_method_test.cpp index 86a2be1a09b..e43791437eb 100644 --- a/src/mongo/db/index/index_access_method_test.cpp +++ b/src/mongo/db/index/index_access_method_test.cpp @@ -408,7 +408,8 @@ TEST_F(IndexAccessMethodBulkBuilder, CommitRejectsZeroInterval) { }}, IndexAccessMethod::RecordIdHandlerFn{}, IndexAccessMethod::YieldFn{}, - IndexAccessMethod::OnNKeysLoadedFn{[]() {}}, + IndexAccessMethod::OnNKeysLoadedFn{[]() { + }}, /*onNKeysLoadedFnInterval=*/0, /*keyBatchSize=*/1, /*keyBatchBytes=*/1024), diff --git a/src/mongo/db/matcher/doc_validation/doc_validation_error.cpp b/src/mongo/db/matcher/doc_validation/doc_validation_error.cpp index 9b0d31574cb..8f7459edb40 100644 --- a/src/mongo/db/matcher/doc_validation/doc_validation_error.cpp +++ b/src/mongo/db/matcher/doc_validation/doc_validation_error.cpp @@ -351,7 +351,9 @@ struct ValidationErrorContext { verifySizeAndAppend(details, kDetailsString, builder); }, [&](const std::monostate& state) -> void { MONGO_UNREACHABLE }, - [&](const std::string& str) -> void { MONGO_UNREACHABLE }}, + [&](const std::string& str) -> void { + MONGO_UNREACHABLE + }}, latestCompleteError); } /** @@ -372,7 +374,9 @@ struct ValidationErrorContext { verifySizeAndAppend(elem, builder); } }, - [&](const std::monostate& state) -> void { MONGO_UNREACHABLE }}, + [&](const std::monostate& state) -> void { + MONGO_UNREACHABLE + }}, latestCompleteError); } diff --git a/src/mongo/db/pipeline/change_stream_document_diff_parser.cpp b/src/mongo/db/pipeline/change_stream_document_diff_parser.cpp index 2f288ba11f6..0e409ce95ec 100644 --- a/src/mongo/db/pipeline/change_stream_document_diff_parser.cpp +++ b/src/mongo/db/pipeline/change_stream_document_diff_parser.cpp @@ -215,9 +215,10 @@ void buildUpdateDescriptionWithDeltaOplog( while (auto nextSubDiff = reader->nextSubDiff()) { std::variant nextReader; - visit( - OverloadedVisitor{[&nextReader](auto& reader) { nextReader = &reader; }}, - nextSubDiff->second); + visit(OverloadedVisitor{[&nextReader](auto& reader) { + nextReader = &reader; + }}, + nextSubDiff->second); buildUpdateDescriptionWithDeltaOplog( nextReader, builder, {{nextSubDiff->first}}); } diff --git a/src/mongo/db/pipeline/document_source_densify.h b/src/mongo/db/pipeline/document_source_densify.h index 03953a98b2c..32135bf5b24 100644 --- a/src/mongo/db/pipeline/document_source_densify.h +++ b/src/mongo/db/pipeline/document_source_densify.h @@ -84,7 +84,9 @@ public: */ Value toValue() const { return visit(OverloadedVisitor{[&](Value unwrappedVal) { return unwrappedVal; }, - [&](Date_t dateVal) { return Value(dateVal); } + [&](Date_t dateVal) { + return Value(dateVal); + } }, _value); @@ -128,7 +130,9 @@ public: std::string toString() const { return visit(OverloadedVisitor{[&](Value v) { return v.toString(); }, - [&](Date_t d) { return d.toString(); }}, + [&](Date_t d) { + return d.toString(); + }}, _value); } @@ -147,7 +151,9 @@ public: */ size_t getApproximateSize() const { return visit(OverloadedVisitor{[&](Value v) { return v.getApproximateSize(); }, - [&](Date_t d) { return Value(d).getApproximateSize(); }}, + [&](Date_t d) { + return Value(d).getApproximateSize(); + }}, _value); } diff --git a/src/mongo/db/pipeline/document_source_group_test.cpp b/src/mongo/db/pipeline/document_source_group_test.cpp index 290e44b204e..851f2062c5f 100644 --- a/src/mongo/db/pipeline/document_source_group_test.cpp +++ b/src/mongo/db/pipeline/document_source_group_test.cpp @@ -102,8 +102,9 @@ public: OwningDistributedPlanContext(std::unique_ptr pipelinePrefix, std::unique_ptr pipelineSuffix, boost::optional shardKeys) - : DocumentSourceGroup::DistributedPlanContext{ - *pipelinePrefix, *pipelineSuffix, this->shardKeys}, + : DocumentSourceGroup::DistributedPlanContext{*pipelinePrefix, + *pipelineSuffix, + this->shardKeys}, pipelinePrefix(std::move(pipelinePrefix)), pipelineSuffix(std::move(pipelineSuffix)), shardKeys(std::move(shardKeys)) {} diff --git a/src/mongo/db/pipeline/expression_context.h b/src/mongo/db/pipeline/expression_context.h index f8fd15d41d8..12a576c6549 100644 --- a/src/mongo/db/pipeline/expression_context.h +++ b/src/mongo/db/pipeline/expression_context.h @@ -1372,8 +1372,9 @@ private: boost::optional _querySettings = boost::none; DeferredFn - _queryKnobConfiguration{ - [](const auto& querySettings) { return QueryKnobConfiguration(querySettings); }}; + _queryKnobConfiguration{[](const auto& querySettings) { + return QueryKnobConfiguration(querySettings); + }}; Deferred _featureFlagShardFilteringDistinctScan{ [](const VersionContext& vCtx) { diff --git a/src/mongo/db/pipeline/sharded_agg_helpers.cpp b/src/mongo/db/pipeline/sharded_agg_helpers.cpp index 20cb979492b..24cbc7c177c 100644 --- a/src/mongo/db/pipeline/sharded_agg_helpers.cpp +++ b/src/mongo/db/pipeline/sharded_agg_helpers.cpp @@ -1824,21 +1824,23 @@ std::unique_ptr targetShardsAndAddMergeCursors( bool useCollectionDefaultCollator) { auto&& aggRequestPipelinePair = [&] { return visit( - OverloadedVisitor{ - [&](std::unique_ptr&& pipeline) { - return std::make_pair(AggregateCommandRequest(expCtx->getNamespaceString(), - pipeline->serializeToBson()), - std::move(pipeline)); - }, - [&](AggregateCommandRequest&& aggRequest) { - auto rawPipeline = aggRequest.getPipeline(); - return std::make_pair( - std::move(aggRequest), - pipeline_factory::makePipeline( - rawPipeline, expCtx, pipeline_factory::kOptionsMinimal)); - }, - [&](std::pair>&& - aggRequestPipelinePair) { return std::move(aggRequestPipelinePair); }}, + OverloadedVisitor{[&](std::unique_ptr&& pipeline) { + return std::make_pair( + AggregateCommandRequest(expCtx->getNamespaceString(), + pipeline->serializeToBson()), + std::move(pipeline)); + }, + [&](AggregateCommandRequest&& aggRequest) { + auto rawPipeline = aggRequest.getPipeline(); + return std::make_pair( + std::move(aggRequest), + pipeline_factory::makePipeline( + rawPipeline, expCtx, pipeline_factory::kOptionsMinimal)); + }, + [&](std::pair>&& + aggRequestPipelinePair) { + return std::move(aggRequestPipelinePair); + }}, std::move(targetRequest)); }(); const auto& aggRequest = aggRequestPipelinePair.first; diff --git a/src/mongo/db/pipeline/stage_params_to_document_source_registry.h b/src/mongo/db/pipeline/stage_params_to_document_source_registry.h index b59934a7042..9cf2e6b604e 100644 --- a/src/mongo/db/pipeline/stage_params_to_document_source_registry.h +++ b/src/mongo/db/pipeline/stage_params_to_document_source_registry.h @@ -76,8 +76,9 @@ using StageParamsToDocumentSourceFn = std::function(service); }}; + "DocsNeededBoundsRegisterer", [](ServiceContext* service) { + registerMongodVisitor(service); + }}; DocsNeededBounds extractDocsNeededBounds(const DocumentSourceContainer& sources, diff --git a/src/mongo/db/profile_collection.cpp b/src/mongo/db/profile_collection.cpp index 03a67b03e14..0283116c598 100644 --- a/src/mongo/db/profile_collection.cpp +++ b/src/mongo/db/profile_collection.cpp @@ -223,10 +223,12 @@ void doProfile(auto opCtx, boost::optional profileCollection; while (true) { - const auto deadline = std::visit( - OverloadedVisitor{[&](const NoTimeoutTag&) { return Date_t::max(); }, - [&](const Milliseconds& millis) { return Date_t::now() + millis; }}, - lockTimeout); + const auto deadline = + std::visit(OverloadedVisitor{[&](const NoTimeoutTag&) { return Date_t::max(); }, + [&](const Milliseconds& millis) { + return Date_t::now() + millis; + }}, + lockTimeout); profileCollection.emplace(acquireCollection( newCtx.get(), diff --git a/src/mongo/db/query/compiler/optimizer/join/join_plan.cpp b/src/mongo/db/query/compiler/optimizer/join/join_plan.cpp index bfb16172a10..433d0e2fd06 100644 --- a/src/mongo/db/query/compiler/optimizer/join/join_plan.cpp +++ b/src/mongo/db/query/compiler/optimizer/join/join_plan.cpp @@ -158,17 +158,19 @@ BSONObj JoinPlanNodeRegistry::joinPlanNodeToBSON(JoinPlanNodeId nodeId, bob << "cost" << getCost(nodeId).toBSON(); } std::visit( - OverloadedVisitor{ - [this, numNodesToPrint, &bob](const JoiningNode& join) { - bob << "method" << joinMethodToString(join.method); - bob << "left" << joinPlanNodeToBSON(join.left, numNodesToPrint); - bob << "right" << joinPlanNodeToBSON(join.right, numNodesToPrint); - }, - [&bob](const INLJRHSNode& ip) { - bob << "accessPath" - << (str::stream() << "INDEX_PROBE " << ip.entry->descriptor()->keyPattern()); - }, - [&bob](const BaseNode& base) { bob << "accessPath" << base.soln->summaryString(); }}, + OverloadedVisitor{[this, numNodesToPrint, &bob](const JoiningNode& join) { + bob << "method" << joinMethodToString(join.method); + bob << "left" << joinPlanNodeToBSON(join.left, numNodesToPrint); + bob << "right" << joinPlanNodeToBSON(join.right, numNodesToPrint); + }, + [&bob](const INLJRHSNode& ip) { + bob << "accessPath" + << (str::stream() + << "INDEX_PROBE " << ip.entry->descriptor()->keyPattern()); + }, + [&bob](const BaseNode& base) { + bob << "accessPath" << base.soln->summaryString(); + }}, get(nodeId)); return bob.obj(); } diff --git a/src/mongo/db/query/compiler/optimizer/join/join_plan.h b/src/mongo/db/query/compiler/optimizer/join/join_plan.h index ce83f4dfef4..9d89a6acf4d 100644 --- a/src/mongo/db/query/compiler/optimizer/join/join_plan.h +++ b/src/mongo/db/query/compiler/optimizer/join/join_plan.h @@ -163,7 +163,9 @@ inline JoinCostEstimate getNodeCost(const JoinPlanNode& node) { MONGO_UNREACHABLE_TASSERT(11727800); return JoinCostEstimate(zeroCE, zeroCE, zeroCE, zeroCE); }, - [](const BaseNode& base) { return base.cost; }}, + [](const BaseNode& base) { + return base.cost; + }}, node); } @@ -174,7 +176,9 @@ inline NodeSet getNodeBitset(const JoinPlanNode& node) { return std::visit( OverloadedVisitor{[](const JoiningNode& join) { return join.bitset; }, [](const INLJRHSNode& ip) { return NodeSet().set(ip.node); }, - [](const BaseNode& base) { return NodeSet().set(base.node); }}, + [](const BaseNode& base) { + return NodeSet().set(base.node); + }}, node); } diff --git a/src/mongo/db/query/fle/encrypted_predicate.h b/src/mongo/db/query/fle/encrypted_predicate.h index c626652b5b3..b46b916d42f 100644 --- a/src/mongo/db/query/fle/encrypted_predicate.h +++ b/src/mongo/db/query/fle/encrypted_predicate.h @@ -83,7 +83,9 @@ using BSONValue = std::variant>; template T parseFindPayload(BSONValue payload) { return visit(OverloadedVisitor{[&](BSONElement payload) { return T(payload); }, - [&](Value payload) { return T(payload); }}, + [&](Value payload) { + return T(payload); + }}, payload); } diff --git a/src/mongo/db/query/get_executor.cpp b/src/mongo/db/query/get_executor.cpp index 2ec28ddbfbc..d2db740587a 100644 --- a/src/mongo/db/query/get_executor.cpp +++ b/src/mongo/db/query/get_executor.cpp @@ -975,9 +975,12 @@ public: CanonicalQuery* cq, PlanYieldPolicy::YieldPolicy policy, std::unique_ptr plannerParams) - : SbeWithClassicRuntimePlanningPrepareExecutionHelperBase{ - opCtx, collections, cq, policy, std::move(plannerParams), false /*useSbePlanCache*/} { - } + : SbeWithClassicRuntimePlanningPrepareExecutionHelperBase{opCtx, + collections, + cq, + policy, + std::move(plannerParams), + false /*useSbePlanCache*/} {} private: PlanCacheKey buildPlanCacheKey() const override { diff --git a/src/mongo/db/query/stage_builder/sbe/abt/strong_alias.h b/src/mongo/db/query/stage_builder/sbe/abt/strong_alias.h index 678dfde8086..e616b55353f 100644 --- a/src/mongo/db/query/stage_builder/sbe/abt/strong_alias.h +++ b/src/mongo/db/query/stage_builder/sbe/abt/strong_alias.h @@ -52,7 +52,7 @@ public: // Allow implicit construction from a string literal, but not from a const char*. template - StrongStringAlias(const char (&value)[N]) : _value(value) {}; + StrongStringAlias(const char (&value)[N]) : _value(value){}; // We disallow empty strings based on the tag's kAllowEmpty field. template > diff --git a/src/mongo/db/query/stage_builder/sbe/gen_group.cpp b/src/mongo/db/query/stage_builder/sbe/gen_group.cpp index e90975c48e2..8c88d3678dd 100644 --- a/src/mongo/db/query/stage_builder/sbe/gen_group.cpp +++ b/src/mongo/db/query/stage_builder/sbe/gen_group.cpp @@ -747,8 +747,9 @@ boost::optional tryToGenerateOneBlockAccumulator( * exit. */ auto makeValueGuard(auto* dst, auto val) { - return ScopeGuard{ - [dst, old = std::exchange(*dst, std::move(val))]() mutable { *dst = std::move(old); }}; + return ScopeGuard{[dst, old = std::exchange(*dst, std::move(val))]() mutable { + *dst = std::move(old); + }}; } SbHashAggAccumulatorVector generateScalarAccumulators(StageBuilderState& state, diff --git a/src/mongo/db/query/stage_builder/sbe/gen_helpers.h b/src/mongo/db/query/stage_builder/sbe/gen_helpers.h index b52a01b5ab5..4feee00a5f7 100644 --- a/src/mongo/db/query/stage_builder/sbe/gen_helpers.h +++ b/src/mongo/db/query/stage_builder/sbe/gen_helpers.h @@ -751,7 +751,9 @@ public: }, [](const Expr& e) { return ProjectNode(e.expr); }, [](const SbExpr& e) { return ProjectNode(e.clone()); }, - [](const Slice& s) { return ProjectNode(s); }}, + [](const Slice& s) { + return ProjectNode(s); + }}, _data); } @@ -759,7 +761,9 @@ public: return visit(OverloadedVisitor{[](const Bool&) { return Type::kBool; }, [](const Expr&) { return Type::kExpr; }, [](const SbExpr&) { return Type::kSbExpr; }, - [](const Slice&) { return Type::kSlice; }}, + [](const Slice&) { + return Type::kSlice; + }}, _data); } diff --git a/src/mongo/db/query/stage_builder/sbe/gen_projection.cpp b/src/mongo/db/query/stage_builder/sbe/gen_projection.cpp index d226eeee48c..9edbbc04d8b 100644 --- a/src/mongo/db/query/stage_builder/sbe/gen_projection.cpp +++ b/src/mongo/db/query/stage_builder/sbe/gen_projection.cpp @@ -59,7 +59,9 @@ ProjectActionType ProjectAction::type() const { [](const SetArg&) { return ProjectActionType::kSetArg; }, [](const AddArg&) { return ProjectActionType::kAddArg; }, [](const LambdaArg&) { return ProjectActionType::kLambdaArg; }, - [](const MakeObj&) { return ProjectActionType::kMakeObj; }}, + [](const MakeObj&) { + return ProjectActionType::kMakeObj; + }}, _data); } diff --git a/src/mongo/db/query/stage_builder/sbe/tests/gen_lookup_test.cpp b/src/mongo/db/query/stage_builder/sbe/tests/gen_lookup_test.cpp index 6aa228ddb3d..a7dacea9722 100644 --- a/src/mongo/db/query/stage_builder/sbe/tests/gen_lookup_test.cpp +++ b/src/mongo/db/query/stage_builder/sbe/tests/gen_lookup_test.cpp @@ -340,9 +340,7 @@ TEST_F(LookupStageBuilderTest, NestedLoopJoin_TopLevelLocalField_Null) { std::vector>> expected{ {ldocs[0], - {fdocs[1], - fdocs[2], - fdocs[3], + {fdocs[1], fdocs[2], fdocs[3], /*fdocs[4], fdocs[5] - match in classic, but for undefined we don't care*/}}, }; @@ -364,9 +362,7 @@ TEST_F(LookupStageBuilderTest, NestedLoopJoin_TopLevelLocalField_Missing) { std::vector>> expected = { {ldocs[0], - {fdocs[1], - fdocs[2], - fdocs[3], + {fdocs[1], fdocs[2], fdocs[3], /*fdocs[4], fdocs[5] - match in classic, but for undefined we don't care*/}}, }; diff --git a/src/mongo/db/query/util/deferred_test.cpp b/src/mongo/db/query/util/deferred_test.cpp index b48e5328f22..eb8b34330c3 100644 --- a/src/mongo/db/query/util/deferred_test.cpp +++ b/src/mongo/db/query/util/deferred_test.cpp @@ -105,7 +105,9 @@ TEST(DeferredTest, DeferredInitializationWithOneArgument) { } TEST(DeferredTest, DeferredInitializationWithTwoArgs) { - Deferred deferred{[&](const string& input, const string& prefix) { return prefix + input; }}; + Deferred deferred{[&](const string& input, const string& prefix) { + return prefix + input; + }}; ASSERT_EQ(deferred.get("cowbell", "more "), "more cowbell"s); ASSERT_EQ(deferred.get("cowbell", "more "), "more cowbell"s); diff --git a/src/mongo/db/query/write_ops/write_ops.cpp b/src/mongo/db/query/write_ops/write_ops.cpp index 9f87a1ee4d2..f22ea9b016e 100644 --- a/src/mongo/db/query/write_ops/write_ops.cpp +++ b/src/mongo/db/query/write_ops/write_ops.cpp @@ -777,7 +777,9 @@ int UpdateModification::objsize() const { return size + kWriteCommandBSONArrayPerElementOverheadBytes; }, [](const DeltaUpdate& delta) -> int { return delta.diff.objsize(); }, - [](const TransformUpdate& transform) -> int { return 0; }}, + [](const TransformUpdate& transform) -> int { + return 0; + }}, _update); } @@ -787,7 +789,9 @@ UpdateModification::Type UpdateModification::type() const { [](const ModifierUpdate& modifier) { return Type::kModifier; }, [](const PipelineUpdate& pipelineUpdate) { return Type::kPipeline; }, [](const DeltaUpdate& delta) { return Type::kDelta; }, - [](const TransformUpdate& transform) { return Type::kTransform; }}, + [](const TransformUpdate& transform) { + return Type::kTransform; + }}, _update); } @@ -812,7 +816,8 @@ void UpdateModification::serializeToBSON(StringData fieldName, BSONObjBuilder* b arrayBuilder.doneFast(); }, [fieldName, bob](const DeltaUpdate& delta) { *bob << fieldName << delta.diff; }, - [](const TransformUpdate& transform) {}}, + [](const TransformUpdate& transform) { + }}, _update); } diff --git a/src/mongo/db/query/write_ops/write_ops_exec.cpp b/src/mongo/db/query/write_ops/write_ops_exec.cpp index 778e83dc16f..09e2873ef5e 100644 --- a/src/mongo/db/query/write_ops/write_ops_exec.cpp +++ b/src/mongo/db/query/write_ops/write_ops_exec.cpp @@ -556,8 +556,9 @@ inline boost::optional computeInsertQueryShape( if (wholeOp.getEncryptionInformation()) { return boost::none; } - query_shape::DeferredQueryShape deferredShape{ - [&]() { return shape_helpers::tryMakeShape(wholeOp); }}; + query_shape::DeferredQueryShape deferredShape{[&]() { + return shape_helpers::tryMakeShape(wholeOp); + }}; return deferredShape; } diff --git a/src/mongo/db/query/write_ops/write_ops_parsers.h b/src/mongo/db/query/write_ops/write_ops_parsers.h index e5fece551a5..f27fa4aaf9a 100644 --- a/src/mongo/db/query/write_ops/write_ops_parsers.h +++ b/src/mongo/db/query/write_ops/write_ops_parsers.h @@ -192,20 +192,22 @@ public: std::string toString() const { StringBuilder sb; - visit(OverloadedVisitor{ - [&sb](const ReplacementUpdate& replacement) { - sb << "{type: Replacement, update: " << replacement.bson << "}"; - }, - [&sb](const ModifierUpdate& modifier) { - sb << "{type: Modifier, update: " << modifier.bson << "}"; - }, - [&sb](const PipelineUpdate& pipeline) { - sb << "{type: Pipeline, update: " << Value(pipeline).toString() << "}"; - }, - [&sb](const DeltaUpdate& delta) { - sb << "{type: Delta, update: " << delta.diff << "}"; - }, - [&sb](const TransformUpdate& transform) { sb << "{type: Transform}"; }}, + visit(OverloadedVisitor{[&sb](const ReplacementUpdate& replacement) { + sb << "{type: Replacement, update: " << replacement.bson << "}"; + }, + [&sb](const ModifierUpdate& modifier) { + sb << "{type: Modifier, update: " << modifier.bson << "}"; + }, + [&sb](const PipelineUpdate& pipeline) { + sb << "{type: Pipeline, update: " << Value(pipeline).toString() + << "}"; + }, + [&sb](const DeltaUpdate& delta) { + sb << "{type: Delta, update: " << delta.diff << "}"; + }, + [&sb](const TransformUpdate& transform) { + sb << "{type: Transform}"; + }}, _update); return sb.str(); diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp index cbd97ad0cf9..0bb2bc2d5e8 100644 --- a/src/mongo/db/repl/oplog.cpp +++ b/src/mongo/db/repl/oplog.cpp @@ -1302,10 +1302,14 @@ const StringMap kOpsMap = { }}}, {"commitTransaction", {[](OperationContext* opCtx, const ApplierOperation& op, OplogApplication::Mode mode) - -> Status { return applyCommitTransaction(opCtx, op, mode); }}}, + -> Status { + return applyCommitTransaction(opCtx, op, mode); + }}}, {"abortTransaction", {[](OperationContext* opCtx, const ApplierOperation& op, OplogApplication::Mode mode) - -> Status { return applyAbortTransaction(opCtx, op, mode); }}}, + -> Status { + return applyAbortTransaction(opCtx, op, mode); + }}}, {"createDatabaseMetadata", {[](OperationContext* opCtx, const ApplierOperation& op, OplogApplication::Mode mode) -> Status { diff --git a/src/mongo/db/repl/oplog_applier_impl_test.cpp b/src/mongo/db/repl/oplog_applier_impl_test.cpp index 7ab9ded8f27..8f3e5cb78f7 100644 --- a/src/mongo/db/repl/oplog_applier_impl_test.cpp +++ b/src/mongo/db/repl/oplog_applier_impl_test.cpp @@ -528,7 +528,9 @@ TEST_F(OplogApplierImplTest, applyOplogEntryToRecordChangeStreamPreImages) { auto op = makeOplogEntry( [opCtx = _opCtx.get()] { WriteUnitOfWork wuow{opCtx}; - ScopeGuard guard{[&wuow] { wuow.commit(); }}; + ScopeGuard guard{[&wuow] { + wuow.commit(); + }}; return repl::getNextOpTime(opCtx); }(), testCase.opType, @@ -603,7 +605,9 @@ TEST_F(OplogApplierImplTest, ApplyApplyOpsWithMixedFromMigrateRecordsCorrectPreI // Get an optime for the applyOps entry. auto opTime = [opCtx = _opCtx.get()] { WriteUnitOfWork wuow{opCtx}; - ScopeGuard guard{[&wuow] { wuow.commit(); }}; + ScopeGuard guard{[&wuow] { + wuow.commit(); + }}; return repl::getNextOpTime(opCtx); }(); @@ -832,7 +836,9 @@ TEST_F(OplogApplierImplTest, RenameCollectionCommandMultitenant) { // createCollection uses an actual opTime, so we must generate an actually opTime in the future. auto opTime = [opCtx = _opCtx.get()] { WriteUnitOfWork wuow{opCtx}; - ScopeGuard guard{[&wuow] { wuow.commit(); }}; + ScopeGuard guard{[&wuow] { + wuow.commit(); + }}; return repl::getNextOpTime(opCtx); }(); auto op = makeCommandOplogEntry(opTime, sourceNss, oRename, {}); @@ -860,7 +866,9 @@ TEST_F(OplogApplierImplTest, RenameCollectionCommandMultitenantRequireTenantIDFa // createCollection uses an actual opTime, so we must generate an actually opTime in the future. auto opTime = [opCtx = _opCtx.get()] { WriteUnitOfWork wuow{opCtx}; - ScopeGuard guard{[&wuow] { wuow.commit(); }}; + ScopeGuard guard{[&wuow] { + wuow.commit(); + }}; return repl::getNextOpTime(opCtx); }(); auto op = makeCommandOplogEntry(opTime, sourceNss, oRename, {}); @@ -893,7 +901,9 @@ TEST_F(OplogApplierImplTest, RenameCollectionCommandMultitenantAcrossTenantsRequ // createCollection uses an actual opTime, so we must generate an actually opTime in the future. auto opTime = [opCtx = _opCtx.get()] { WriteUnitOfWork wuow{opCtx}; - ScopeGuard guard{[&wuow] { wuow.commit(); }}; + ScopeGuard guard{[&wuow] { + wuow.commit(); + }}; return repl::getNextOpTime(opCtx); }(); auto op = makeCommandOplogEntry(opTime, sourceNss, oRename, {}); diff --git a/src/mongo/db/repl/oplog_delete_record_id_test.cpp b/src/mongo/db/repl/oplog_delete_record_id_test.cpp index be9f7735eff..a886aedb1fa 100644 --- a/src/mongo/db/repl/oplog_delete_record_id_test.cpp +++ b/src/mongo/db/repl/oplog_delete_record_id_test.cpp @@ -421,7 +421,9 @@ TEST_F(DeleteWithRecordIdAndPreImagesTest, // Create a delete oplog entry with recordId. OpTime opTime = [opCtx = _opCtx.get()] { WriteUnitOfWork wuow{opCtx}; - ScopeGuard guard{[&wuow] { wuow.commit(); }}; + ScopeGuard guard{[&wuow] { + wuow.commit(); + }}; return repl::getNextOpTime(opCtx); }(); auto op = makeDeleteOplogEntryWithRecordId(opTime, _nss, _uuid, BSON("_id" << 1), rid); @@ -461,7 +463,9 @@ DEATH_TEST_F(DeleteWithRecordIdAndPreImagesDeathTest, // Create an update oplog entry with the non-existent recordId. OpTime opTime = [opCtx = _opCtx.get()] { WriteUnitOfWork wuow{opCtx}; - ScopeGuard guard{[&wuow] { wuow.commit(); }}; + ScopeGuard guard{[&wuow] { + wuow.commit(); + }}; return repl::getNextOpTime(opCtx); }(); auto op = diff --git a/src/mongo/db/repl/oplog_update_record_id_test.cpp b/src/mongo/db/repl/oplog_update_record_id_test.cpp index 5280a3dc6ca..622ecd13d03 100644 --- a/src/mongo/db/repl/oplog_update_record_id_test.cpp +++ b/src/mongo/db/repl/oplog_update_record_id_test.cpp @@ -611,7 +611,9 @@ TEST_F(UpdateWithRecordIdAndPreImagesTest, // Create an update oplog entry with recordId. OpTime opTime = [opCtx = _opCtx.get()] { WriteUnitOfWork wuow{opCtx}; - ScopeGuard guard{[&wuow] { wuow.commit(); }}; + ScopeGuard guard{[&wuow] { + wuow.commit(); + }}; return repl::getNextOpTime(opCtx); }(); auto op = makeUpdateOplogEntryWithRecordId( @@ -654,7 +656,9 @@ DEATH_TEST_F(UpdateWithRecordIdAndPreImagesDeathTest, // Create an update oplog entry with the non-existent recordId. OpTime opTime = [opCtx = _opCtx.get()] { WriteUnitOfWork wuow{opCtx}; - ScopeGuard guard{[&wuow] { wuow.commit(); }}; + ScopeGuard guard{[&wuow] { + wuow.commit(); + }}; return repl::getNextOpTime(opCtx); }(); auto op = makeUpdateOplogEntryWithRecordId( diff --git a/src/mongo/db/repl/rollback_impl.cpp b/src/mongo/db/repl/rollback_impl.cpp index 630b43aff61..a5b5323a594 100644 --- a/src/mongo/db/repl/rollback_impl.cpp +++ b/src/mongo/db/repl/rollback_impl.cpp @@ -270,8 +270,9 @@ Status RollbackImpl::runRollback(OperationContext* opCtx) { // the size storer information is no longer accurate. This may be necessary if capped deletes // are rolled-back or if rollback occurs across a collection rename. sizeRecovery.setRecordStoresShouldAlwaysCheckSize(true); - ScopeGuard sizeRecoveryStateGuard{ - [&sizeRecovery] { sizeRecovery.setRecordStoresShouldAlwaysCheckSize(false); }}; + ScopeGuard sizeRecoveryStateGuard{[&sizeRecovery] { + sizeRecovery.setRecordStoresShouldAlwaysCheckSize(false); + }}; // After successfully transitioning to the ROLLBACK state, we must always transition back to // SECONDARY, even if we fail at any point during the rollback process. diff --git a/src/mongo/db/s/balancer/auto_merger_policy_test.cpp b/src/mongo/db/s/balancer/auto_merger_policy_test.cpp index 91abf0e869a..82d73c13c12 100644 --- a/src/mongo/db/s/balancer/auto_merger_policy_test.cpp +++ b/src/mongo/db/s/balancer/auto_merger_policy_test.cpp @@ -252,7 +252,8 @@ protected: } protected: - AutoMergerPolicy _automerger{[]() {}}; + AutoMergerPolicy _automerger{[]() { + }}; inline const static auto _shards = std::vector{ShardType{"shard0", "host0:123"}, ShardType{"shard1", "host1:123"}}; diff --git a/src/mongo/db/s/balancer/balancer_commands_scheduler_test.cpp b/src/mongo/db/s/balancer/balancer_commands_scheduler_test.cpp index c862499245d..b15a27f0c0e 100644 --- a/src/mongo/db/s/balancer/balancer_commands_scheduler_test.cpp +++ b/src/mongo/db/s/balancer/balancer_commands_scheduler_test.cpp @@ -171,8 +171,10 @@ TEST_F(BalancerCommandsSchedulerTest, StartAndStopScheduler) { } TEST_F(BalancerCommandsSchedulerTest, SuccessfulMoveRangeCommand) { - auto remoteResponsesFuture = setRemoteResponses( - {[&](const executor::RemoteCommandRequest& request) { return OkReply().toBSON(); }}); + auto remoteResponsesFuture = + setRemoteResponses({[&](const executor::RemoteCommandRequest& request) { + return OkReply().toBSON(); + }}); _scheduler.start(operationContext()); ShardsvrMoveRange shardsvrRequest(kNss); shardsvrRequest.setCollectionTimestamp(Timestamp(10)); @@ -192,8 +194,10 @@ TEST_F(BalancerCommandsSchedulerTest, SuccessfulMoveRangeCommand) { } TEST_F(BalancerCommandsSchedulerTest, SuccessfulMergeChunkCommand) { - auto remoteResponsesFuture = setRemoteResponses( - {[&](const executor::RemoteCommandRequest& request) { return OkReply().toBSON(); }}); + auto remoteResponsesFuture = + setRemoteResponses({[&](const executor::RemoteCommandRequest& request) { + return OkReply().toBSON(); + }}); _scheduler.start(operationContext()); ChunkRange range(BSON("x" << 0), BSON("x" << 20)); @@ -223,8 +227,10 @@ TEST_F(BalancerCommandsSchedulerTest, SuccessfulRequestChunkDataSizeCommand) { chunkSizeResponse.append("ok", "1"); chunkSizeResponse.append("size", 156); chunkSizeResponse.append("numObjects", 25); - auto remoteResponsesFuture = setRemoteResponses( - {[&](const executor::RemoteCommandRequest& request) { return chunkSizeResponse.obj(); }}); + auto remoteResponsesFuture = + setRemoteResponses({[&](const executor::RemoteCommandRequest& request) { + return chunkSizeResponse.obj(); + }}); _scheduler.start(operationContext()); ChunkType chunk = makeChunk(0, kShardId0); @@ -295,8 +301,10 @@ TEST_F(BalancerCommandsSchedulerTest, SuccessfulMoveCollectionRequest) { TEST_F(BalancerCommandsSchedulerTest, CommandFailsWhenNetworkReturnsError) { auto timeoutError = Status{ErrorCodes::NetworkTimeout, "Mock error: network timed out"}; - auto remoteResponsesFuture = setRemoteResponses( - {[&](const executor::RemoteCommandRequest& request) { return timeoutError; }}); + auto remoteResponsesFuture = + setRemoteResponses({[&](const executor::RemoteCommandRequest& request) { + return timeoutError; + }}); _scheduler.start(operationContext()); auto req = makeMoveRangeRequest(0, kShardId1, kShardId0); auto futureResponse = _scheduler.requestMoveRange( diff --git a/src/mongo/db/s/balancer/balancer_defragmentation_policy_test.cpp b/src/mongo/db/s/balancer/balancer_defragmentation_policy_test.cpp index bf08327244b..b0d76bd9890 100644 --- a/src/mongo/db/s/balancer/balancer_defragmentation_policy_test.cpp +++ b/src/mongo/db/s/balancer/balancer_defragmentation_policy_test.cpp @@ -783,7 +783,9 @@ TEST_F(BalancerDefragmentationPolicyTest, PhaseOneNotConsecutive) { } }, [](const MigrateInfo& _) { FAIL("Unexpected action type"); }, - [](const MergeAllChunksOnShardInfo& _) { FAIL("Unexpected action type"); }}, + [](const MergeAllChunksOnShardInfo& _) { + FAIL("Unexpected action type"); + }}, action); }; inspectAction(*nextAction); diff --git a/src/mongo/db/s/primary_only_service_helpers/primary_only_service_retry_strategy_test.cpp b/src/mongo/db/s/primary_only_service_helpers/primary_only_service_retry_strategy_test.cpp index b0cbab62aab..e6397ec3051 100644 --- a/src/mongo/db/s/primary_only_service_helpers/primary_only_service_retry_strategy_test.cpp +++ b/src/mongo/db/s/primary_only_service_helpers/primary_only_service_retry_strategy_test.cpp @@ -50,17 +50,19 @@ protected: } PrimaryOnlyServiceRetryStrategy makeStrategy() { - return PrimaryOnlyServiceRetryStrategy{ - kDefaultRetryabilityPredicate, - [this](const Status& s) { ++_transientErrorCount; }, - [this](const Status& s) { ++_unrecoverableErrorCount; }}; + return PrimaryOnlyServiceRetryStrategy{kDefaultRetryabilityPredicate, + [this](const Status& s) { ++_transientErrorCount; }, + [this](const Status& s) { + ++_unrecoverableErrorCount; + }}; } PrimaryOnlyServiceRetryStrategy makeNeverRetryStrategy() { - return PrimaryOnlyServiceRetryStrategy{ - makeNeverRetryPredicate(), - [this](const Status& s) { ++_transientErrorCount; }, - [this](const Status& s) { ++_unrecoverableErrorCount; }}; + return PrimaryOnlyServiceRetryStrategy{makeNeverRetryPredicate(), + [this](const Status& s) { ++_transientErrorCount; }, + [this](const Status& s) { + ++_unrecoverableErrorCount; + }}; } int transientErrorCount() const { diff --git a/src/mongo/db/s/primary_only_service_helpers/with_automatic_retry.h b/src/mongo/db/s/primary_only_service_helpers/with_automatic_retry.h index 9bec51f84e6..cfe53f00449 100644 --- a/src/mongo/db/s/primary_only_service_helpers/with_automatic_retry.h +++ b/src/mongo/db/s/primary_only_service_helpers/with_automatic_retry.h @@ -117,7 +117,9 @@ public: auto body = std::make_shared(std::move(_body)); return AsyncTry{[body, retryFactory = _retryFactory, executor, cancelToken] { auto strategy = retryFactory.make(); - return AsyncTry{[body](const TargetingMetadata& metadata) { return (*body)(); }} + return AsyncTry{[body](const TargetingMetadata& metadata) { + return (*body)(); + }} .withRetryStrategy(strategy) .on(executor, cancelToken); }} @@ -140,8 +142,9 @@ public: auto runOn(SleepableExecutor executor, CancellationToken cancelToken, std::shared_ptr retryStrategy) && { - return AsyncTry{ - [body = std::move(_body)](const TargetingMetadata& metadata) { return body(); }} + return AsyncTry{[body = std::move(_body)](const TargetingMetadata& metadata) { + return body(); + }} .withRetryStrategy(std::move(retryStrategy)) .on(executor, cancelToken); } diff --git a/src/mongo/db/s/resharding/resharding_coordinator_dao_test.cpp b/src/mongo/db/s/resharding/resharding_coordinator_dao_test.cpp index 5c2349cd2be..184b095d3bc 100644 --- a/src/mongo/db/s/resharding/resharding_coordinator_dao_test.cpp +++ b/src/mongo/db/s/resharding/resharding_coordinator_dao_test.cpp @@ -276,8 +276,9 @@ DEATH_TEST_F(ReshardingCoordinatorDaoFixtureDeathTest, shardToNumDocsCopied.emplace(shard2, 200); runPhaseTransitionTest(PhaseTransitionTestCase{ - .initialPhase = CoordinatorStateEnum::kApplying, - .transitionFn = [&]() { _dao->updateNumberOfDocsToCopy(_opCtx, shardToNumDocsCopied); }}); + .initialPhase = CoordinatorStateEnum::kApplying, .transitionFn = [&]() { + _dao->updateNumberOfDocsToCopy(_opCtx, shardToNumDocsCopied); + }}); } TEST_F(ReshardingCoordinatorDaoFixture, UpdateNumberOfDocsCopiedFinal) { @@ -359,8 +360,9 @@ DEATH_TEST_F(ReshardingCoordinatorDaoFixtureDeathTest, auto applyStartTime = _clock->now(); runPhaseTransitionTest(PhaseTransitionTestCase{ - .initialPhase = CoordinatorStateEnum::kApplying, - .transitionFn = [&]() { _dao->transitionToApplyingPhase(_opCtx, applyStartTime); }}); + .initialPhase = CoordinatorStateEnum::kApplying, .transitionFn = [&]() { + _dao->transitionToApplyingPhase(_opCtx, applyStartTime); + }}); } TEST_F(ReshardingCoordinatorDaoFixture, TransitionToBlockingWritesPhaseSucceeds) { @@ -448,8 +450,9 @@ DEATH_TEST_F(ReshardingCoordinatorDaoFixtureDeathTest, Status abortReason = Status::OK(); runPhaseTransitionTest(PhaseTransitionTestCase{ - .initialPhase = CoordinatorStateEnum::kApplying, - .transitionFn = [&]() { _dao->transitionToAbortingPhase(_opCtx, now, abortReason); }}); + .initialPhase = CoordinatorStateEnum::kApplying, .transitionFn = [&]() { + _dao->transitionToAbortingPhase(_opCtx, now, abortReason); + }}); } DEATH_TEST_F(ReshardingCoordinatorDaoFixtureDeathTest, @@ -459,8 +462,9 @@ DEATH_TEST_F(ReshardingCoordinatorDaoFixtureDeathTest, Status abortReason{ErrorCodes::InternalError, "Something went horribly wrong"}; runPhaseTransitionTest(PhaseTransitionTestCase{ - .initialPhase = CoordinatorStateEnum::kCommitting, - .transitionFn = [&]() { _dao->transitionToAbortingPhase(_opCtx, now, abortReason); }}); + .initialPhase = CoordinatorStateEnum::kCommitting, .transitionFn = [&]() { + _dao->transitionToAbortingPhase(_opCtx, now, abortReason); + }}); } TEST_F(ReshardingCoordinatorDaoFixture, UpdateSessionSetsSessionField) { diff --git a/src/mongo/db/s/resharding/resharding_cumulative_metrics.cpp b/src/mongo/db/s/resharding/resharding_cumulative_metrics.cpp index d94fb605f16..c8afc788c21 100644 --- a/src/mongo/db/s/resharding/resharding_cumulative_metrics.cpp +++ b/src/mongo/db/s/resharding/resharding_cumulative_metrics.cpp @@ -104,8 +104,9 @@ using MetricsPtr = std::unique_ptr; const auto getMetrics = ServiceContext::declareDecoration(); const auto metricsRegisterer = ServiceContext::ConstructorActionRegisterer{ - "ShardingDataTransformMetrics", - [](ServiceContext* ctx) { getMetrics(ctx) = std::make_unique(); }}; + "ShardingDataTransformMetrics", [](ServiceContext* ctx) { + getMetrics(ctx) = std::make_unique(); + }}; } // namespace diff --git a/src/mongo/db/s/resharding/resharding_metrics.cpp b/src/mongo/db/s/resharding/resharding_metrics.cpp index 492a6ff57f6..a1e1ea3a54d 100644 --- a/src/mongo/db/s/resharding/resharding_metrics.cpp +++ b/src/mongo/db/s/resharding/resharding_metrics.cpp @@ -656,7 +656,9 @@ std::unique_ptr ReshardingMetrics::makeInstance_forTest( StringData ReshardingMetrics::getStateString() const { return visit(OverloadedVisitor{[](CoordinatorStateEnum state) { return idl::serialize(state); }, [](RecipientStateEnum state) { return idl::serialize(state); }, - [](DonorStateEnum state) { return idl::serialize(state); }}, + [](DonorStateEnum state) { + return idl::serialize(state); + }}, getState()); } diff --git a/src/mongo/db/s/resharding/resharding_oplog_session_application_test.cpp b/src/mongo/db/s/resharding/resharding_oplog_session_application_test.cpp index 0ccdb62e934..f305e37cce2 100644 --- a/src/mongo/db/s/resharding/resharding_oplog_session_application_test.cpp +++ b/src/mongo/db/s/resharding/resharding_oplog_session_application_test.cpp @@ -140,7 +140,9 @@ public: auto opTime = [opCtx] { WriteUnitOfWork wuow(opCtx); - ScopeGuard guard{[&wuow] { wuow.commit(); }}; + ScopeGuard guard{[&wuow] { + wuow.commit(); + }}; return repl::getNextOpTime(opCtx); }(); WriteUnitOfWork wuow(opCtx); diff --git a/src/mongo/db/s/transaction_coordinator_service_test.cpp b/src/mongo/db/s/transaction_coordinator_service_test.cpp index 7981d69ccf4..2318015f0df 100644 --- a/src/mongo/db/s/transaction_coordinator_service_test.cpp +++ b/src/mongo/db/s/transaction_coordinator_service_test.cpp @@ -1030,7 +1030,9 @@ TEST_F(TransactionCoordinatorServiceTest, // Vote commit before the deadline onCommands({[&](const executor::RemoteCommandRequest&) { return kPrepareOk; }, - [&](const executor::RemoteCommandRequest&) { return kPrepareOk; }}); + [&](const executor::RemoteCommandRequest&) { + return kPrepareOk; + }}); // Reach the deadline. network()->enterNetwork(); @@ -1075,7 +1077,9 @@ TEST_F(TransactionCoordinatorServiceTestSingleTxn, // Simulate a participant voting to abort. onCommands({[&](const executor::RemoteCommandRequest& request) { return kPrepareOk; }, - [&](const executor::RemoteCommandRequest& request) { return kNoSuchTransaction; }}); + [&](const executor::RemoteCommandRequest& request) { + return kNoSuchTransaction; + }}); assertAbortSentAndRespondWithSuccess(); assertAbortSentAndRespondWithSuccess(); diff --git a/src/mongo/db/s/transaction_coordinator_test.cpp b/src/mongo/db/s/transaction_coordinator_test.cpp index c9e08c18e53..d5af8255b67 100644 --- a/src/mongo/db/s/transaction_coordinator_test.cpp +++ b/src/mongo/db/s/transaction_coordinator_test.cpp @@ -548,7 +548,9 @@ TEST_F(TransactionCoordinatorDriverTest, kTwoShardIdList); onCommands({[&](const executor::RemoteCommandRequest& request) { return kNoSuchTransaction; }, - [&](const executor::RemoteCommandRequest& request) { return kPrepareOk; }}); + [&](const executor::RemoteCommandRequest& request) { + return kPrepareOk; + }}); auto decision = future.get().decision(); @@ -587,7 +589,9 @@ TEST_F(TransactionCoordinatorDriverTest, kTwoShardIdList); onCommands({[&](const executor::RemoteCommandRequest& request) { return kNoSuchTransaction; }, - [&](const executor::RemoteCommandRequest& request) { return kNoSuchTransaction; }}); + [&](const executor::RemoteCommandRequest& request) { + return kNoSuchTransaction; + }}); auto decision = future.get().decision(); ASSERT(decision.getDecision() == txn::CommitDecision::kAbort); @@ -1306,7 +1310,9 @@ TEST_F(TransactionCoordinatorTest, RunCommitProducesAbortDecisionOnAbortAndCommi auto commitDecisionFuture = coordinator->getDecision(); onCommands({[&](const executor::RemoteCommandRequest& request) { return kNoSuchTransaction; }, - [&](const executor::RemoteCommandRequest& request) { return kPrepareOk; }}); + [&](const executor::RemoteCommandRequest& request) { + return kPrepareOk; + }}); assertAbortSentAndRespondWithSuccess(); assertAbortSentAndRespondWithSuccess(); @@ -1332,7 +1338,9 @@ TEST_F(TransactionCoordinatorTest, auto commitDecisionFuture = coordinator->getDecision(); onCommands({[&](const executor::RemoteCommandRequest& request) { return kPrepareOk; }, - [&](const executor::RemoteCommandRequest& request) { return kNoSuchTransaction; }}); + [&](const executor::RemoteCommandRequest& request) { + return kNoSuchTransaction; + }}); assertAbortSentAndRespondWithSuccess(); assertAbortSentAndRespondWithSuccess(); @@ -1357,9 +1365,10 @@ TEST_F(TransactionCoordinatorTest, coordinator->runCommit(operationContext(), kTwoShardIdList); auto commitDecisionFuture = coordinator->getDecision(); - onCommands( - {[&](const executor::RemoteCommandRequest& request) { return kPrepareOk; }, - [&](const executor::RemoteCommandRequest& request) { return kTxnRetryCounterTooOld; }}); + onCommands({[&](const executor::RemoteCommandRequest& request) { return kPrepareOk; }, + [&](const executor::RemoteCommandRequest& request) { + return kTxnRetryCounterTooOld; + }}); assertAbortSentAndRespondWithSuccess(); assertAbortSentAndRespondWithSuccess(); @@ -1411,7 +1420,9 @@ TEST_F(TransactionCoordinatorTest, // One participant votes commit and other encounters retryable error onCommands({[&](const executor::RemoteCommandRequest& request) { return kPrepareOk; }, - [&](const executor::RemoteCommandRequest& request) { return kRetryableError; }}); + [&](const executor::RemoteCommandRequest& request) { + return kRetryableError; + }}); advanceClockAndExecuteScheduledTasks(); // Make sure the scheduled retry executes // One participant votes abort after retry. @@ -1442,7 +1453,9 @@ TEST_F(TransactionCoordinatorTest, // One participant votes abort and other encounters retryable error onCommands({[&](const executor::RemoteCommandRequest& request) { return kNoSuchTransaction; }, - [&](const executor::RemoteCommandRequest& request) { return kRetryableError; }}); + [&](const executor::RemoteCommandRequest& request) { + return kRetryableError; + }}); advanceClockAndExecuteScheduledTasks(); // Make sure the cancellation callback is delivered assertAbortSentAndRespondWithSuccess(); diff --git a/src/mongo/db/service_context_test.cpp b/src/mongo/db/service_context_test.cpp index 9d144f7b9fb..16bf2bed725 100644 --- a/src/mongo/db/service_context_test.cpp +++ b/src/mongo/db/service_context_test.cpp @@ -550,7 +550,9 @@ typename T::ConstructorActionRegisterer registerConstructorAction( return typename T::ConstructorActionRegisterer{name, prereqs, [name](T*) { actionListener.onConstruct(name); }, - [name](T*) { actionListener.onDestruct(name); }}; + [name](T*) { + actionListener.onDestruct(name); + }}; } const auto serviceContext1Registerer = registerConstructorAction("ServiceContext1"); diff --git a/src/mongo/db/shard_role/lock_manager/d_concurrency_test.cpp b/src/mongo/db/shard_role/lock_manager/d_concurrency_test.cpp index 59113b4df90..18d1596f7b8 100644 --- a/src/mongo/db/shard_role/lock_manager/d_concurrency_test.cpp +++ b/src/mongo/db/shard_role/lock_manager/d_concurrency_test.cpp @@ -1788,7 +1788,9 @@ TEST_F(DConcurrencyTestFixture, auto result = task.get_future(); stdx::thread taskThread{std::move(task)}; - ScopeGuard joinGuard{[&taskThread] { taskThread.join(); }}; + ScopeGuard joinGuard{[&taskThread] { + taskThread.join(); + }}; // Wait for the database X lock to conflict. while (!shard_role_details::getLocker(opCtx2)->hasLockPending()) { diff --git a/src/mongo/db/shard_role/lock_manager/exception_util.h b/src/mongo/db/shard_role/lock_manager/exception_util.h index 9df405d44d4..a77c4a69700 100644 --- a/src/mongo/db/shard_role/lock_manager/exception_util.h +++ b/src/mongo/db/shard_role/lock_manager/exception_util.h @@ -216,7 +216,9 @@ private: return visit( OverloadedVisitor{ [](std::reference_wrapper ru) -> RecoveryUnit& { return ru; }, - [](const std::function& ru) -> RecoveryUnit& { return ru(); }}, + [](const std::function& ru) -> RecoveryUnit& { + return ru(); + }}, _ru); } diff --git a/src/mongo/db/shard_role/shard_catalog/drop_indexes.cpp b/src/mongo/db/shard_role/shard_catalog/drop_indexes.cpp index 6062fbe9ebe..839df813ec3 100644 --- a/src/mongo/db/shard_role/shard_catalog/drop_indexes.cpp +++ b/src/mongo/db/shard_role/shard_catalog/drop_indexes.cpp @@ -570,13 +570,14 @@ DropIndexesReply dropIndexes(OperationContext* opCtx, "CMD: dropIndexes", logAttrs(collAcq->nss()), "uuid"_attr = collectionUUID, - "indexes"_attr = - visit(OverloadedVisitor{[](const std::string& arg) { return arg; }, - [](const std::vector& arg) { - return boost::algorithm::join(arg, ","); - }, - [](const BSONObj& arg) { return arg.toString(); }}, - index)); + "indexes"_attr = visit(OverloadedVisitor{[](const std::string& arg) { return arg; }, + [](const std::vector& arg) { + return boost::algorithm::join(arg, ","); + }, + [](const BSONObj& arg) { + return arg.toString(); + }}, + index)); } DropIndexesReply reply; diff --git a/src/mongo/db/sharding_environment/client/shard.cpp b/src/mongo/db/sharding_environment/client/shard.cpp index 74e50be6467..d3b2797f531 100644 --- a/src/mongo/db/sharding_environment/client/shard.cpp +++ b/src/mongo/db/sharding_environment/client/shard.cpp @@ -633,8 +633,9 @@ StatusWith> Shard::runAggregationWithResult( Shard::RetryStrategy::RequestStartTransactionState isStartTransaction = Shard::RetryStrategy::extractRequestTransactionState(aggRequest.getGenericArguments()); RetryStrategyWithFailureRetryHook retryStrategy{ - RetryStrategy{*this, retryPolicy, isStartTransaction}, - [&](Status s) { aggResult.clear(); }}; + RetryStrategy{*this, retryPolicy, isStartTransaction}, [&](Status s) { + aggResult.clear(); + }}; auto status = runWithRetryStrategy(opCtx, retryStrategy, [&](const TargetingMetadata& targetingMetadata) { diff --git a/src/mongo/db/sharding_environment/sharding_mongod_test_fixture.cpp b/src/mongo/db/sharding_environment/sharding_mongod_test_fixture.cpp index d1eafffe1fb..e6acaeaae84 100644 --- a/src/mongo/db/sharding_environment/sharding_mongod_test_fixture.cpp +++ b/src/mongo/db/sharding_environment/sharding_mongod_test_fixture.cpp @@ -183,8 +183,10 @@ std::unique_ptr ShardingMongoDTestFixture::makeShardRegistry( std::make_unique(std::move(buildersMap), std::move(targeterFactory)); auto shardRemovalHooks = std::vector{ - [&shardSharedStateCache = ShardSharedStateCache::get(service)]( - const ShardId& removedShard) { shardSharedStateCache.forgetShardState(removedShard); }}; + [&shardSharedStateCache = + ShardSharedStateCache::get(service)](const ShardId& removedShard) { + shardSharedStateCache.forgetShardState(removedShard); + }}; return std::make_unique( getServiceContext(), std::move(shardFactory), configConnStr, std::move(shardRemovalHooks)); diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp index d65147448fd..c555377c30b 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -355,7 +355,9 @@ std::string toString(const StorageEngine::OldestActiveTransactionTimestampResult void setKeyOnCursor(WT_CURSOR* c, const std::variant, int64_t>& key) { std::visit(OverloadedVisitor{ [&](const std::span k) { c->set_key(c, WiredTigerItem{k}.get()); }, - [&](int64_t k) { c->set_key(c, k); }}, + [&](int64_t k) { + c->set_key(c, k); + }}, key); } diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp index e9df51b1776..56aff6f0dc5 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp @@ -449,7 +449,9 @@ TEST_F(WiredTigerRecoveryUnitTestFixture, ReadUncommittedIsolation) { auto session = ru2->getSession(); ru1->beginUnitOfWork(clientAndCtx1.second->readOnly()); - ScopeGuard guard{[this] { ru1->abortUnitOfWork(); }}; + ScopeGuard guard{[this] { + ru1->abortUnitOfWork(); + }}; WT_CURSOR* cursor; getCursor(ru1, &cursor); @@ -474,7 +476,9 @@ TEST_F(WiredTigerRecoveryUnitTestFixture, ReadCommittedIsolation) { auto session = ru2->getSession(); ru1->beginUnitOfWork(clientAndCtx1.second->readOnly()); - ScopeGuard guard{[this] { ru1->abortUnitOfWork(); }}; + ScopeGuard guard{[this] { + ru1->abortUnitOfWork(); + }}; WT_CURSOR* cursor; getCursor(ru1, &cursor); @@ -499,7 +503,9 @@ TEST_F(WiredTigerRecoveryUnitTestFixture, SnapshotIsolation) { auto session = ru2->getSession(); ru1->beginUnitOfWork(clientAndCtx1.second->readOnly()); - ScopeGuard guard{[this] { ru1->abortUnitOfWork(); }}; + ScopeGuard guard{[this] { + ru1->abortUnitOfWork(); + }}; WT_CURSOR* cursor; getCursor(ru1, &cursor); diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_stats.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_stats.cpp index b892966336f..fb828580ce9 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_stats.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_stats.cpp @@ -62,7 +62,9 @@ WiredTigerStats::WiredTigerStats(WiredTigerSession& session) { "Unable to open statistics cursor", !session.open_cursor("statistics:session", nullptr, "statistics=(fast)", &c)); - ScopeGuard guard{[c] { c->close(c); }}; + ScopeGuard guard{[c] { + c->close(c); + }}; // Get all the stats while (c->next(c) == 0) { diff --git a/src/mongo/db/timeseries/bucket_catalog/bucket_catalog_test.cpp b/src/mongo/db/timeseries/bucket_catalog/bucket_catalog_test.cpp index 95c3b58ed0d..a8427180ee7 100644 --- a/src/mongo/db/timeseries/bucket_catalog/bucket_catalog_test.cpp +++ b/src/mongo/db/timeseries/bucket_catalog/bucket_catalog_test.cpp @@ -1653,8 +1653,9 @@ TEST_F(BucketCatalogTest, CannotConcurrentlyCommitBatchesForSameBucket) { { auto task = RunBackgroundTaskAndWaitForFailpoint{ - "hangTimeSeriesBatchPrepareWaitingForConflictingOperation", - [&]() { ASSERT_OK(prepareCommit(*_bucketCatalog, batch2, _getCollator(_ns1))); }}; + "hangTimeSeriesBatchPrepareWaitingForConflictingOperation", [&]() { + ASSERT_OK(prepareCommit(*_bucketCatalog, batch2, _getCollator(_ns1))); + }}; // Finish the first batch. finish(*_bucketCatalog, batch1); @@ -1689,8 +1690,9 @@ TEST_F(BucketCatalogTest, AbortingBatchEnsuresBucketIsEventuallyClosed) { { auto task = RunBackgroundTaskAndWaitForFailpoint{ - "hangTimeSeriesBatchPrepareWaitingForConflictingOperation", - [&]() { ASSERT_NOT_OK(prepareCommit(*_bucketCatalog, batch2, _getCollator(_ns2))); }}; + "hangTimeSeriesBatchPrepareWaitingForConflictingOperation", [&]() { + ASSERT_NOT_OK(prepareCommit(*_bucketCatalog, batch2, _getCollator(_ns2))); + }}; // If we abort the third batch, it should abort the second one too, as it isn't prepared. // However, since the first batch is prepared, we can't abort it or clean up the bucket. We diff --git a/src/mongo/db/timeseries/bucket_catalog/bucket_state_registry_test.cpp b/src/mongo/db/timeseries/bucket_catalog/bucket_state_registry_test.cpp index 6bff1bcd34b..2c4df60555a 100644 --- a/src/mongo/db/timeseries/bucket_catalog/bucket_state_registry_test.cpp +++ b/src/mongo/db/timeseries/bucket_catalog/bucket_state_registry_test.cpp @@ -77,7 +77,9 @@ public: return bucketState == BucketState::kCleared || bucketState == BucketState::kPreparedAndCleared; }, - [](DirectWriteCounter dwcount) { return false; }}, + [](DirectWriteCounter dwcount) { + return false; + }}, *state); } diff --git a/src/mongo/db/update/document_diff_serialization.cpp b/src/mongo/db/update/document_diff_serialization.cpp index 973215f1e6d..aa65ee427c9 100644 --- a/src/mongo/db/update/document_diff_serialization.cpp +++ b/src/mongo/db/update/document_diff_serialization.cpp @@ -157,7 +157,9 @@ void appendElementToBuilder(std::variant elem element.writeArrayTo(&subBuilder); } }, - [&](BSONElement element) { builder->appendAs(element, fieldName); }}, + [&](BSONElement element) { + builder->appendAs(element, fieldName); + }}, elem); } @@ -537,9 +539,10 @@ boost::optional> ArrayDiff str::stream() << "expected sub diff at index " << idx << " but got " << next, next.type() == BSONType::object); - auto modification = visit( - OverloadedVisitor{[](const auto& reader) -> ArrayModification { return {reader}; }}, - getReader(next.embeddedObject())); + auto modification = visit(OverloadedVisitor{[](const auto& reader) -> ArrayModification { + return {reader}; + }}, + getReader(next.embeddedObject())); return {{idx, modification}}; } else { uasserted(4770502, diff --git a/src/mongo/db/version_context.cpp b/src/mongo/db/version_context.cpp index 751b9fb803a..a290e1c5d53 100644 --- a/src/mongo/db/version_context.cpp +++ b/src/mongo/db/version_context.cpp @@ -87,7 +87,9 @@ void VersionContext::resetToOperationWithoutOFCV() { BSONObj VersionContext::toBSON() const { return visit( OverloadedVisitor{[](const VersionContextMetadata& metadata) { return metadata.toBSON(); }, - [](auto&&) -> BSONObj { MONGO_UNREACHABLE_TASSERT(10083532); }}, + [](auto&&) -> BSONObj { + MONGO_UNREACHABLE_TASSERT(10083532); + }}, _metadataOrTag); } diff --git a/src/mongo/db/write_concern_idl.cpp b/src/mongo/db/write_concern_idl.cpp index 37e7d0f01a0..75a27049732 100644 --- a/src/mongo/db/write_concern_idl.cpp +++ b/src/mongo/db/write_concern_idl.cpp @@ -88,7 +88,9 @@ void serializeWriteConcernW(const WriteConcernW& w, StringData fieldName, BSONOb builder->appendNumber(fieldName, static_cast(wNumNodes)); }, [&](const std::string& wMode) { builder->append(fieldName, wMode); }, - [&](WTags wTags) { builder->append(fieldName, wTags); }}, + [&](WTags wTags) { + builder->append(fieldName, wTags); + }}, w); } diff --git a/src/mongo/dbtests/jsobjtests.cpp b/src/mongo/dbtests/jsobjtests.cpp index faed06fd3f8..00f5c58410b 100644 --- a/src/mongo/dbtests/jsobjtests.cpp +++ b/src/mongo/dbtests/jsobjtests.cpp @@ -91,7 +91,8 @@ class EmbeddedBuilder { public: explicit EmbeddedBuilder(BSONObjBuilder* root) { // Root isn't owned, so give it a nop deleter. - _builders.push_back({{}, {root, [](auto) {}}}); + _builders.push_back({{}, {root, [](auto) { + }}}); } void appendAs(const BSONElement& e, StringData name) { diff --git a/src/mongo/executor/async_rpc.cpp b/src/mongo/executor/async_rpc.cpp index e197456383b..7dc7efc1f78 100644 --- a/src/mongo/executor/async_rpc.cpp +++ b/src/mongo/executor/async_rpc.cpp @@ -165,9 +165,11 @@ public: } }; -const auto implRegisterer = ServiceContext::ConstructorActionRegisterer{ - "RemoteCommmandRunner", - [](ServiceContext* ctx) { getRCRImpl(ctx) = std::make_unique(); }}; +const auto implRegisterer = + ServiceContext::ConstructorActionRegisterer{"RemoteCommmandRunner", [](ServiceContext* ctx) { + getRCRImpl(ctx) = + std::make_unique(); + }}; AsyncRPCRunner* AsyncRPCRunner::get(ServiceContext* svcCtx) { return getRCRImpl(svcCtx).get(); diff --git a/src/mongo/executor/thread_pool_task_executor_test.cpp b/src/mongo/executor/thread_pool_task_executor_test.cpp index f9cb4e8f22c..ca354aaf099 100644 --- a/src/mongo/executor/thread_pool_task_executor_test.cpp +++ b/src/mongo/executor/thread_pool_task_executor_test.cpp @@ -354,7 +354,9 @@ TEST_F(ThreadPoolExecutorTest, CancelFromAnotherThread) { finishedShutdown.get(); }); - unittest::JoinThread th{[&] { executor.cancel(swCbHandle.getValue()); }}; + unittest::JoinThread th{[&] { + executor.cancel(swCbHandle.getValue()); + }}; startedCancellation.get(); shutdownExecutorThread(); diff --git a/src/mongo/logv2/log_detail.cpp b/src/mongo/logv2/log_detail.cpp index a3e5278bd1e..c33a231c991 100644 --- a/src/mongo/logv2/log_detail.cpp +++ b/src/mongo/logv2/log_detail.cpp @@ -121,7 +121,8 @@ GetTenantIDFn& getTenantID() { return *fn; } LogCounterCallback& getLogCounterCallback() { - static StaticImmortal fn{[]() {}}; + static StaticImmortal fn{[]() { + }}; return *fn; } } // namespace diff --git a/src/mongo/otel/metrics/metric_names.h b/src/mongo/otel/metrics/metric_names.h index 8ed459259dc..0cb9685a04b 100644 --- a/src/mongo/otel/metrics/metric_names.h +++ b/src/mongo/otel/metrics/metric_names.h @@ -74,12 +74,10 @@ private: }; /** Helper to create MetricName instances. */ -class MONGO_MOD_FILE_PRIVATE MetricNameMaker { -public: - static constexpr MetricName make(StringData name) { - return MetricName(name, Passkey{}); - } -}; +class MONGO_MOD_FILE_PRIVATE MetricNameMaker{public : static constexpr MetricName make( + StringData name){return MetricName(name, Passkey{}); +} // namespace otel::metrics +}; // namespace mongo /** * Central registry of OpenTelemetry metric names used in the server. When adding a new metric to diff --git a/src/mongo/otel/metrics/metrics_prometheus_file_exporter_test.cpp b/src/mongo/otel/metrics/metrics_prometheus_file_exporter_test.cpp index 402e474d45b..9f22e6b12f7 100644 --- a/src/mongo/otel/metrics/metrics_prometheus_file_exporter_test.cpp +++ b/src/mongo/otel/metrics/metrics_prometheus_file_exporter_test.cpp @@ -222,7 +222,9 @@ TEST_F(PrometheusFileExporterTest, SkippedExportIncrementsCounter) { // guarantee that one export is skipped. auto [promise, future] = makePromiseFuture(); std::unique_ptr exporter = - makeExporter(/*options=*/{.testOnlyFailpointCallback = [&future]() { future.wait(); }}); + makeExporter(/*options=*/{.testOnlyFailpointCallback = [&future]() { + future.wait(); + }}); FailPointEnableBlock fp("metricsPrometheusFileExporterThreadCallback", BSON("UnlockOnly" << true)); @@ -493,8 +495,9 @@ TEST_F(PrometheusFileExporterTest, ExactlyMaxConsecutiveSkipsIsOk) { // The writer thread blocks on this future. auto [promise, future] = makePromiseFuture(); std::unique_ptr exporter = makeExporter( - /*options=*/{.maxConsecutiveFailures = 3, - .testOnlyFailpointCallback = [&future]() { future.wait(); }}); + /*options=*/{.maxConsecutiveFailures = 3, .testOnlyFailpointCallback = [&future]() { + future.wait(); + }}); FailPointEnableBlock fp("metricsPrometheusFileExporterThreadCallback", BSON("UnlockOnly" << true)); @@ -514,8 +517,9 @@ DEATH_TEST_F(PrometheusFileExporterDeathTest, // The writer thread blocks on this future. auto [promise, future] = makePromiseFuture(); std::unique_ptr exporter = makeExporter( - /*options=*/{.maxConsecutiveFailures = 3, - .testOnlyFailpointCallback = [&future]() { future.wait(); }}); + /*options=*/{.maxConsecutiveFailures = 3, .testOnlyFailpointCallback = [&future]() { + future.wait(); + }}); FailPointEnableBlock fp("metricsPrometheusFileExporterThreadCallback", BSON("UnlockOnly" << true)); diff --git a/src/mongo/rpc/metadata/client_metadata.h b/src/mongo/rpc/metadata/client_metadata.h index 1bc58cee623..087acb52ae1 100644 --- a/src/mongo/rpc/metadata/client_metadata.h +++ b/src/mongo/rpc/metadata/client_metadata.h @@ -370,7 +370,9 @@ private: // See documentWithoutMongosInfo(). Deferred _documentWithoutMongosInfo{ - [](const BSONObj& fullDocument) { return fullDocument.removeField("mongos"); }}; + [](const BSONObj& fullDocument) { + return fullDocument.removeField("mongos"); + }}; // See hashWithoutMongosInfo(). Deferred _hashWithoutMongos{simpleHash}; diff --git a/src/mongo/s/query/document_source_visitor_docs_needed_bounds.cpp b/src/mongo/s/query/document_source_visitor_docs_needed_bounds.cpp index eb9b7b53eb1..26b2a128676 100644 --- a/src/mongo/s/query/document_source_visitor_docs_needed_bounds.cpp +++ b/src/mongo/s/query/document_source_visitor_docs_needed_bounds.cpp @@ -38,6 +38,7 @@ void visit(DocsNeededBoundsContext* ctx, const T&) { } const ServiceContext::ConstructorActionRegisterer DocsNeededBoundsRegisterer{ - "DocsNeededBoundsRegistererMongos", - [](ServiceContext* service) { registerMongosVisitor(service); }}; + "DocsNeededBoundsRegistererMongos", [](ServiceContext* service) { + registerMongosVisitor(service); + }}; } // namespace mongo diff --git a/src/mongo/s/write_ops/batched_command_request.cpp b/src/mongo/s/write_ops/batched_command_request.cpp index b84ec3889d1..d4feddf222d 100644 --- a/src/mongo/s/write_ops/batched_command_request.cpp +++ b/src/mongo/s/write_ops/batched_command_request.cpp @@ -156,7 +156,9 @@ void BatchedCommandRequest::unsetLegacyRuntimeConstants() { _visit(OverloadedVisitor{ [](write_ops::InsertCommandRequest&) {}, [&](write_ops::UpdateCommandRequest& op) { op.setLegacyRuntimeConstants(boost::none); }, - [&](write_ops::DeleteCommandRequest& op) { op.setLegacyRuntimeConstants(boost::none); }}); + [&](write_ops::DeleteCommandRequest& op) { + op.setLegacyRuntimeConstants(boost::none); + }}); } const boost::optional& BatchedCommandRequest::getLegacyRuntimeConstants() @@ -193,7 +195,9 @@ const boost::optional& BatchedCommandRequest::getLet() const { void BatchedCommandRequest::setLet(boost::optional value) { _visit(OverloadedVisitor{[&](write_ops::InsertCommandRequest& op) {}, [&](write_ops::UpdateCommandRequest& op) { op.setLet(value); }, - [&](write_ops::DeleteCommandRequest& op) { op.setLet(value); }}); + [&](write_ops::DeleteCommandRequest& op) { + op.setLet(value); + }}); } void BatchedCommandRequest::evaluateAndReplaceLetParams(OperationContext* opCtx) { diff --git a/src/mongo/s/write_ops/write_command_ref.cpp b/src/mongo/s/write_ops/write_command_ref.cpp index 3ba50560f88..3554b2ee382 100644 --- a/src/mongo/s/write_ops/write_command_ref.cpp +++ b/src/mongo/s/write_ops/write_command_ref.cpp @@ -203,7 +203,9 @@ const BSONObj& BatchWriteCommandRefImpl::getFilter(int index) const { index, OverloadedVisitor{ [&](const write_ops::UpdateOpEntry& updateOp) -> RetT { return updateOp.getQ(); }, - [&](const write_ops::DeleteOpEntry& deleteOp) -> RetT { return deleteOp.getQ(); }}); + [&](const write_ops::DeleteOpEntry& deleteOp) -> RetT { + return deleteOp.getQ(); + }}); } const BSONObj& BatchWriteCommandRefImpl::getHint(int index) const { @@ -212,7 +214,9 @@ const BSONObj& BatchWriteCommandRefImpl::getHint(int index) const { index, OverloadedVisitor{ [&](const write_ops::UpdateOpEntry& updateOp) -> RetT { return updateOp.getHint(); }, - [&](const write_ops::DeleteOpEntry& deleteOp) -> RetT { return deleteOp.getHint(); }}); + [&](const write_ops::DeleteOpEntry& deleteOp) -> RetT { + return deleteOp.getHint(); + }}); } const BSONObj& BatchWriteCommandRefImpl::getDocument(int index) const { @@ -221,12 +225,14 @@ const BSONObj& BatchWriteCommandRefImpl::getDocument(int index) const { } bool BatchWriteCommandRefImpl::getMulti(int index) const { - return visitOpData( - index, - OverloadedVisitor{ - [&](const BSONObj& insertDoc) { return false; }, - [&](const write_ops::UpdateOpEntry& updateOp) { return updateOp.getMulti(); }, - [&](const write_ops::DeleteOpEntry& deleteOp) { return deleteOp.getMulti(); }}); + return visitOpData(index, + OverloadedVisitor{[&](const BSONObj& insertDoc) { return false; }, + [&](const write_ops::UpdateOpEntry& updateOp) { + return updateOp.getMulti(); + }, + [&](const write_ops::DeleteOpEntry& deleteOp) { + return deleteOp.getMulti(); + }}); } const NamespaceString& BatchWriteCommandRefImpl::getNss(int index) const { @@ -264,12 +270,14 @@ const write_ops::UpdateModification& BatchWriteCommandRefImpl::getUpdateMods(int } bool BatchWriteCommandRefImpl::getUpsert(int index) const { - return visitOpData( - index, - OverloadedVisitor{ - [&](const BSONObj& insertDoc) { return false; }, - [&](const write_ops::UpdateOpEntry& updateOp) { return updateOp.getUpsert(); }, - [&](const write_ops::DeleteOpEntry& deleteOp) { return false; }}); + return visitOpData(index, + OverloadedVisitor{[&](const BSONObj& insertDoc) { return false; }, + [&](const write_ops::UpdateOpEntry& updateOp) { + return updateOp.getUpsert(); + }, + [&](const write_ops::DeleteOpEntry& deleteOp) { + return false; + }}); } OptionalBool BatchWriteCommandRefImpl::getUpsertSupplied(int index) const { @@ -308,16 +316,20 @@ boost::optional BatchWriteCommandRefImpl::getSort(int index) con OverloadedVisitor{ [&](const BSONObj& insertDoc) -> RetT { return boost::none; }, [&](const write_ops::UpdateOpEntry& updateOp) -> RetT { return updateOp.getSort(); }, - [&](const write_ops::DeleteOpEntry& deleteOp) -> RetT { return boost::none; }}); + [&](const write_ops::DeleteOpEntry& deleteOp) -> RetT { + return boost::none; + }}); } BSONObj BatchWriteCommandRefImpl::toBSON(int index) const { - return visitOpData( - index, - OverloadedVisitor{ - [&](const BSONObj& insertDoc) { return insertDoc; }, - [&](const write_ops::UpdateOpEntry& updateOp) { return updateOp.toBSON(); }, - [&](const write_ops::DeleteOpEntry& deleteOp) { return deleteOp.toBSON(); }}); + return visitOpData(index, + OverloadedVisitor{[&](const BSONObj& insertDoc) { return insertDoc; }, + [&](const write_ops::UpdateOpEntry& updateOp) { + return updateOp.toBSON(); + }, + [&](const write_ops::DeleteOpEntry& deleteOp) { + return deleteOp.toBSON(); + }}); } int BulkWriteCommandRefImpl::estimateOpSizeInBytes(int index) const { @@ -377,7 +389,9 @@ const boost::optional& BulkWriteCommandRefImpl::getCollation(int index) OverloadedVisitor{ [&](const BulkWriteInsertOp& insertOp) -> RetT { return kMissingBSONObj; }, [&](const BulkWriteUpdateOp& updateOp) -> RetT { return updateOp.getCollation(); }, - [&](const BulkWriteDeleteOp& deleteOp) -> RetT { return deleteOp.getCollation(); }}); + [&](const BulkWriteDeleteOp& deleteOp) -> RetT { + return deleteOp.getCollation(); + }}); } boost::optional BulkWriteCommandRefImpl::getConstants(int index) const { @@ -392,7 +406,9 @@ const BSONObj& BulkWriteCommandRefImpl::getFilter(int index) const { index, OverloadedVisitor{ [&](const BulkWriteUpdateOp& updateOp) -> RetT { return updateOp.getFilter(); }, - [&](const BulkWriteDeleteOp& deleteOp) -> RetT { return deleteOp.getFilter(); }}); + [&](const BulkWriteDeleteOp& deleteOp) -> RetT { + return deleteOp.getFilter(); + }}); } boost::optional BulkWriteCommandRefImpl::getSampleId(int index) const { @@ -401,7 +417,9 @@ boost::optional BulkWriteCommandRefImpl::getSampleId(int index) const { index, OverloadedVisitor{ [&](const BulkWriteUpdateOp& updateOp) -> RetT { return updateOp.getSampleId(); }, - [&](const BulkWriteDeleteOp& deleteOp) -> RetT { return deleteOp.getSampleId(); }}); + [&](const BulkWriteDeleteOp& deleteOp) -> RetT { + return deleteOp.getSampleId(); + }}); } const BSONObj& BulkWriteCommandRefImpl::getHint(int index) const { @@ -410,7 +428,9 @@ const BSONObj& BulkWriteCommandRefImpl::getHint(int index) const { index, OverloadedVisitor{ [&](const BulkWriteUpdateOp& updateOp) -> RetT { return updateOp.getHint(); }, - [&](const BulkWriteDeleteOp& deleteOp) -> RetT { return deleteOp.getHint(); }}); + [&](const BulkWriteDeleteOp& deleteOp) -> RetT { + return deleteOp.getHint(); + }}); } const BSONObj& BulkWriteCommandRefImpl::getDocument(int index) const { @@ -424,7 +444,9 @@ bool BulkWriteCommandRefImpl::getMulti(int index) const { index, OverloadedVisitor{[&](const BulkWriteInsertOp& insertOp) { return false; }, [&](const BulkWriteUpdateOp& updateOp) { return updateOp.getMulti(); }, - [&](const BulkWriteDeleteOp& deleteOp) { return deleteOp.getMulti(); }}); + [&](const BulkWriteDeleteOp& deleteOp) { + return deleteOp.getMulti(); + }}); } const NamespaceString& BulkWriteCommandRefImpl::getNss(int index) const { @@ -445,7 +467,9 @@ BatchedCommandRequest::BatchType BulkWriteCommandRefImpl::getOpType(int index) c OverloadedVisitor{ [&](const BulkWriteInsertOp&) { return BatchedCommandRequest::BatchType_Insert; }, [&](const BulkWriteUpdateOp&) { return BatchedCommandRequest::BatchType_Update; }, - [&](const BulkWriteDeleteOp&) { return BatchedCommandRequest::BatchType_Delete; }}); + [&](const BulkWriteDeleteOp&) { + return BatchedCommandRequest::BatchType_Delete; + }}); } const write_ops::UpdateModification& BulkWriteCommandRefImpl::getUpdateMods(int index) const { @@ -477,7 +501,9 @@ bool BulkWriteCommandRefImpl::getUpsert(int index) const { index, OverloadedVisitor{[&](const BulkWriteInsertOp& insertOp) { return false; }, [&](const BulkWriteUpdateOp& updateOp) { return updateOp.getUpsert(); }, - [&](const BulkWriteDeleteOp& deleteOp) { return false; }}); + [&](const BulkWriteDeleteOp& deleteOp) { + return false; + }}); } const boost::optional& @@ -496,7 +522,9 @@ boost::optional BulkWriteCommandRefImpl::getSort(int index) cons OverloadedVisitor{ [&](const BulkWriteInsertOp& insertOp) -> RetT { return boost::none; }, [&](const BulkWriteUpdateOp& updateOp) -> RetT { return updateOp.getSort(); }, - [&](const BulkWriteDeleteOp& deleteOp) -> RetT { return boost::none; }}); + [&](const BulkWriteDeleteOp& deleteOp) -> RetT { + return boost::none; + }}); } BSONObj BulkWriteCommandRefImpl::toBSON(int index) const { diff --git a/src/mongo/stdx/sigaltstack_location_test.cpp b/src/mongo/stdx/sigaltstack_location_test.cpp index a8d9bd9cb92..b4161725f29 100644 --- a/src/mongo/stdx/sigaltstack_location_test.cpp +++ b/src/mongo/stdx/sigaltstack_location_test.cpp @@ -218,7 +218,9 @@ int recursionTestImpl(bool useSigAltStack) { void* deepestAddress; const std::function recur; }; - MostlyInfiniteRecursion recursion = {0, &recursion, [&] { recursion.run(); }}; + MostlyInfiniteRecursion recursion = {0, &recursion, [&] { + recursion.run(); + }}; // When the signal handler fires, it will return to this sigsetjmp call, causing // it to return a nonzero value. This makes the child thread viable again, and diff --git a/src/mongo/transport/asio/asio_transport_layer_test.cpp b/src/mongo/transport/asio/asio_transport_layer_test.cpp index a21e0adf686..7886cc725c4 100644 --- a/src/mongo/transport/asio/asio_transport_layer_test.cpp +++ b/src/mongo/transport/asio/asio_transport_layer_test.cpp @@ -126,7 +126,9 @@ class ConnectionThread { public: explicit ConnectionThread(int port) : ConnectionThread(port, nullptr) {} ConnectionThread(int port, std::function onConnect) - : _port{port}, _onConnect{std::move(onConnect)}, _thread{[this] { _run(); }} {} + : _port{port}, _onConnect{std::move(onConnect)}, _thread{[this] { + _run(); + }} {} ~ConnectionThread() { LOGV2(6109500, "connection: Tx stop request"); @@ -1064,7 +1066,9 @@ TEST(AsioTransportLayer, EgressConnectionResetByPeerDuringSessionCtor) { conn->socket.close(); fp.reset(); }); - test::JoinThread ioThread{[&] { ioContext.run(); }}; + test::JoinThread ioThread{[&] { + ioContext.run(); + }}; ScopeGuard ioContextStop = [&] { ioContext.stop(); }; @@ -1102,7 +1106,9 @@ TEST(AsioTransportLayer, ConfirmSocketSetOptionOnResetConnections) { sleepFor(Seconds{1}); accepted.set(true); }); - test::JoinThread ioThread{[&] { ioContext.run(); }}; + test::JoinThread ioThread{[&] { + ioContext.run(); + }}; ScopeGuard ioContextStop = [&] { ioContext.stop(); }; diff --git a/src/mongo/transport/test_fixtures.h b/src/mongo/transport/test_fixtures.h index 932c1a0bc6e..c6a1663ddf3 100644 --- a/src/mongo/transport/test_fixtures.h +++ b/src/mongo/transport/test_fixtures.h @@ -82,7 +82,9 @@ struct MONGO_MOD_NEEDS_REPLACEMENT SessionThread { struct StopException {}; explicit SessionThread(std::shared_ptr s) - : _session{std::move(s)}, _thread{[this] { _run(); }} {} + : _session{std::move(s)}, _thread{[this] { + _run(); + }} {} ~SessionThread() { if (!_thread.joinable()) diff --git a/src/mongo/unittest/thread_assertion_monitor.h b/src/mongo/unittest/thread_assertion_monitor.h index 549fdbd05bb..33f2c38683a 100644 --- a/src/mongo/unittest/thread_assertion_monitor.h +++ b/src/mongo/unittest/thread_assertion_monitor.h @@ -63,7 +63,9 @@ public: /** Spawn and return a `stdx::thread` that invokes `f` as if by `exec(f)`. */ template stdx::thread spawn(F&& f) { - return stdx::thread{[this, f = std::move(f)]() mutable { exec(std::move(f)); }}; + return stdx::thread{[this, f = std::move(f)]() mutable { + exec(std::move(f)); + }}; } /** Spawn a thread that will invoke monitor.notifyDone()` when it finishes. */ diff --git a/src/mongo/unittest/thread_assertion_monitor_test.cpp b/src/mongo/unittest/thread_assertion_monitor_test.cpp index ca536d7cf69..20dabae4287 100644 --- a/src/mongo/unittest/thread_assertion_monitor_test.cpp +++ b/src/mongo/unittest/thread_assertion_monitor_test.cpp @@ -60,7 +60,9 @@ TEST(ThreadAssertionMonitor, Trivial) { TEST(ThreadAssertionMonitor, ControllerInStdxThread) { ThreadAssertionMonitor monitor; - stdx::thread{[&] { monitor.notifyDone(); }}.join(); + stdx::thread{[&] { + monitor.notifyDone(); + }}.join(); } TEST(ThreadAssertionMonitor, OnlyControllerInSpawn) { diff --git a/src/mongo/util/background.cpp b/src/mongo/util/background.cpp index 50d5aaf1258..28f4bb8f964 100644 --- a/src/mongo/util/background.cpp +++ b/src/mongo/util/background.cpp @@ -178,7 +178,9 @@ void BackgroundJob::go() { // If the job is already 'done', for instance because it was cancelled or already // finished, ignore additional requests to run the job. if (_status->state == NotStarted) { - stdx::thread{[this] { jobBody(); }}.detach(); + stdx::thread{[this] { + jobBody(); + }}.detach(); _status->state = Running; } } diff --git a/src/mongo/util/functional.h b/src/mongo/util/functional.h index 25a3460e59b..23070340fdb 100644 --- a/src/mongo/util/functional.h +++ b/src/mongo/util/functional.h @@ -286,7 +286,7 @@ struct UFDeductionHelper {}; template struct UFDeductionHelper : std::type_identity {}; template -struct UFDeductionHelper : std::type_identity {}; +struct UFDeductionHelper : std::type_identity {}; template struct UFDeductionHelper : std::type_identity {}; template diff --git a/src/mongo/util/functional_test.cpp b/src/mongo/util/functional_test.cpp index 987779787cb..99f8ef7decb 100644 --- a/src/mongo/util/functional_test.cpp +++ b/src/mongo/util/functional_test.cpp @@ -120,7 +120,9 @@ TEST(UniqueFunctionTest, construct_simple_unique_function_from_lambda) { // Explicit construction { RunDetection<0> runDetection; - mongo::unique_function uf{[] { RunDetection<0>::itRan = true; }}; + mongo::unique_function uf{[] { + RunDetection<0>::itRan = true; + }}; uf(); diff --git a/src/mongo/util/future_test_shared_future.cpp b/src/mongo/util/future_test_shared_future.cpp index 9f449cbb27a..07ad6ce2114 100644 --- a/src/mongo/util/future_test_shared_future.cpp +++ b/src/mongo/util/future_test_shared_future.cpp @@ -304,7 +304,9 @@ using unittest::JoinThread; TEST(SharedFuture, ConcurrentTest_Simple) { SharedPromise promise; auto shared = promise.getFuture(); - JoinThread thread{stdx::thread{[&] { shared.get(); }}}; + JoinThread thread{stdx::thread{[&] { + shared.get(); + }}}; std::this_thread::yield(); // Slightly increase the chance of racing. promise.emplaceValue(); } diff --git a/src/mongo/util/future_util.h b/src/mongo/util/future_util.h index 49a050583db..7ac29e9c575 100644 --- a/src/mongo/util/future_util.h +++ b/src/mongo/util/future_util.h @@ -619,8 +619,9 @@ public: ExtractRetryParameters extractRetryParameters = {}) && { using ReturnType = FutureContinuationResult; - return mongo::AsyncTry{ - [body = std::move(_body), strategy] { return body(strategy->getTargetingMetadata()); }} + return mongo::AsyncTry{[body = std::move(_body), strategy] { + return body(strategy->getTargetingMetadata()); + }} .until([strategy, extractRetryParameters = std::move(extractRetryParameters)]( const StatusOrStatusWith& swResult) { auto result = extractRetryParameters(swResult); diff --git a/src/mongo/util/inline_memory_test.cpp b/src/mongo/util/inline_memory_test.cpp index 53a337a0cf1..a50a61d133e 100644 --- a/src/mongo/util/inline_memory_test.cpp +++ b/src/mongo/util/inline_memory_test.cpp @@ -82,7 +82,9 @@ public: std::vector> upstreamDeallocations; MockResource<> mockResource{ [&](void* p, size_t sz, size_t al) { upstreamAllocations.push_back({p, sz, al}); }, - [&](void* p, size_t sz, size_t al) { upstreamDeallocations.push_back({p, sz, al}); }}; + [&](void* p, size_t sz, size_t al) { + upstreamDeallocations.push_back({p, sz, al}); + }}; }; TEST_F(MonotonicBufferResourceTest, UpstreamAllocationsReduced) { diff --git a/src/mongo/util/lockable_adapter.h b/src/mongo/util/lockable_adapter.h index 74d7120ad35..d897ccef372 100644 --- a/src/mongo/util/lockable_adapter.h +++ b/src/mongo/util/lockable_adapter.h @@ -69,7 +69,9 @@ private: template static inline VTable forT = VTable{+[](void* t) { static_cast(t)->lock(); }, - +[](void* t) { static_cast(t)->unlock(); }}; + +[](void* t) { + static_cast(t)->unlock(); + }}; void* _underlyingLock; const VTable* _vtable; diff --git a/src/mongo/util/net/ssl_types.h b/src/mongo/util/net/ssl_types.h index 6ecc86ca518..79ca4e07107 100644 --- a/src/mongo/util/net/ssl_types.h +++ b/src/mongo/util/net/ssl_types.h @@ -144,7 +144,9 @@ public: bool containsClusterMembershipConfig = false; bool containsOverrideClusterMembershipConfig = false; auto visitor = OverloadedVisitor{[](const SSLX509Name&) { return false; }, - [](const std::string&) { return true; }}; + [](const std::string&) { + return true; + }}; if (_clusterAuthX509Config._configCriteria) { containsClusterMembershipConfig = diff --git a/src/mongo/util/packaged_task.h b/src/mongo/util/packaged_task.h index 763ac5f78be..9899f871753 100644 --- a/src/mongo/util/packaged_task.h +++ b/src/mongo/util/packaged_task.h @@ -53,7 +53,7 @@ struct SigHelper : std::type_identity {}; template struct SigHelper : std::type_identity {}; template -struct SigHelper : std::type_identity {}; +struct SigHelper : std::type_identity {}; template struct SigHelper : std::type_identity {}; template diff --git a/src/mongo/util/processinfo_linux.cpp b/src/mongo/util/processinfo_linux.cpp index eb7563570c7..5b821a9e41b 100644 --- a/src/mongo/util/processinfo_linux.cpp +++ b/src/mongo/util/processinfo_linux.cpp @@ -525,15 +525,20 @@ public: }; std::set cpuIds(cmp); - CpuInfoParser cpuInfoParser{ - { - {"physical id", [&](const std::string& value) { parsedCpuId.physical = value; }}, - {"core id", [&](const std::string& value) { parsedCpuId.core = value; }}, - }, - [&]() { - cpuIds.insert(parsedCpuId); - parsedCpuId = CpuId{}; - }}; + CpuInfoParser cpuInfoParser{{ + {"physical id", + [&](const std::string& value) { + parsedCpuId.physical = value; + }}, + {"core id", + [&](const std::string& value) { + parsedCpuId.core = value; + }}, + }, + [&]() { + cpuIds.insert(parsedCpuId); + parsedCpuId = CpuId{}; + }}; cpuInfoParser.run(); physicalCores = cpuIds.size(); @@ -545,11 +550,14 @@ public: static int getNumCpuSockets() { std::set socketIds; - CpuInfoParser cpuInfoParser{ - { - {"physical id", [&](const std::string& value) { socketIds.insert(value); }}, - }, - []() {}}; + CpuInfoParser cpuInfoParser{{ + {"physical id", + [&](const std::string& value) { + socketIds.insert(value); + }}, + }, + []() { + }}; cpuInfoParser.run(); // On ARM64, the "physical id" field is unpopulated, causing there to be 0 sockets found. In @@ -572,25 +580,61 @@ public: procCount = 0; - CpuInfoParser cpuInfoParser{ - { + CpuInfoParser cpuInfoParser{{ #ifdef __s390x__ - {R"re(processor\s+\d+)re", [&](const std::string& value) { procCount++; }}, - {"cpu MHz static", [&](const std::string& value) { freq = value; }}, - {"features", [&](const std::string& value) { features = value; }}, + {R"re(processor\s+\d+)re", + [&](const std::string& value) { + procCount++; + }}, + {"cpu MHz static", + [&](const std::string& value) { + freq = value; + }}, + {"features", + [&](const std::string& value) { + features = value; + }}, #else - {"processor", [&](const std::string& value) { procCount++; }}, - {"model name", [&](const std::string& value) { modelString = value; }}, - {"cpu MHz", [&](const std::string& value) { freq = value; }}, - {"flags", [&](const std::string& value) { features = value; }}, - {"CPU implementer", [&](const std::string& value) { cpuImplementer = value; }}, - {"CPU architecture", [&](const std::string& value) { cpuArchitecture = value; }}, - {"CPU variant", [&](const std::string& value) { cpuVariant = value; }}, - {"CPU part", [&](const std::string& value) { cpuPart = value; }}, - {"CPU revision", [&](const std::string& value) { cpuRevision = value; }}, + {"processor", + [&](const std::string& value) { + procCount++; + }}, + {"model name", + [&](const std::string& value) { + modelString = value; + }}, + {"cpu MHz", + [&](const std::string& value) { + freq = value; + }}, + {"flags", + [&](const std::string& value) { + features = value; + }}, + {"CPU implementer", + [&](const std::string& value) { + cpuImplementer = value; + }}, + {"CPU architecture", + [&](const std::string& value) { + cpuArchitecture = value; + }}, + {"CPU variant", + [&](const std::string& value) { + cpuVariant = value; + }}, + {"CPU part", + [&](const std::string& value) { + cpuPart = value; + }}, + {"CPU revision", + [&](const std::string& value) { + cpuRevision = value; + }}, #endif - }, - []() {}}; + }, + []() { + }}; cpuInfoParser.run(); } diff --git a/src/mongo/util/producer_consumer_queue_test.cpp b/src/mongo/util/producer_consumer_queue_test.cpp index a5106d58f2c..ab5b69e832a 100644 --- a/src/mongo/util/producer_consumer_queue_test.cpp +++ b/src/mongo/util/producer_consumer_queue_test.cpp @@ -234,7 +234,7 @@ private: __VA_ARGS__(name##CB{}); \ } \ template \ - void name##CB::operator()(Helper&& helper) + void name##CB::operator()(Helper && helper) PRODUCER_CONSUMER_QUEUE_TEST(basicPushPop, runPermutations) { typename Helper::template ProducerConsumerQueue pcq{}; diff --git a/src/mongo/util/stacktrace_test.cpp b/src/mongo/util/stacktrace_test.cpp index f3449b4c1a9..49aec99330e 100644 --- a/src/mongo/util/stacktrace_test.cpp +++ b/src/mongo/util/stacktrace_test.cpp @@ -728,7 +728,9 @@ TEST_F(PrintAllThreadStacksTest, SessionBasic) { stacktrace_details::PrintAllStacksSession session; auto waiter = boost::make_optional(session.waiter()); - stdx::thread producer{[&] { auto notifier = session.notifier(); }}; + stdx::thread producer{[&] { + auto notifier = session.notifier(); + }}; waiter = {}; producer.join(); } diff --git a/src/mongo/util/tracing_profiler/internal/profiler_internal.cpp b/src/mongo/util/tracing_profiler/internal/profiler_internal.cpp index e013fafbb53..7149f4f0b4f 100644 --- a/src/mongo/util/tracing_profiler/internal/profiler_internal.cpp +++ b/src/mongo/util/tracing_profiler/internal/profiler_internal.cpp @@ -65,7 +65,9 @@ ProfilerTag ProfilerTags::getOrInsertTag(StringData name) { size_t CallTree::ChildrenMap::size() const { return std::visit( OverloadedVisitor{[](const ChildrenInlinedMap& map) -> size_t { return map.size; }, - [](const ChildrenHashMap& map) -> size_t { return map.size(); }}, + [](const ChildrenHashMap& map) -> size_t { + return map.size(); + }}, *this); } diff --git a/src/mongo/util/tracing_profiler/profiler_test.cpp b/src/mongo/util/tracing_profiler/profiler_test.cpp index 0c814a161e8..a5eaddda9d2 100644 --- a/src/mongo/util/tracing_profiler/profiler_test.cpp +++ b/src/mongo/util/tracing_profiler/profiler_test.cpp @@ -48,7 +48,9 @@ CallTree::ChildrenHashMap getChildren(const CallTree::Node& node) { } return r; }, - [](const CallTree::ChildrenHashMap& map) { return map; }}, + [](const CallTree::ChildrenHashMap& map) { + return map; + }}, node.children); } diff --git a/src/mongo/watchdog/watchdog_test.cpp b/src/mongo/watchdog/watchdog_test.cpp index 89202bf1a80..8e7841798f0 100644 --- a/src/mongo/watchdog/watchdog_test.cpp +++ b/src/mongo/watchdog/watchdog_test.cpp @@ -220,7 +220,8 @@ public: #if __has_feature(thread_sanitizer) __attribute__((no_sanitize("thread"))) #endif - void setSignalOnCount(int c) { + void + setSignalOnCount(int c) { _wait = c; }