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 version gate to regrole type #70531

Merged
merged 1 commit into from
Sep 23, 2021

Conversation

RichardJCai
Copy link
Contributor

Without the version gate, in a mixed cluster setting, creating
a table on the new binary version with type REGROLE can cause
errors when inserting on the old verison.

Errors can also happen on schema changes where the old binary uses
the new type.

Release justification: GA blocker, without a version gate this can
cause panics.
Release note: None. Not in production.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@RichardJCai RichardJCai force-pushed the version_gate_regrole_09212021 branch from 9115e15 to 24d2ece Compare September 21, 2021 21:10
Copy link
Member

@nvanbenschoten nvanbenschoten left a comment

Choose a reason for hiding this comment

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

Thanks!

Reviewed 10 of 10 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner and @RichardJCai)


pkg/sql/types/minimum_type_version.go, line 16 at r1 (raw file):

// minimumTypeUsageVersions defines the minimum version needed for a new
// data type.

nit: consider adding a comment here advising people not to remove this map and the IsTypeSupportedInVersion function even if it ever drops to being empty temporarily.

@ajwerner
Copy link
Contributor

Let's just piggy-back on some other version added in this cycle. I don't think we need to add a new one.

@RichardJCai
Copy link
Contributor Author

Let's just piggy-back on some other version added in this cycle. I don't think we need to add a new one.

Ack, does it make sense to piggy back off MarkerDataKeysRegistry here - the last version added.
https://github.com/cockroachdb/cockroach/blob/release-21.2/pkg/clusterversion/cockroach_versions.go#L473

Added in:
f79c56d#diff-8f32466c40e6960b988c87d7e2453c01a591d420af123f0963959da8e580f2e4

Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

Fine by me. How about we add a const in the sql package that has a useful name and is equal to the clusterversion key you choose. That can be a good place to anchor the comment. Then the version check will look like it makes sense.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @RichardJCai)

@RichardJCai RichardJCai force-pushed the version_gate_regrole_09212021 branch from 24d2ece to 300bdd9 Compare September 22, 2021 16:09
Copy link
Contributor Author

@RichardJCai RichardJCai left a comment

Choose a reason for hiding this comment

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

Added an alias for MarkerDataKeysRegistry in the minimum_type_version file.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @nvanbenschoten, @rafiss, and @RichardJCai)

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.

lgtm after fixing html docs!

@@ -170,6 +170,6 @@
<tr><td><code>trace.debug.enable</code></td><td>boolean</td><td><code>false</code></td><td>if set, traces for recent requests can be seen at https://<ui>/debug/requests</td></tr>
<tr><td><code>trace.lightstep.token</code></td><td>string</td><td><code></code></td><td>if set, traces go to Lightstep using this token</td></tr>
<tr><td><code>trace.zipkin.collector</code></td><td>string</td><td><code></code></td><td>if set, traces go to the given Zipkin instance (example: '127.0.0.1:9411'). Only one tracer can be configured at a time.</td></tr>
<tr><td><code>version</code></td><td>version</td><td><code>21.1-1164</code></td><td>set the active cluster version in the format '<major>.<minor>'</td></tr>
<tr><td><code>version</code></td><td>version</td><td><code>21.1-1166</code></td><td>set the active cluster version in the format '<major>.<minor>'</td></tr>
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think these docs changes should be reverted now

Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

LGTM

@RichardJCai RichardJCai force-pushed the version_gate_regrole_09212021 branch from 300bdd9 to 9cae889 Compare September 23, 2021 15:09
Without the version gate, in a mixed cluster setting, creating
a table on the new binary version with type REGROLE can cause
errors when inserting on the old verison.

Errors can also happen on schema changes where the old binary uses
the new type.

Release justification: GA blocker, without a version gate this can
cause panics.
Release note: None. Not in production.
@RichardJCai RichardJCai force-pushed the version_gate_regrole_09212021 branch from 9cae889 to ee90182 Compare September 23, 2021 17:57
Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

:lgtm_strong:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @ajwerner, @nvanbenschoten, @rafiss, and @RichardJCai)

@RichardJCai
Copy link
Contributor Author

TFTR!
bors r+

@craig
Copy link
Contributor

craig bot commented Sep 23, 2021

Build succeeded:

@craig craig bot merged commit 5cc0f19 into cockroachdb:master Sep 23, 2021
Copy link
Member

@yuzefovich yuzefovich 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/sql/types/minimum_type_version.go, line 16 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

nit: consider adding a comment here advising people not to remove this map and the IsTypeSupportedInVersion function even if it ever drops to being empty temporarily.

@RichardJCai @nvanbenschoten Just stumbled across this code and wondering why we have this recommendation to not remove the map even it becomes empty? Is it so that in the future, when we will need a similar version gate, we already have the necessary infrastructure?

@RichardJCai
Copy link
Contributor Author

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

pkg/sql/types/minimum_type_version.go, line 16 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
@RichardJCai @nvanbenschoten Just stumbled across this code and wondering why we have this recommendation to not remove the map even it becomes empty? Is it so that in the future, when we will need a similar version gate, we already have the necessary infrastructure?

Yeah that is exactly why, so we have the necessary infrastructure.

@RichardJCai RichardJCai deleted the version_gate_regrole_09212021 branch March 2, 2022 15:44
Copy link
Member

@yuzefovich yuzefovich 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/sql/types/minimum_type_version.go, line 16 at r1 (raw file):

Previously, RichardJCai (Richard Cai) wrote…

Yeah that is exactly why, so we have the necessary infrastructure.

I see, thanks. I'll probably remove it though in #77260 in order to break the dependency of sql/types on roachpb (via clusterversion). Do you have strong feelings about it?

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.

6 participants