diff options
author | Bernard Gorman <bernard.gorman@gmail.com> | 2018-11-25 03:37:30 +0000 |
---|---|---|
committer | Bernard Gorman <bernard.gorman@gmail.com> | 2019-01-09 02:59:49 +0000 |
commit | 16c7973fc8037ee0b7bd12116e5ff25084af142b (patch) | |
tree | a357dc1ba14d29dea7e9012907dabe6d1ad75946 /src/mongo/db/pipeline/aggregation_request.h | |
parent | 214bf238fedc4e147e6473f5fc64428987added6 (diff) | |
download | mongo-16c7973fc8037ee0b7bd12116e5ff25084af142b.tar.gz |
SERVER-38410 Allow ARM to consume postBatchResumeToken
Diffstat (limited to 'src/mongo/db/pipeline/aggregation_request.h')
-rw-r--r-- | src/mongo/db/pipeline/aggregation_request.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/aggregation_request.h b/src/mongo/db/pipeline/aggregation_request.h index 22134763ac9..cac78b57050 100644 --- a/src/mongo/db/pipeline/aggregation_request.h +++ b/src/mongo/db/pipeline/aggregation_request.h @@ -56,6 +56,7 @@ public: static constexpr StringData kBatchSizeName = "batchSize"_sd; static constexpr StringData kFromMongosName = "fromMongos"_sd; static constexpr StringData kNeedsMergeName = "needsMerge"_sd; + static constexpr StringData kMergeByPBRTName = "mergeByPBRT"_sd; static constexpr StringData kPipelineName = "pipeline"_sd; static constexpr StringData kCollationName = "collation"_sd; static constexpr StringData kExplainName = "explain"_sd; @@ -152,6 +153,22 @@ public: return _needsMerge; } + /** + * Returns true if this request is a change stream pipeline which originated from a mongoS that + * can merge based on the documents' raw resume tokens and the 'postBatchResumeToken' field. If + * not, then the mongoD will need to produce the old {ts, uuid, docKey} $sortKey format instead. + * TODO SERVER-38539: this flag is no longer necessary in 4.4, since all change streams will be + * merged using raw resume tokens and PBRTs. This mechanism was chosen over FCV for two reasons: + * first, because this code is intended for backport to 4.0, where the same issue exists but FCV + * cannot be leveraged. Secondly, FCV can be changed at any point during runtime, but mongoS + * cannot dynamically switch from one $sortKey format to another mid-stream. The 'mergeByPBRT' + * flag allows the mongoS to dictate which $sortKey format will be used, and it will stay + * consistent for the entire duration of the stream. + */ + bool mergeByPBRT() const { + return _mergeByPBRT; + } + bool shouldAllowDiskUse() const { return _allowDiskUse; } @@ -239,6 +256,10 @@ public: _needsMerge = needsMerge; } + void setMergeByPBRT(bool mergeByPBRT) { + _mergeByPBRT = mergeByPBRT; + } + void setBypassDocumentValidation(bool shouldBypassDocumentValidation) { _bypassDocumentValidation = shouldBypassDocumentValidation; } @@ -299,6 +320,7 @@ private: bool _allowDiskUse = false; bool _fromMongos = false; bool _needsMerge = false; + bool _mergeByPBRT = false; bool _bypassDocumentValidation = false; // A user-specified maxTimeMS limit, or a value of '0' if not specified. |