Revert "SERVER-105043 LLVM 22 lint and format"
GitOrigin-RevId: 0244d545e453b3f667051f71ca643a821afaf84b
This commit is contained in:
parent
a8826bd5d7
commit
bd87181dd2
4
MODULE.bazel.lock
generated
4
MODULE.bazel.lock
generated
@ -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": {},
|
||||
|
||||
@ -426,12 +426,29 @@ TEST(Ostream, StringDataMatchesStdString) {
|
||||
std::function<void(std::ostream&)> 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<void(std::ostream&)> 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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -1196,11 +1196,12 @@ typename BSONColumnBuilder<Allocator>::BinaryDiff BSONColumnBuilder<Allocator>::
|
||||
// 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) {
|
||||
visit(OverloadedVisitor{[](const typename InternalState::Regular& regular) {
|
||||
return regular._controlByteOffset;
|
||||
},
|
||||
[](const typename InternalState::Interleaved&) { return kNoSimple8bControl; }},
|
||||
[](const typename InternalState::Interleaved&) {
|
||||
return kNoSimple8bControl;
|
||||
}},
|
||||
_is.state);
|
||||
uint8_t lastControlByte =
|
||||
controlOffset != kNoSimple8bControl ? *(_bufBuilder.buf() + controlOffset) : 0;
|
||||
@ -1347,7 +1348,9 @@ BSONElement BSONColumnBuilder<Allocator>::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);
|
||||
}
|
||||
|
||||
|
||||
@ -549,8 +549,8 @@ public:
|
||||
RetryBudget& budget,
|
||||
RetryCriteria retryCriteria = defaultRetryCriteria,
|
||||
RetryParameters parameters = DefaultRetryStrategy::getRetryParametersFromServerParameters())
|
||||
: _underlyingStrategy{
|
||||
std::make_unique<DefaultRetryStrategy>(std::move(retryCriteria), parameters)},
|
||||
: _underlyingStrategy{std::make_unique<DefaultRetryStrategy>(std::move(retryCriteria),
|
||||
parameters)},
|
||||
_budget{&budget} {}
|
||||
|
||||
/**
|
||||
|
||||
@ -43,8 +43,9 @@ const auto getIngressAdmissionController =
|
||||
ServiceContext::declareDecoration<IngressAdmissionController>();
|
||||
|
||||
const ConstructorActionRegistererType<ServiceContext> onServiceContextCreate{
|
||||
"InitIngressAdmissionController",
|
||||
[](ServiceContext* ctx) { getIngressAdmissionController(ctx).init(); }};
|
||||
"InitIngressAdmissionController", [](ServiceContext* ctx) {
|
||||
getIngressAdmissionController(ctx).init();
|
||||
}};
|
||||
} // namespace
|
||||
|
||||
void IngressAdmissionController::init() {
|
||||
|
||||
@ -56,8 +56,9 @@ const auto getIngressRequestRateLimiter =
|
||||
ServiceContext::declareDecoration<boost::optional<IngressRequestRateLimiter>>();
|
||||
|
||||
const ConstructorActionRegistererType<ServiceContext> onServiceContextCreate{
|
||||
"InitIngressRequestRateLimiter",
|
||||
[](ServiceContext* ctx) { getIngressRequestRateLimiter(ctx).emplace(); }};
|
||||
"InitIngressRequestRateLimiter", [](ServiceContext* ctx) {
|
||||
getIngressRequestRateLimiter(ctx).emplace();
|
||||
}};
|
||||
|
||||
class ClientAdmissionControlState {
|
||||
public:
|
||||
|
||||
@ -49,8 +49,9 @@ void rotateAuditLog() {}
|
||||
namespace {
|
||||
const auto getAuditInterface = ServiceContext::declareDecoration<std::unique_ptr<AuditInterface>>();
|
||||
ServiceContext::ConstructorActionRegisterer registerCreateNoopAudit{
|
||||
"initializeNoopAuditInterface",
|
||||
[](ServiceContext* svcCtx) { AuditInterface::set(svcCtx, std::make_unique<AuditNoOp>()); }};
|
||||
"initializeNoopAuditInterface", [](ServiceContext* svcCtx) {
|
||||
AuditInterface::set(svcCtx, std::make_unique<AuditNoOp>());
|
||||
}};
|
||||
} // namespace
|
||||
|
||||
AuditInterface* AuditInterface::get(ServiceContext* service) {
|
||||
|
||||
@ -433,8 +433,9 @@ std::unique_ptr<DbCheckRun> 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<DbCheckRun>();
|
||||
result->push_back(info);
|
||||
return result;
|
||||
@ -471,8 +472,9 @@ std::unique_ptr<DbCheckRun> 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;
|
||||
};
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -36,7 +36,9 @@ namespace {
|
||||
|
||||
VersionedExtension makeTestVersionedExtension(uint32_t major, uint32_t minor) {
|
||||
return VersionedExtension{::MongoExtensionAPIVersion{major, minor},
|
||||
[]() -> std::unique_ptr<sdk::Extension> { return nullptr; }};
|
||||
[]() -> std::unique_ptr<sdk::Extension> {
|
||||
return nullptr;
|
||||
}};
|
||||
}
|
||||
|
||||
class VersionedExtensionGreaterComparatorTest : public unittest::Test {
|
||||
|
||||
@ -127,7 +127,9 @@ public:
|
||||
*/
|
||||
void waitForOngoingCoordinatorsToFinish(OperationContext* opCtx,
|
||||
std::function<bool(const ShardingCoordinator&)> pred = {
|
||||
[](const ShardingCoordinator&) { return true; }});
|
||||
[](const ShardingCoordinator&) {
|
||||
return true;
|
||||
}});
|
||||
|
||||
void waitForRecovery(OperationContext* opCtx) const override;
|
||||
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -408,7 +408,8 @@ TEST_F(IndexAccessMethodBulkBuilder, CommitRejectsZeroInterval) {
|
||||
}},
|
||||
IndexAccessMethod::RecordIdHandlerFn{},
|
||||
IndexAccessMethod::YieldFn{},
|
||||
IndexAccessMethod::OnNKeysLoadedFn{[]() {}},
|
||||
IndexAccessMethod::OnNKeysLoadedFn{[]() {
|
||||
}},
|
||||
/*onNKeysLoadedFnInterval=*/0,
|
||||
/*keyBatchSize=*/1,
|
||||
/*keyBatchBytes=*/1024),
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -215,8 +215,9 @@ void buildUpdateDescriptionWithDeltaOplog(
|
||||
|
||||
while (auto nextSubDiff = reader->nextSubDiff()) {
|
||||
std::variant<DocumentDiffReader*, ArrayDiffReader*> nextReader;
|
||||
visit(
|
||||
OverloadedVisitor{[&nextReader](auto& reader) { nextReader = &reader; }},
|
||||
visit(OverloadedVisitor{[&nextReader](auto& reader) {
|
||||
nextReader = &reader;
|
||||
}},
|
||||
nextSubDiff->second);
|
||||
buildUpdateDescriptionWithDeltaOplog(
|
||||
nextReader, builder, {{nextSubDiff->first}});
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -102,8 +102,9 @@ public:
|
||||
OwningDistributedPlanContext(std::unique_ptr<Pipeline> pipelinePrefix,
|
||||
std::unique_ptr<Pipeline> pipelineSuffix,
|
||||
boost::optional<OrderedPathSet> 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)) {}
|
||||
|
||||
@ -1372,8 +1372,9 @@ private:
|
||||
boost::optional<query_settings::QuerySettings> _querySettings = boost::none;
|
||||
|
||||
DeferredFn<QueryKnobConfiguration, const query_settings::QuerySettings&>
|
||||
_queryKnobConfiguration{
|
||||
[](const auto& querySettings) { return QueryKnobConfiguration(querySettings); }};
|
||||
_queryKnobConfiguration{[](const auto& querySettings) {
|
||||
return QueryKnobConfiguration(querySettings);
|
||||
}};
|
||||
|
||||
Deferred<bool (*)(const VersionContext&)> _featureFlagShardFilteringDistinctScan{
|
||||
[](const VersionContext& vCtx) {
|
||||
|
||||
@ -1824,9 +1824,9 @@ std::unique_ptr<Pipeline> targetShardsAndAddMergeCursors(
|
||||
bool useCollectionDefaultCollator) {
|
||||
auto&& aggRequestPipelinePair = [&] {
|
||||
return visit(
|
||||
OverloadedVisitor{
|
||||
[&](std::unique_ptr<Pipeline>&& pipeline) {
|
||||
return std::make_pair(AggregateCommandRequest(expCtx->getNamespaceString(),
|
||||
OverloadedVisitor{[&](std::unique_ptr<Pipeline>&& pipeline) {
|
||||
return std::make_pair(
|
||||
AggregateCommandRequest(expCtx->getNamespaceString(),
|
||||
pipeline->serializeToBson()),
|
||||
std::move(pipeline));
|
||||
},
|
||||
@ -1838,7 +1838,9 @@ std::unique_ptr<Pipeline> targetShardsAndAddMergeCursors(
|
||||
rawPipeline, expCtx, pipeline_factory::kOptionsMinimal));
|
||||
},
|
||||
[&](std::pair<AggregateCommandRequest, std::unique_ptr<Pipeline>>&&
|
||||
aggRequestPipelinePair) { return std::move(aggRequestPipelinePair); }},
|
||||
aggRequestPipelinePair) {
|
||||
return std::move(aggRequestPipelinePair);
|
||||
}},
|
||||
std::move(targetRequest));
|
||||
}();
|
||||
const auto& aggRequest = aggRequestPipelinePair.first;
|
||||
|
||||
@ -76,7 +76,8 @@ using StageParamsToDocumentSourceFn = std::function<std::list<boost::intrusive_p
|
||||
* REGISTER_STAGE_PARAMS_TO_DOCUMENT_SOURCE_MAPPING macro defined in this file.
|
||||
*/
|
||||
MONGO_MOD_PUBLIC // Needed by enterprise hot backup registrations.
|
||||
void registerStageParamsToDocumentSourceFn(StageParams::Id stageParamsId,
|
||||
void
|
||||
registerStageParamsToDocumentSourceFn(StageParams::Id stageParamsId,
|
||||
StageParamsToDocumentSourceFn fn);
|
||||
|
||||
/**
|
||||
|
||||
@ -380,8 +380,9 @@ void visitExtensionStage(DocsNeededBoundsContext* ctx,
|
||||
}
|
||||
|
||||
const ServiceContext::ConstructorActionRegisterer docsNeededBoundsRegisterer{
|
||||
"DocsNeededBoundsRegisterer",
|
||||
[](ServiceContext* service) { registerMongodVisitor<DocsNeededBoundsContext>(service); }};
|
||||
"DocsNeededBoundsRegisterer", [](ServiceContext* service) {
|
||||
registerMongodVisitor<DocsNeededBoundsContext>(service);
|
||||
}};
|
||||
|
||||
|
||||
DocsNeededBounds extractDocsNeededBounds(const DocumentSourceContainer& sources,
|
||||
|
||||
@ -223,9 +223,11 @@ void doProfile(auto opCtx,
|
||||
|
||||
boost::optional<CollectionAcquisition> profileCollection;
|
||||
while (true) {
|
||||
const auto deadline = std::visit(
|
||||
OverloadedVisitor{[&](const NoTimeoutTag&) { return Date_t::max(); },
|
||||
[&](const Milliseconds& millis) { return Date_t::now() + millis; }},
|
||||
const auto deadline =
|
||||
std::visit(OverloadedVisitor{[&](const NoTimeoutTag&) { return Date_t::max(); },
|
||||
[&](const Milliseconds& millis) {
|
||||
return Date_t::now() + millis;
|
||||
}},
|
||||
lockTimeout);
|
||||
|
||||
profileCollection.emplace(acquireCollection(
|
||||
|
||||
@ -158,17 +158,19 @@ BSONObj JoinPlanNodeRegistry::joinPlanNodeToBSON(JoinPlanNodeId nodeId,
|
||||
bob << "cost" << getCost(nodeId).toBSON();
|
||||
}
|
||||
std::visit(
|
||||
OverloadedVisitor{
|
||||
[this, numNodesToPrint, &bob](const JoiningNode& join) {
|
||||
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());
|
||||
<< (str::stream()
|
||||
<< "INDEX_PROBE " << ip.entry->descriptor()->keyPattern());
|
||||
},
|
||||
[&bob](const BaseNode& base) { bob << "accessPath" << base.soln->summaryString(); }},
|
||||
[&bob](const BaseNode& base) {
|
||||
bob << "accessPath" << base.soln->summaryString();
|
||||
}},
|
||||
get(nodeId));
|
||||
return bob.obj();
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -83,7 +83,9 @@ using BSONValue = std::variant<BSONElement, std::reference_wrapper<Value>>;
|
||||
template <typename T>
|
||||
T parseFindPayload(BSONValue payload) {
|
||||
return visit(OverloadedVisitor{[&](BSONElement payload) { return T(payload); },
|
||||
[&](Value payload) { return T(payload); }},
|
||||
[&](Value payload) {
|
||||
return T(payload);
|
||||
}},
|
||||
payload);
|
||||
}
|
||||
|
||||
|
||||
@ -975,9 +975,12 @@ public:
|
||||
CanonicalQuery* cq,
|
||||
PlanYieldPolicy::YieldPolicy policy,
|
||||
std::unique_ptr<QueryPlannerParams> 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 {
|
||||
|
||||
@ -747,8 +747,9 @@ boost::optional<SbBlockAggExprVector> 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,
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -340,9 +340,7 @@ TEST_F(LookupStageBuilderTest, NestedLoopJoin_TopLevelLocalField_Null) {
|
||||
|
||||
std::vector<std::pair<BSONObj, std::vector<BSONObj>>> 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<std::pair<BSONObj, std::vector<BSONObj>>> 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*/}},
|
||||
};
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -556,8 +556,9 @@ inline boost::optional<query_shape::DeferredQueryShape> computeInsertQueryShape(
|
||||
if (wholeOp.getEncryptionInformation()) {
|
||||
return boost::none;
|
||||
}
|
||||
query_shape::DeferredQueryShape deferredShape{
|
||||
[&]() { return shape_helpers::tryMakeShape<query_shape::InsertCmdShape>(wholeOp); }};
|
||||
query_shape::DeferredQueryShape deferredShape{[&]() {
|
||||
return shape_helpers::tryMakeShape<query_shape::InsertCmdShape>(wholeOp);
|
||||
}};
|
||||
return deferredShape;
|
||||
}
|
||||
|
||||
|
||||
@ -192,20 +192,22 @@ public:
|
||||
std::string toString() const {
|
||||
StringBuilder sb;
|
||||
|
||||
visit(OverloadedVisitor{
|
||||
[&sb](const ReplacementUpdate& replacement) {
|
||||
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 << "{type: Pipeline, update: " << Value(pipeline).toString()
|
||||
<< "}";
|
||||
},
|
||||
[&sb](const DeltaUpdate& delta) {
|
||||
sb << "{type: Delta, update: " << delta.diff << "}";
|
||||
},
|
||||
[&sb](const TransformUpdate& transform) { sb << "{type: Transform}"; }},
|
||||
[&sb](const TransformUpdate& transform) {
|
||||
sb << "{type: Transform}";
|
||||
}},
|
||||
_update);
|
||||
|
||||
return sb.str();
|
||||
|
||||
@ -1302,10 +1302,14 @@ const StringMap<ApplyOpMetadata> 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 {
|
||||
|
||||
@ -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, {});
|
||||
|
||||
@ -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 =
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -252,7 +252,8 @@ protected:
|
||||
}
|
||||
|
||||
protected:
|
||||
AutoMergerPolicy _automerger{[]() {}};
|
||||
AutoMergerPolicy _automerger{[]() {
|
||||
}};
|
||||
|
||||
inline const static auto _shards =
|
||||
std::vector<ShardType>{ShardType{"shard0", "host0:123"}, ShardType{"shard1", "host1:123"}};
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -50,17 +50,19 @@ protected:
|
||||
}
|
||||
|
||||
PrimaryOnlyServiceRetryStrategy makeStrategy() {
|
||||
return PrimaryOnlyServiceRetryStrategy{
|
||||
kDefaultRetryabilityPredicate,
|
||||
return PrimaryOnlyServiceRetryStrategy{kDefaultRetryabilityPredicate,
|
||||
[this](const Status& s) { ++_transientErrorCount; },
|
||||
[this](const Status& s) { ++_unrecoverableErrorCount; }};
|
||||
[this](const Status& s) {
|
||||
++_unrecoverableErrorCount;
|
||||
}};
|
||||
}
|
||||
|
||||
PrimaryOnlyServiceRetryStrategy makeNeverRetryStrategy() {
|
||||
return PrimaryOnlyServiceRetryStrategy{
|
||||
makeNeverRetryPredicate(),
|
||||
return PrimaryOnlyServiceRetryStrategy{makeNeverRetryPredicate(),
|
||||
[this](const Status& s) { ++_transientErrorCount; },
|
||||
[this](const Status& s) { ++_unrecoverableErrorCount; }};
|
||||
[this](const Status& s) {
|
||||
++_unrecoverableErrorCount;
|
||||
}};
|
||||
}
|
||||
|
||||
int transientErrorCount() const {
|
||||
|
||||
@ -117,7 +117,9 @@ public:
|
||||
auto body = std::make_shared<BodyCallable>(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> 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);
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -104,8 +104,9 @@ using MetricsPtr = std::unique_ptr<Metrics>;
|
||||
const auto getMetrics = ServiceContext::declareDecoration<MetricsPtr>();
|
||||
|
||||
const auto metricsRegisterer = ServiceContext::ConstructorActionRegisterer{
|
||||
"ShardingDataTransformMetrics",
|
||||
[](ServiceContext* ctx) { getMetrics(ctx) = std::make_unique<Metrics>(); }};
|
||||
"ShardingDataTransformMetrics", [](ServiceContext* ctx) {
|
||||
getMetrics(ctx) = std::make_unique<Metrics>();
|
||||
}};
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
@ -656,7 +656,9 @@ std::unique_ptr<ReshardingMetrics> 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());
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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<ServiceContext>("ServiceContext1");
|
||||
|
||||
@ -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()) {
|
||||
|
||||
@ -216,7 +216,9 @@ private:
|
||||
return visit(
|
||||
OverloadedVisitor{
|
||||
[](std::reference_wrapper<RecoveryUnit> ru) -> RecoveryUnit& { return ru; },
|
||||
[](const std::function<RecoveryUnit&()>& ru) -> RecoveryUnit& { return ru(); }},
|
||||
[](const std::function<RecoveryUnit&()>& ru) -> RecoveryUnit& {
|
||||
return ru();
|
||||
}},
|
||||
_ru);
|
||||
}
|
||||
|
||||
|
||||
@ -570,12 +570,13 @@ DropIndexesReply dropIndexes(OperationContext* opCtx,
|
||||
"CMD: dropIndexes",
|
||||
logAttrs(collAcq->nss()),
|
||||
"uuid"_attr = collectionUUID,
|
||||
"indexes"_attr =
|
||||
visit(OverloadedVisitor{[](const std::string& arg) { return arg; },
|
||||
"indexes"_attr = visit(OverloadedVisitor{[](const std::string& arg) { return arg; },
|
||||
[](const std::vector<std::string>& arg) {
|
||||
return boost::algorithm::join(arg, ",");
|
||||
},
|
||||
[](const BSONObj& arg) { return arg.toString(); }},
|
||||
[](const BSONObj& arg) {
|
||||
return arg.toString();
|
||||
}},
|
||||
index));
|
||||
}
|
||||
|
||||
|
||||
@ -633,8 +633,9 @@ StatusWith<std::vector<BSONObj>> 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) {
|
||||
|
||||
@ -183,8 +183,10 @@ std::unique_ptr<ShardRegistry> ShardingMongoDTestFixture::makeShardRegistry(
|
||||
std::make_unique<ShardFactory>(std::move(buildersMap), std::move(targeterFactory));
|
||||
|
||||
auto shardRemovalHooks = std::vector<ShardRegistry::ShardRemovalHook>{
|
||||
[&shardSharedStateCache = ShardSharedStateCache::get(service)](
|
||||
const ShardId& removedShard) { shardSharedStateCache.forgetShardState(removedShard); }};
|
||||
[&shardSharedStateCache =
|
||||
ShardSharedStateCache::get(service)](const ShardId& removedShard) {
|
||||
shardSharedStateCache.forgetShardState(removedShard);
|
||||
}};
|
||||
|
||||
return std::make_unique<ShardRegistry>(
|
||||
getServiceContext(), std::move(shardFactory), configConnStr, std::move(shardRemovalHooks));
|
||||
|
||||
@ -355,7 +355,9 @@ std::string toString(const StorageEngine::OldestActiveTransactionTimestampResult
|
||||
void setKeyOnCursor(WT_CURSOR* c, const std::variant<std::span<const char>, int64_t>& key) {
|
||||
std::visit(OverloadedVisitor{
|
||||
[&](const std::span<const char> 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);
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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
|
||||
|
||||
@ -77,7 +77,9 @@ public:
|
||||
return bucketState == BucketState::kCleared ||
|
||||
bucketState == BucketState::kPreparedAndCleared;
|
||||
},
|
||||
[](DirectWriteCounter dwcount) { return false; }},
|
||||
[](DirectWriteCounter dwcount) {
|
||||
return false;
|
||||
}},
|
||||
*state);
|
||||
}
|
||||
|
||||
|
||||
@ -157,7 +157,9 @@ void appendElementToBuilder(std::variant<mutablebson::Element, BSONElement> elem
|
||||
element.writeArrayTo(&subBuilder);
|
||||
}
|
||||
},
|
||||
[&](BSONElement element) { builder->appendAs(element, fieldName); }},
|
||||
[&](BSONElement element) {
|
||||
builder->appendAs(element, fieldName);
|
||||
}},
|
||||
elem);
|
||||
}
|
||||
|
||||
@ -537,8 +539,9 @@ boost::optional<std::pair<size_t, ArrayDiffReader::ArrayModification>> 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}; }},
|
||||
auto modification = visit(OverloadedVisitor{[](const auto& reader) -> ArrayModification {
|
||||
return {reader};
|
||||
}},
|
||||
getReader(next.embeddedObject()));
|
||||
return {{idx, modification}};
|
||||
} else {
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -88,7 +88,9 @@ void serializeWriteConcernW(const WriteConcernW& w, StringData fieldName, BSONOb
|
||||
builder->appendNumber(fieldName, static_cast<long long>(wNumNodes));
|
||||
},
|
||||
[&](const std::string& wMode) { builder->append(fieldName, wMode); },
|
||||
[&](WTags wTags) { builder->append(fieldName, wTags); }},
|
||||
[&](WTags wTags) {
|
||||
builder->append(fieldName, wTags);
|
||||
}},
|
||||
w);
|
||||
}
|
||||
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -165,9 +165,11 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
const auto implRegisterer = ServiceContext::ConstructorActionRegisterer{
|
||||
"RemoteCommmandRunner",
|
||||
[](ServiceContext* ctx) { getRCRImpl(ctx) = std::make_unique<AsyncRPCRunnerImpl>(); }};
|
||||
const auto implRegisterer =
|
||||
ServiceContext::ConstructorActionRegisterer{"RemoteCommmandRunner", [](ServiceContext* ctx) {
|
||||
getRCRImpl(ctx) =
|
||||
std::make_unique<AsyncRPCRunnerImpl>();
|
||||
}};
|
||||
|
||||
AsyncRPCRunner* AsyncRPCRunner::get(ServiceContext* svcCtx) {
|
||||
return getRCRImpl(svcCtx).get();
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -121,7 +121,8 @@ GetTenantIDFn& getTenantID() {
|
||||
return *fn;
|
||||
}
|
||||
LogCounterCallback& getLogCounterCallback() {
|
||||
static StaticImmortal<LogCounterCallback> fn{[]() {}};
|
||||
static StaticImmortal<LogCounterCallback> fn{[]() {
|
||||
}};
|
||||
return *fn;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@ -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<MetricNameMaker>{});
|
||||
}
|
||||
};
|
||||
class MONGO_MOD_FILE_PRIVATE MetricNameMaker{public : static constexpr MetricName make(
|
||||
StringData name){return MetricName(name, Passkey<MetricNameMaker>{});
|
||||
} // namespace otel::metrics
|
||||
}; // namespace mongo
|
||||
|
||||
/**
|
||||
* Central registry of OpenTelemetry metric names used in the server. When adding a new metric to
|
||||
|
||||
@ -222,7 +222,9 @@ TEST_F(PrometheusFileExporterTest, SkippedExportIncrementsCounter) {
|
||||
// guarantee that one export is skipped.
|
||||
auto [promise, future] = makePromiseFuture<void>();
|
||||
std::unique_ptr<PushMetricExporter> 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<void>();
|
||||
std::unique_ptr<PushMetricExporter> 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<void>();
|
||||
std::unique_ptr<PushMetricExporter> exporter = makeExporter(
|
||||
/*options=*/{.maxConsecutiveFailures = 3,
|
||||
.testOnlyFailpointCallback = [&future]() { future.wait(); }});
|
||||
/*options=*/{.maxConsecutiveFailures = 3, .testOnlyFailpointCallback = [&future]() {
|
||||
future.wait();
|
||||
}});
|
||||
|
||||
FailPointEnableBlock fp("metricsPrometheusFileExporterThreadCallback",
|
||||
BSON("UnlockOnly" << true));
|
||||
|
||||
@ -370,7 +370,9 @@ private:
|
||||
|
||||
// See documentWithoutMongosInfo().
|
||||
Deferred<BSONObj (*)(const BSONObj&)> _documentWithoutMongosInfo{
|
||||
[](const BSONObj& fullDocument) { return fullDocument.removeField("mongos"); }};
|
||||
[](const BSONObj& fullDocument) {
|
||||
return fullDocument.removeField("mongos");
|
||||
}};
|
||||
|
||||
// See hashWithoutMongosInfo().
|
||||
Deferred<size_t (*)(const BSONObj&)> _hashWithoutMongos{simpleHash};
|
||||
|
||||
@ -38,6 +38,7 @@ void visit(DocsNeededBoundsContext* ctx, const T&) {
|
||||
}
|
||||
|
||||
const ServiceContext::ConstructorActionRegisterer DocsNeededBoundsRegisterer{
|
||||
"DocsNeededBoundsRegistererMongos",
|
||||
[](ServiceContext* service) { registerMongosVisitor<DocsNeededBoundsContext>(service); }};
|
||||
"DocsNeededBoundsRegistererMongos", [](ServiceContext* service) {
|
||||
registerMongosVisitor<DocsNeededBoundsContext>(service);
|
||||
}};
|
||||
} // namespace mongo
|
||||
|
||||
@ -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<LegacyRuntimeConstants>& BatchedCommandRequest::getLegacyRuntimeConstants()
|
||||
@ -193,7 +195,9 @@ const boost::optional<BSONObj>& BatchedCommandRequest::getLet() const {
|
||||
void BatchedCommandRequest::setLet(boost::optional<mongo::BSONObj> 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) {
|
||||
|
||||
@ -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<mongo::BSONObj> 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<BSONObj>& 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<BSONObj> 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<UUID> BulkWriteCommandRefImpl::getSampleId(int index) const {
|
||||
@ -401,7 +417,9 @@ boost::optional<UUID> 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<mongo::EncryptionInformation>&
|
||||
@ -496,7 +522,9 @@ boost::optional<mongo::BSONObj> 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 {
|
||||
|
||||
@ -218,7 +218,9 @@ int recursionTestImpl(bool useSigAltStack) {
|
||||
void* deepestAddress;
|
||||
const std::function<void()> 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
|
||||
|
||||
@ -126,7 +126,9 @@ class ConnectionThread {
|
||||
public:
|
||||
explicit ConnectionThread(int port) : ConnectionThread(port, nullptr) {}
|
||||
ConnectionThread(int port, std::function<void(ConnectionThread&)> 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();
|
||||
};
|
||||
|
||||
@ -82,7 +82,9 @@ struct MONGO_MOD_NEEDS_REPLACEMENT SessionThread {
|
||||
struct StopException {};
|
||||
|
||||
explicit SessionThread(std::shared_ptr<transport::Session> s)
|
||||
: _session{std::move(s)}, _thread{[this] { _run(); }} {}
|
||||
: _session{std::move(s)}, _thread{[this] {
|
||||
_run();
|
||||
}} {}
|
||||
|
||||
~SessionThread() {
|
||||
if (!_thread.joinable())
|
||||
|
||||
@ -63,7 +63,9 @@ public:
|
||||
/** Spawn and return a `stdx::thread` that invokes `f` as if by `exec(f)`. */
|
||||
template <typename F>
|
||||
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. */
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,7 +120,9 @@ TEST(UniqueFunctionTest, construct_simple_unique_function_from_lambda) {
|
||||
// Explicit construction
|
||||
{
|
||||
RunDetection<0> runDetection;
|
||||
mongo::unique_function<void()> uf{[] { RunDetection<0>::itRan = true; }};
|
||||
mongo::unique_function<void()> uf{[] {
|
||||
RunDetection<0>::itRan = true;
|
||||
}};
|
||||
|
||||
uf();
|
||||
|
||||
|
||||
@ -304,7 +304,9 @@ using unittest::JoinThread;
|
||||
TEST(SharedFuture, ConcurrentTest_Simple) {
|
||||
SharedPromise<void> 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();
|
||||
}
|
||||
|
||||
@ -619,8 +619,9 @@ public:
|
||||
ExtractRetryParameters extractRetryParameters = {}) && {
|
||||
using ReturnType = FutureContinuationResult<Callable, const TargetingMetadata&>;
|
||||
|
||||
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<ReturnType>& swResult) {
|
||||
auto result = extractRetryParameters(swResult);
|
||||
|
||||
@ -82,7 +82,9 @@ public:
|
||||
std::vector<std::tuple<void*, size_t, size_t>> 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) {
|
||||
|
||||
@ -69,7 +69,9 @@ private:
|
||||
|
||||
template <typename T>
|
||||
static inline VTable forT = VTable{+[](void* t) { static_cast<T*>(t)->lock(); },
|
||||
+[](void* t) { static_cast<T*>(t)->unlock(); }};
|
||||
+[](void* t) {
|
||||
static_cast<T*>(t)->unlock();
|
||||
}};
|
||||
|
||||
void* _underlyingLock;
|
||||
const VTable* _vtable;
|
||||
|
||||
@ -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 =
|
||||
|
||||
@ -525,10 +525,15 @@ public:
|
||||
};
|
||||
std::set<CpuId, decltype(cmp)> cpuIds(cmp);
|
||||
|
||||
CpuInfoParser cpuInfoParser{
|
||||
{
|
||||
{"physical id", [&](const std::string& value) { parsedCpuId.physical = value; }},
|
||||
{"core id", [&](const std::string& value) { parsedCpuId.core = value; }},
|
||||
CpuInfoParser cpuInfoParser{{
|
||||
{"physical id",
|
||||
[&](const std::string& value) {
|
||||
parsedCpuId.physical = value;
|
||||
}},
|
||||
{"core id",
|
||||
[&](const std::string& value) {
|
||||
parsedCpuId.core = value;
|
||||
}},
|
||||
},
|
||||
[&]() {
|
||||
cpuIds.insert(parsedCpuId);
|
||||
@ -545,11 +550,14 @@ public:
|
||||
static int getNumCpuSockets() {
|
||||
std::set<std::string> 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();
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user