summaryrefslogtreecommitdiff
path: root/src/mongo/s
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2019-05-20 19:14:54 -0400
committerCharlie Swanson <charlie.swanson@mongodb.com>2019-05-22 16:38:40 -0400
commit7ac68bb3418650654599b6ffb768daf4bacc979d (patch)
treed5c225e46bc468f59950219ffb7df840fa98e945 /src/mongo/s
parent5594eeb9c42f5a28ebb20c8fcce87a2a1a01f6a5 (diff)
downloadmongo-7ac68bb3418650654599b6ffb768daf4bacc979d.tar.gz
SERVER-41249 Fix special cases for $out to include $merge
Diffstat (limited to 'src/mongo/s')
-rw-r--r--src/mongo/s/query/cluster_aggregate.cpp5
-rw-r--r--src/mongo/s/query/cluster_aggregation_planner_test.cpp2
-rw-r--r--src/mongo/s/transaction_router.cpp6
3 files changed, 7 insertions, 6 deletions
diff --git a/src/mongo/s/query/cluster_aggregate.cpp b/src/mongo/s/query/cluster_aggregate.cpp
index 2cbb292adc8..64538f676cc 100644
--- a/src/mongo/s/query/cluster_aggregate.cpp
+++ b/src/mongo/s/query/cluster_aggregate.cpp
@@ -625,8 +625,9 @@ Status runPipelineOnMongoS(const boost::intrusive_ptr<ExpressionContext>& expCtx
auto cursorResponse = establishMergingMongosCursor(
opCtx, request, requestedNss, litePipe, std::move(pipeline), privileges);
- // We don't need to storePossibleCursor or propagate writeConcern errors; an $out pipeline
- // can never run on mongoS. Filter the command response and return immediately.
+ // We don't need to storePossibleCursor or propagate writeConcern errors; a pipeline with
+ // writing stages like $out can never run on mongoS. Filter the command response and return
+ // immediately.
CommandHelpers::filterCommandReplyForPassthrough(cursorResponse, result);
return getStatusFromCommandResult(result->asTempObj());
}
diff --git a/src/mongo/s/query/cluster_aggregation_planner_test.cpp b/src/mongo/s/query/cluster_aggregation_planner_test.cpp
index 8f14dceeb6a..a6a81e7a5d4 100644
--- a/src/mongo/s/query/cluster_aggregation_planner_test.cpp
+++ b/src/mongo/s/query/cluster_aggregation_planner_test.cpp
@@ -55,7 +55,7 @@ const NamespaceString kTestOutNss = NamespaceString{"unittests", "out_ns"};
/**
* For the purposes of this test, assume every collection is sharded. Stages may ask this during
- * setup. For example, to compute its constraints, the $out stage needs to know if the output
+ * setup. For example, to compute its constraints, the $merge stage needs to know if the output
* collection is sharded.
*/
class FakeMongoProcessInterface : public StubMongoProcessInterface {
diff --git a/src/mongo/s/transaction_router.cpp b/src/mongo/s/transaction_router.cpp
index 667ba573f17..a5b8a864bbc 100644
--- a/src/mongo/s/transaction_router.cpp
+++ b/src/mongo/s/transaction_router.cpp
@@ -145,9 +145,9 @@ BSONObjBuilder appendFieldsForStartTransaction(BSONObj cmd,
}
// Commands that are idempotent in a transaction context and can be blindly retried in the middle of
-// a transaction. Aggregate with $out is disallowed in a transaction, so aggregates must be read
-// operations. Note: aggregate and find do have the side-effect of creating cursors, but any
-// established during an unsuccessful attempt are best-effort killed.
+// a transaction. Writing aggregates (e.g. with a $out or $merge) is disallowed in a transaction, so
+// aggregates must be read operations. Note: aggregate and find do have the side-effect of creating
+// cursors, but any established during an unsuccessful attempt are best-effort killed.
const StringMap<int> alwaysRetryableCmds = {
{"aggregate", 1}, {"distinct", 1}, {"find", 1}, {"getMore", 1}, {"killCursors", 1}};