Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metadata: memoize the parsed build versions #22113

Merged
merged 4 commits into from
Feb 3, 2025
Merged

Conversation

rboyer
Copy link
Member

@rboyer rboyer commented Jan 31, 2025

Description

There will only be a small set of consul build versions that a single consul server will witness. Inside of metadata.IsConsulServer we use a very expensive function in the hashicorp/go-version library to parse these into read-only *version.Version structs all over Consul.

Memoize these in a package cache map. Likely the thing will only have like 2 keys in it ever over the life of the process.

@rboyer rboyer self-assigned this Jan 31, 2025
@rboyer rboyer requested a review from a team as a code owner January 31, 2025 22:15
@dhiaayachi dhiaayachi added the backport/all Apply backports for all active releases per .release/versions.hcl label Jan 31, 2025
Copy link
Collaborator

@dhiaayachi dhiaayachi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

@rboyer rboyer merged commit 00d74ab into main Feb 3, 2025
102 of 103 checks passed
@rboyer rboyer deleted the rboyer/memoize-build-version branch February 3, 2025 22:22
@hc-github-team-consul-core hc-github-team-consul-core added backport/1.20 Changes are backported to 1.20 backport/ent/1.15 Changes are backported to 1.15 ent backport/ent/1.18 Changes are backported to 1.18 ent backport/ent/1.19 Changes are backported to 1.19 ent labels Feb 3, 2025
@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @rboyer! a backport is missing for this PR [22113] for versions [1.15,1.18,1.19,1.20] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/all Apply backports for all active releases per .release/versions.hcl backport/ent/1.15 Changes are backported to 1.15 ent backport/ent/1.18 Changes are backported to 1.18 ent backport/ent/1.19 Changes are backported to 1.19 ent backport/1.20 Changes are backported to 1.20 pr/no-metrics-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants