-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: backward-compatibility for SHOW RANGES / crdb_internal.ranges #98979
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f0e22c3
to
abca78d
Compare
abca78d
to
c575203
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing major just minor nits
Reviewed 4 of 4 files at r1, 25 of 25 files at r2, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @irfansharif and @knz)
pkg/sql/crdb_internal_ranges_deprecated.go
line 34 at r2 (raw file):
// version of `crdb_internal.ranges`. See the package-level doc // of package `deprecatedshowranges` for details. var crdbInternalRangesViewDEPRECATED = virtualSchemaView{
Maybe just add a version number instead and have a TODO for removal
pkg/sql/virtual_schema.go
line 445 at r2 (raw file):
case id == catconstants.CrdbInternalRangesViewID && deprecatedshowranges.EnableDeprecatedBehavior(context.TODO(), vs.st, nil): entry = vs.schemasByID[catconstants.CrdbInternalID].extraRangesDef case id == catconstants.CrdbInternalRangesNoLeasesTableID && deprecatedshowranges.EnableDeprecatedBehavior(context.TODO(), vs.st, nil):
Can we pipe in a context too?
pkg/sql/virtual_schema.go
line 1000 at r2 (raw file):
// Remove in v23.2. st: st, extraRangesDef: extra1,
Instead of extra just label them as deprecated or with the version
d32e975
to
68e8730
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @fqazi and @irfansharif)
pkg/sql/crdb_internal_ranges_deprecated.go
line 34 at r2 (raw file):
Previously, fqazi (Faizan Qazi) wrote…
Maybe just add a version number instead and have a TODO for removal
Done.
pkg/sql/virtual_schema.go
line 445 at r2 (raw file):
Previously, fqazi (Faizan Qazi) wrote…
Can we pipe in a context too?
I tried - but then I need to change the interface in catalog
which then requires me to change (*byIDLookupContext).lookupVirtual
in catalog/desc
, which then requires me to change all the other lookupFunc
s. That's too much change for this PR.
pkg/sql/virtual_schema.go
line 1000 at r2 (raw file):
Previously, fqazi (Faizan Qazi) wrote…
Instead of extra just label them as deprecated or with the version
Done.
68e8730
to
3d12987
Compare
This change introduces a new stage during planning, which upon encountering a planning error adds additional user-facing hints to the error payload. We will be able to extend this over time to make suggestions on how to enhance a query to avoid error. As an example application, this change enhances errors about now-removed columns in `crdb_internal.ranges`, `ranges_no_leases` and the output of `SHOW RANGES`. For example: ``` [email protected]:26257/movr> select lease_holder from [show ranges from table users]; ERROR: column "lease_holder" does not exist SQLSTATE: 42703 HINT: To list lease holder and range size details, consider SHOW RANGES WITH DETAILS. -- There are more SHOW RANGES options. Refer to the online documentation or execute 'SHOW RANGES ??' for details. ``` ``` [email protected]:26257/movr> select database_name,table_name from crdb_internal.ranges; ERROR: column "database_name" does not exist SQLSTATE: 42703 DETAIL: SELECT database_name, table_name FROM crdb_internal.ranges HINT: To list all ranges across all databases and display the database name, consider SHOW CLUSTER RANGES WITH TABLES. -- There are more SHOW RANGES options. Refer to the online documentation or execute 'SHOW RANGES ??' for details. ``` Release note: None
3d12987
to
4517873
Compare
…eases}` TLDR: the pre-v23.1 behavior of SHOW RANGES and `crdb_internal.ranges{_no_leases}` is made available conditional on a new cluster setting `sql.show_ranges_deprecated_behavior.enabled`. It is set to true by default in v23.1, however any use of the feature will prompt a SQL notice with the following message: ``` NOTICE: attention! the pre-23.1 behavior of SHOW RANGES and crdb_internal.ranges{,_no_leases} is deprecated! HINT: Consider enabling the new functionality by setting 'sql.show_ranges_deprecated_behavior.enabled' to 'false'. The new SHOW RANGES statement has more options. Refer to the online documentation or execute 'SHOW RANGES ??' for details. ``` The deprecated behavior is also disabled in the test suite and in `cockroach demo`, i.e. the tests continue to exercise the new behavior. cf. doc for new package `deprecatedshowranges`: ``` // Package deprecatedshowranges exists to smoothen the transition // between the pre-v23.1 semantics of SHOW RANGES and // crdb_internal.ranges{_no_leases}, and the new semantics introduced // in v23.1. // // The pre-v23.1 semantics are deprecated as of v23.1. At the end of // the deprecation cycle (hopefully for v23.2) we expect to delete // this package entirely and all the other code in the SQL layer that // hangs off the EnableDeprecatedBehavior() conditional defined below. // // The mechanism to control the behavior is as follows: // // - In any case, an operator can override the behavior using an env // var, "COCKROACH_FORCE_DEPRECATED_SHOW_RANGE_BEHAVIOR". // If set (to a boolean), the value of the env var is used in // all cases. // We use this env var to force the _new_ behavior through out // test suite, regardless of the other conditions. This allows // us to avoid maintaining two sets of outputs in tests. // // - If the env var is not set, the cluster setting // `sql.show_ranges_deprecated_behavior.enabled` is used. It // defaults to true in v23.1 (the "smoothening" part). // // - If the deprecated behavior is chosen by any of the above // mechanisms, and _the range coalescing cluster setting_ is set // to true, a loud warning will be reported in various places. // This will nudge users who wish to opt into range coalescing // to adapt their use of the range inspection accordingly. ``` Release note (backward-incompatible change): The pre-v23.1 output produced by `SHOW RANGES`, `crdb_internal.ranges`, `crdb_internal.ranges_no_leases` is deprecated. The new interface and functionality for `SHOW RANGES` can be enabled by changing the cluster setting `sql.show_ranges_deprecated_behavior.enabled` to `false`. It will become default in v23.2.
4517873
to
87afa37
Compare
TYFRs! bors r=cucaroach,fqazi |
Build succeeded: |
@knz Is there a reason to keep this in Backward-Incompatible Changes rather than Deprecations? It looks like we maintain the behavior of v22.2 by default in v23.1, though it is deprecated in v23.1 and will change by default in v23.2. |
I chose that category to increase the chance the doc writer who sees it will go back to the earlier release note in the release cycle that was marking the output as deprecated, and revise it. Customers are going to look at the combined list of deprecation notices across the entire 23.1 release and we need to build a consistent messaging, by editing the earlier release note. |
@knz I see. Thanks. Indeed I'd aggregated all prior Backward-Incompatible Changes and that captured all the |
i added some comments to that PR thanks |
Requested by @mwang1026 and @nvanbenschoten .
Fixes #97861.
Fixes #99073.
Needed for #98820.
Epic: CRDB-24928
See the individual commits for details; exceprt from the 2nd commit:
TLDR: the pre-v23.1 behavior of SHOW RANGES and
crdb_internal.ranges{_no_leases}
is made available conditional on anew cluster setting
sql.show_ranges_deprecated_behavior.enabled
.It is set to true by default in v23.1, however any use of the feature
will prompt a SQL notice with the following message:
The deprecated behavior is also disabled in the test suite and by default in
cockroach demo
, i.e. the tests continue to exercise the newbehavior.
Release note (backward-incompatible change): The pre-v23.1 output
produced by
SHOW RANGES
,crdb_internal.ranges
,crdb_internal.ranges_no_leases
is deprecated. The new interface andfunctionality for
SHWO RANGES
can be enabled by changing the clustersetting
sql.show_ranges_deprecated_behavior.enabled
tofalse
. Itwill become default in v23.2.