-
Notifications
You must be signed in to change notification settings - Fork 4.1k
utilccl: improve CheckEnterpriseEnabled performance #62489
Copy link
Copy link
Closed
Labels
C-performancePerf of queries or internals. Solution not expected to change functional behavior.Perf of queries or internals. Solution not expected to change functional behavior.
Description
In #59571, utilccl.CheckEnterpriseEnabled was called much more often in the read path, via kvfollowerreadsccl.canSendToFollower. However, CheckEnterpriseEnabled has a couple of performance issues:
-
We're instantiating a
pgerror.Newf()inutilccl.check()when enterprise features are unavailable -- this is often necessary because we include cluster-specific info in the error message, but is expensive. However, in this specific case the caller just needs to know if there was an error, not the actual error message, so we should provide a variant using a generic, static error message. -
We're decoding the license (if any) on each call, see:
cockroach/pkg/ccl/utilccl/license_check.go
Lines 120 to 127 in c834bd8
| // FIXME(tschottdorf): see whether it makes sense to cache the decoded | |
| // license. | |
| if str := enterpriseLicense.Get(&st.SV); str != "" { | |
| var err error | |
| if lic, err = decode(str); err != nil { | |
| return err | |
| } | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-performancePerf of queries or internals. Solution not expected to change functional behavior.Perf of queries or internals. Solution not expected to change functional behavior.