Skip to content

utilccl: improve CheckEnterpriseEnabled performance #62489

@erikgrinaker

Description

@erikgrinaker

In #59571, utilccl.CheckEnterpriseEnabled was called much more often in the read path, via kvfollowerreadsccl.canSendToFollower. However, CheckEnterpriseEnabled has a couple of performance issues:

  1. We're instantiating a pgerror.Newf() in utilccl.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.

  2. We're decoding the license (if any) on each call, see:

// 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
}
}

Metadata

Metadata

Assignees

Labels

C-performancePerf of queries or internals. Solution not expected to change functional behavior.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions