summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/variables.h
diff options
context:
space:
mode:
authorIan Boros <ian.boros@mongodb.com>2020-04-01 22:02:17 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-04-13 20:35:43 +0000
commite95c1625acdaed28ddb9ebda5c293e307e8ee284 (patch)
tree133bd2aa95e4df318f541d93b41511e6abaf987a /src/mongo/db/pipeline/variables.h
parent88c3019bb204ac8a5f30304c7e94f09d30a5d0c8 (diff)
downloadmongo-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.h13
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;
};
/**