diff options
author | Ian Boros <ian.boros@mongodb.com> | 2020-04-01 22:02:17 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-04-13 20:35:43 +0000 |
commit | e95c1625acdaed28ddb9ebda5c293e307e8ee284 (patch) | |
tree | 133bd2aa95e4df318f541d93b41511e6abaf987a /src/mongo/db/pipeline/variables.h | |
parent | 88c3019bb204ac8a5f30304c7e94f09d30a5d0c8 (diff) | |
download | mongo-e95c1625acdaed28ddb9ebda5c293e307e8ee284.tar.gz |
SERVER-47328 optimize MR by avoiding repeated creation of RuntimeConstants
Diffstat (limited to 'src/mongo/db/pipeline/variables.h')
-rw-r--r-- | src/mongo/db/pipeline/variables.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/mongo/db/pipeline/variables.h b/src/mongo/db/pipeline/variables.h index b0035054c52..da9d6100518 100644 --- a/src/mongo/db/pipeline/variables.h +++ b/src/mongo/db/pipeline/variables.h @@ -136,12 +136,14 @@ public: } /** - * Serializes runtime constants. This is used to send the constants to shards. + * Return a reference to an object which represents the variables which are considered "runtime + * constants." It is a programming error to call this function without having called + * setRuntimeConstants(). */ - RuntimeConstants getRuntimeConstants() const; + const RuntimeConstants& getRuntimeConstants() const; /** - * Deserialize runtime constants. + * Set the runtime constants. It is a programming error to call this more than once. */ void setRuntimeConstants(const RuntimeConstants& constants); @@ -184,7 +186,10 @@ private: IdGenerator _idGenerator; stdx::unordered_map<Id, ValueAndState> _values; - stdx::unordered_map<Id, Value> _runtimeConstants; + stdx::unordered_map<Id, Value> _runtimeConstantsMap; + + // Populated after construction. Should not be set more than once. + boost::optional<RuntimeConstants> _runtimeConstants; }; /** |