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

sql: add crdb_internal.release_series builtin #113804

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

RaduBerinde
Copy link
Member

@RaduBerinde RaduBerinde commented Nov 4, 2023

This commit adds a built-in that resolves dev versions (e.g. 23.2-10)
to the corresponding release series (e.g. 24.1). This allows us to
clean up some tests and make them stable - they will no longer need to
be adjusted when minting a release.

Informs: #112629
Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@RaduBerinde RaduBerinde force-pushed the release-series branch 4 times, most recently from 45571b4 to 4f31543 Compare November 6, 2023 22:41
@RaduBerinde RaduBerinde marked this pull request as ready for review November 6, 2023 22:42
@RaduBerinde RaduBerinde requested a review from a team as a code owner November 6, 2023 22:42
Copy link
Collaborator

@celiala celiala left a comment

Choose a reason for hiding this comment

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

LGTM -- thank you! looks great

Reviewed 12 of 14 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @andyyang890, @RaduBerinde, and @rail)


pkg/sql/sem/builtins/builtins.go line 5013 at r1 (raw file):

				}
				if version.Less(clusterversion.MinSupported.Version()) || clusterversion.Latest.Version().Less(version) {
					return nil, errors.Newf(

maybe add test case to verify that less than MinSupport or greater than Latest returns error as expected?
(e.g. maybe to builtins_test.go?)


pkg/upgrade/upgrades/builtins_test.go line 63 at r1 (raw file):

	sqlDB.CheckQueryResults(t, "SELECT crdb_internal.release_series(version) FROM [SHOW CLUSTER SETTING version]",
		[][]string{{clusterversion.Latest.ReleaseSeries().String()}})
}

maybe add test case to verify that less than MinSupport or greater than Latest returns error as expected?

This commit adds a built-in that resolves dev versions (e.g. 23.2-10)
to the corresponding release series (e.g. 24.1). This allows us to
clean up some tests and make them stable - they will no longer need to
be adjusted when minting a release.

Informs: cockroachdb#112629
Release note: None
Copy link
Member Author

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

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

TFTR!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @andyyang890, @celiala, and @rail)


pkg/sql/sem/builtins/builtins.go line 5013 at r1 (raw file):

Previously, celiala wrote…

maybe add test case to verify that less than MinSupport or greater than Latest returns error as expected?
(e.g. maybe to builtins_test.go?)

Added to crdb_internal

@RaduBerinde
Copy link
Member Author

bors r+

@andyyang890 andyyang890 requested a review from celiala November 7, 2023 04:08
Copy link
Collaborator

@andyyang890 andyyang890 left a comment

Choose a reason for hiding this comment

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

:lgtm: Late to the party but love how much cleaner this makes mixed-version logic tests!

Reviewed 1 of 14 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @celiala and @rail)

Copy link
Collaborator

@andyyang890 andyyang890 left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @celiala, @RaduBerinde, and @rail)


pkg/clusterversion/dev_offset.go line 90 at r2 (raw file):

// removeDevOffset removes DevOffset from the given version, if it was applied.
func removeDevOffset(v roachpb.Version) roachpb.Version {

nit: maybe rename this to maybeRemoveDevOffset for consistency

@craig
Copy link
Contributor

craig bot commented Nov 7, 2023

Build succeeded:

@craig craig bot merged commit 414cb46 into cockroachdb:master Nov 7, 2023
8 checks passed
@RaduBerinde
Copy link
Member Author

pkg/clusterversion/dev_offset.go line 90 at r2 (raw file):

Previously, andyyang890 (Andy Yang) wrote…

nit: maybe rename this to maybeRemoveDevOffset for consistency

maybeRemove suggests that it might not be removed in some cases..

Copy link
Collaborator

@andyyang890 andyyang890 left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained


pkg/clusterversion/dev_offset.go line 90 at r2 (raw file):

Previously, RaduBerinde wrote…

maybeRemove suggests that it might not be removed in some cases..

Hmm yeah I guess it's ambiguous, I personally interpret maybeRemove as "remove if it was applied, otherwise do nothing"

@RaduBerinde
Copy link
Member Author

pkg/clusterversion/dev_offset.go line 90 at r2 (raw file):

Previously, andyyang890 (Andy Yang) wrote…

Hmm yeah I guess it's ambiguous, I personally interpret maybeRemove as "remove if it was applied, otherwise do nothing"

Maybe withoutDevOffset?

Copy link
Collaborator

@andyyang890 andyyang890 left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained


pkg/clusterversion/dev_offset.go line 90 at r2 (raw file):

Previously, RaduBerinde wrote…

Maybe withoutDevOffset?

Works for me! Also ok with just keeping it as-is, up to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants