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

schemachange/mixed-versions: handle possible syntax error for BIT(0) column usage #134407

Merged

Conversation

spilchen
Copy link
Contributor

@spilchen spilchen commented Nov 6, 2024

A recent fix enabled support for BIT(0) columns (see issue #132944), which has since been backported. However, since this backport hasn’t been released yet, running against an older down-level client may still trigger a syntax error. This change adds a temporary check to handle such errors until the backports for #132944 are publicly released.

This adjustment will be backported to older branches, with slight variations per release:

  • release-24.3: Reuse the same fix as in master.
  • release-24.2: Use isClusterVersionLessThan with clusterversion.V24.2.
  • release-24.1: Use isClusterVersionLessThan with clusterversion.V24.1.
  • release-23.2: Use isClusterVersionLessThan with clusterversion.V23.2.

Epic: None
Release note: None
Closes #133339
Closes #133790
Closes #131162

@spilchen spilchen added backport-23.2.x Flags PRs that need to be backported to 23.2. backport-24.1.x Flags PRs that need to be backported to 24.1. backport-24.2.x Flags PRs that need to be backported to 24.2 backport-24.3.x Flags PRs that need to be backported to 24.3 labels Nov 6, 2024
@spilchen spilchen requested review from rafiss and a team November 6, 2024 13:46
@spilchen spilchen self-assigned this Nov 6, 2024
@spilchen spilchen requested a review from a team as a code owner November 6, 2024 13:46
@spilchen spilchen requested review from DarrylWong and vidit-bhat and removed request for a team November 6, 2024 13:46
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@rafiss rafiss 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! 0 of 0 LGTMs obtained (waiting on @DarrylWong, @spilchen, and @vidit-bhat)


pkg/workload/schemachange/operation_generator.go line 1281 at r1 (raw file):

		return false
	}()
	hasBit0Type := func() bool {

i think we'll want to block this in other places also, like in ADD COLUMN and SET DEFAULT

perhaps we could add one helper function where we check if the type is allowed so we can use it in a few places.

@spilchen spilchen force-pushed the issue-131162/bit-0-mixed-version-check branch 2 times, most recently from e66b80d to 5750fb9 Compare November 6, 2024 20:41
Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

nice! thanks for the fix

// isMixedVersionTest works similarly to isClusterVersionLessThan, but without
// specifying a version. It returns true if the cluster version is not the
// latest, indicating a mixed-version test.
func isMixedVersionTest(ctx context.Context, tx pgx.Tx) (bool, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

super nit: it could be called inMixedVersionState, since technically the whole test could be considered a "mixed version test"

…column usage

A recent fix enabled support for BIT(0) columns (see issue cockroachdb#132944),
which has since been backported. However, since this backport hasn’t
been released yet, running against an older down-level client may still
trigger a syntax error. This change adds a temporary check to handle
such errors until the backports for cockroachdb#132944 are publicly released.

This adjustment will be backported to older branches, with slight
variations per release:
- release-24.3: Reuse the same fix as in master.
- release-24.2: Use isClusterVersionLessThan with clusterversion.V24.2.
- release-24.1: Use isClusterVersionLessThan with clusterversion.V24.1.
- release-23.2: Use isClusterVersionLessThan with clusterversion.V23.2.

Epic: None
Release note: None
Closes: cockroachdb#133339, cockroachdb#133790, cockroachdb#131162
@spilchen spilchen force-pushed the issue-131162/bit-0-mixed-version-check branch from 5750fb9 to b66f3b7 Compare November 6, 2024 20:58
Copy link
Contributor Author

@spilchen spilchen 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! 0 of 0 LGTMs obtained (waiting on @DarrylWong, @rafiss, and @vidit-bhat)


pkg/workload/schemachange/operation_generator.go line 1281 at r1 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

i think we'll want to block this in other places also, like in ADD COLUMN and SET DEFAULT

perhaps we could add one helper function where we check if the type is allowed so we can use it in a few places.

Done


pkg/workload/schemachange/operation_generator.go line 4838 at r2 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

super nit: it could be called inMixedVersionState, since technically the whole test could be considered a "mixed version test"

Good point.

@spilchen
Copy link
Contributor Author

spilchen commented Nov 7, 2024

TFTR!

bors r+

@craig craig bot merged commit 16a78de into cockroachdb:master Nov 7, 2024
23 checks passed
Copy link

blathers-crl bot commented Nov 7, 2024

Based on the specified backports for this PR, I applied new labels to the following linked issue(s). Please adjust the labels as needed to match the branches actually affected by the issue(s), including adding any known older branches.


Issue #133339: branch-release-23.2, branch-release-24.1, branch-release-24.2.


Issue #133790: branch-release-24.1, branch-release-24.2, branch-release-24.3.


Issue #131162: branch-release-23.2, branch-release-24.1, branch-release-24.2, branch-release-24.3.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Copy link

blathers-crl bot commented Nov 7, 2024

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from b66f3b7 to blathers/backport-release-23.2-134407: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 23.2.x failed. See errors above.


error creating merge commit from b66f3b7 to blathers/backport-release-24.1-134407: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 24.1.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.2.x Flags PRs that need to be backported to 23.2. backport-24.1.x Flags PRs that need to be backported to 24.1. backport-24.2.x Flags PRs that need to be backported to 24.2 backport-24.3.x Flags PRs that need to be backported to 24.3
Projects
None yet
3 participants