From f61c7db3a8e6783c3ff7abfda62708fa2c6426bc Mon Sep 17 00:00:00 2001 From: Marcus Gartner Date: Thu, 21 Jul 2022 10:48:01 -0400 Subject: [PATCH] opt: clarify plan gist comment Release note: None --- pkg/sql/opt/exec/explain/plan_gist_factory.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/sql/opt/exec/explain/plan_gist_factory.go b/pkg/sql/opt/exec/explain/plan_gist_factory.go index bad9481926d3..acc08e8e8d62 100644 --- a/pkg/sql/opt/exec/explain/plan_gist_factory.go +++ b/pkg/sql/opt/exec/explain/plan_gist_factory.go @@ -36,10 +36,14 @@ import ( func init() { if numOperators != 58 { - // If this error occurs please make sure the new op is the last one in order - // to not invalidate existing plan gists/hashes. If we are just adding an - // operator at the end there's no need to update version below and we can - // just bump the hardcoded literal here. + // This error occurs when an operator has been added or removed in + // pkg/sql/opt/exec/explain/factory.opt. If an operator is added at the + // end of factory.opt, simply adjust the hardcoded value above. If an + // operator is removed or added anywhere else in factory.opt, increment + // gistVersion below. Note that we currently do not have a mechanism for + // decoding gists of older versions. This means that if gistVersion is + // incremented in a release, upgrading a cluster to that release will + // cause decoding errors for any previously generated plan gists. panic(errors.AssertionFailedf("Operator field changed (%d), please update check and consider incrementing version", numOperators)) } }