0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

SERVER-44470 Use supportsReadConcern() for $out and $merge stages

This commit is contained in:
Kevin Pulo 2019-12-02 00:55:32 +00:00 committed by evergreen
parent 0a1b503e3f
commit a8b246e6ac
4 changed files with 16 additions and 10 deletions

View File

@ -373,11 +373,6 @@ boost::intrusive_ptr<DocumentSource> DocumentSourceMerge::create(
"{} cannot be used in a transaction"_format(kStageName),
!expCtx->inMultiDocumentTransaction);
auto readConcernLevel = repl::ReadConcernArgs::get(expCtx->opCtx).getLevel();
uassert(ErrorCodes::InvalidOptions,
"{} cannot be used with a 'linearizable' read concern level"_format(kStageName),
readConcernLevel != repl::ReadConcernLevel::kLinearizableReadConcern);
uassert(31319,
"Cannot {} to special collection: {}"_format(kStageName, outputNs.coll()),
!outputNs.isSystem());

View File

@ -79,6 +79,14 @@ public:
bool allowedToPassthroughFromMongos() const final {
return false;
}
ReadConcernSupportResult supportsReadConcern(repl::ReadConcernLevel level) const final {
return {
{level == repl::ReadConcernLevel::kLinearizableReadConcern,
{ErrorCodes::InvalidOptions,
"{} cannot be used with a 'linearizable' read concern level"_format(kStageName)}},
Status::OK()};
}
};
virtual ~DocumentSourceMerge() = default;

View File

@ -207,11 +207,6 @@ boost::intrusive_ptr<DocumentSource> DocumentSourceOut::createAndAllowDifferentD
"{} cannot be used in a transaction"_format(kStageName),
!expCtx->inMultiDocumentTransaction);
auto readConcernLevel = repl::ReadConcernArgs::get(expCtx->opCtx).getLevel();
uassert(ErrorCodes::InvalidOptions,
"{} cannot be used with a 'linearizable' read concern level"_format(kStageName),
readConcernLevel != repl::ReadConcernLevel::kLinearizableReadConcern);
uassert(ErrorCodes::InvalidNamespace,
"Invalid {} target namespace, {}"_format(kStageName, outputNs.ns()),
outputNs.isValid());

View File

@ -62,6 +62,14 @@ public:
bool allowedToPassthroughFromMongos() const final {
return false;
}
ReadConcernSupportResult supportsReadConcern(repl::ReadConcernLevel level) const final {
return {
{level == repl::ReadConcernLevel::kLinearizableReadConcern,
{ErrorCodes::InvalidOptions,
"{} cannot be used with a 'linearizable' read concern level"_format(kStageName)}},
Status::OK()};
}
};
~DocumentSourceOut() override;