summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/aggregation_request.h
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2017-09-01 14:06:58 -0400
committerTess Avitabile <tess.avitabile@mongodb.com>2017-09-06 13:41:32 -0400
commited601dd01169b8c1fad9fb8d388da0523a1b48f5 (patch)
tree4d08bd1a36a12967fcb098432709da07236026b3 /src/mongo/db/pipeline/aggregation_request.h
parent456ba544978a0d41a2261bf65da686874fb631a2 (diff)
downloadmongo-ed601dd01169b8c1fad9fb8d388da0523a1b48f5.tar.gz
SERVER-30899 Aggregations sent from a 3.4 mongos should serialize 3.4 metadata
Diffstat (limited to 'src/mongo/db/pipeline/aggregation_request.h')
-rw-r--r--src/mongo/db/pipeline/aggregation_request.h30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/mongo/db/pipeline/aggregation_request.h b/src/mongo/db/pipeline/aggregation_request.h
index d8672b986d7..b34fc383d20 100644
--- a/src/mongo/db/pipeline/aggregation_request.h
+++ b/src/mongo/db/pipeline/aggregation_request.h
@@ -50,8 +50,9 @@ public:
static constexpr StringData kCommandName = "aggregate"_sd;
static constexpr StringData kCursorName = "cursor"_sd;
static constexpr StringData kBatchSizeName = "batchSize"_sd;
- static constexpr StringData kFromRouterName = "fromRouter"_sd;
+ static constexpr StringData kFromMongosName = "fromMongos"_sd;
static constexpr StringData kNeedsMergeName = "needsMerge"_sd;
+ static constexpr StringData kNeedsMerge34Name = "fromRouter"_sd;
static constexpr StringData kPipelineName = "pipeline"_sd;
static constexpr StringData kCollationName = "collation"_sd;
static constexpr StringData kExplainName = "explain"_sd;
@@ -135,8 +136,15 @@ public:
/**
* Returns true if this request originated from a mongoS.
*/
- bool isFromRouter() const {
- return _fromRouter;
+ bool isFromMongos() const {
+ return _fromMongos;
+ }
+
+ /**
+ * Returns true if this request originated from a 3.4 mongos.
+ */
+ bool isFrom34Mongos() const {
+ return _from34Mongos;
}
/**
@@ -218,8 +226,12 @@ public:
_allowDiskUse = allowDiskUse;
}
- void setFromRouter(bool isFromRouter) {
- _fromRouter = isFromRouter;
+ void setFromMongos(bool isFromMongos) {
+ _fromMongos = isFromMongos;
+ }
+
+ void setFrom34Mongos(bool isFrom34Mongos) {
+ _from34Mongos = isFrom34Mongos;
}
void setNeedsMerge(bool needsMerge) {
@@ -276,10 +288,16 @@ private:
boost::optional<ExplainOptions::Verbosity> _explainMode;
bool _allowDiskUse = false;
- bool _fromRouter = false;
+ bool _fromMongos = false;
bool _needsMerge = false;
bool _bypassDocumentValidation = false;
+ // We track whether the aggregation request came from a 3.4 mongos. If so, the merge may occur
+ // on a 3.4 shard (which does not understand sort key metadata), and we should not serialize the
+ // sort key.
+ // TODO SERVER-30924: remove this.
+ bool _from34Mongos = false;
+
// A user-specified maxTimeMS limit, or a value of '0' if not specified.
unsigned int _maxTimeMS = 0;
};