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: better SHOW RANGES and changes to crdb_internal.ranges{,_no_leases} #93644

Merged
merged 1 commit into from
Dec 22, 2022

Conversation

knz
Copy link
Contributor

@knz knz commented Dec 14, 2022

Fixes #93617.
Fixes #80906.
Fixes #93198.
Epic: CRDB-22701

The output of crdb_internal.ranges{,_no_leases} and SHOW RANGES was irreparably broken by the introduction of range coalescing
(ranges spanning multiple tables/databases).

Moreover, the start/end keys of SHOW RANGES were often empty or
NULL due to incorrect/excessive truncation.

This commit fixes this by introducing a new design for SHOW RANGES
and tweaking the definition of crdb_internal.ranges{,_no_leases}.

Note: THIS IS A BREAKING CHANGE. See the "backward-incompatible
change" release notes below for suggestions on updating client code.


Short documentation.

The revised syntax is now:

  SHOW CLUSTER RANGES [WITH <options>]
  SHOW RANGES [FROM DATABASE <dbname> | FROM CURRENT_CATALOG] [ WITH <options> ]
  SHOW RANGES FROM TABLE <tablename> [ WITH <options> ]
  SHOW RANGES FROM INDEX <idxname> [ WITH <options> ]

  <options> is a combination of TABLES, INDEXES, KEYS, DETAILS and EXPLAIN.

New syntax: SHOW CLUSTER RANGES, SHOW RANGES with no FROM, FROM CURRENT_CATALOG, WITH clause.

In summary, we have:

  • SHOW CLUSTER RANGES which includes all ranges, including those not
    belonging to any table.
  • SHOW RANGES [FROM DATABASE | FROM CURRENT_CATALOG] which includes
    only ranges overlapping with any table in the target db.
    Note: SHOW RANGES without target (NEW!) is an alias for SHOW RANGES FROM CURRENT_CATALOG.
  • SHOW RANGES FROM TABLE selects only ranges that overlap with the
    given table.
  • SHOW RANGES FROM INDEX selects only ranges that overlap with the
    given index.

Then:

  • if WITH TABLES is specified, the rows are duplicated to detail
    each table included in each range (1 row per range-table
    intersection).
  • if WITH INDEXES is specified, the rows are duplicated to detail each
    index included in each range (1 row per range-index intersection).
  • otherwise, there is just 1 row per range.

In summary:

Statement Row identity Before After
SHOW RANGES FROM DATABASE rangeID Includes schema/table name (CHANGE) No schema/table name
SHOW RANGES FROM TABLE rangeID Includes index name (CHANGE) No index name
SHOW RANGES FROM INDEX rangeID Includes index name Unchanged
SHOW RANGES FROM DATABASE ... WITH TABLES (NEW) rangeID, schema/table name N/A Includes schema/table name
SHOW RANGES FROM DATABASE ... WITH INDEXES (NEW) rangeID, schema/table/index name N/A Includes schema/table/index name
SHOW RANGES FROM TABLE ... WITH INDEXES (NEW) rangeID, index name N/A Includes index name
SHOW CLUSTER RANGES (NEW) rangeID N/A
SHOW CLUSTER RANGES WITH TABLES (NEW) rangeID, schema/table name N/A Includes db/schema/table name
SHOW CLUSTER RANGES WITH INDEXES (NEW) rangeID, schema/table/index name N/A Includes db/sch/table/index name
Statement Start/end key column, before Start/end key column, after
SHOW RANGES FROM DATABASE Truncates table/index IDs (CHANGE) Includes table/index ID
SHOW RANGES FROM TABLE Truncates table/index IDs (CHANGE) Includes table/index ID
SHOW RANGES FROM INDEX Truncates table/index IDs Unchanged
SHOW RANGES FROM DATABASE ... WITH TABLES (NEW) N/A Includes table/index ID
SHOW RANGES FROM DATABASE ... WITH INDEXES (NEW) N/A Includes table/index ID
SHOW RANGES FROM TABLE ... WITH INDEXES (NEW) N/A Truncates table ID, includes index ID
SHOW CLUSTER RANGES (NEW) N/A Includes table/index ID
SHOW CLUSTER RANGES WITH TABLES (NEW) N/A Includes table/index ID
SHOW CLUSTER RANGES WITH INDEXES (NEW) N/A Includes table/index ID

In any case, all the columns from crdb_internal.ranges_no_leases are
included. By default, the start/end key boundaries are pretty-printed
as in previous versions.

Then:

  • if WITH KEYS is specified, the raw key bytes are exposed alongside
    the pretty-printed key boundaries.
  • if WITH DETAILS is specified, extra expensive information is
    included in the result, as of crdb_internal.ranges.
    (requires more roundtrips; makes the operation slower overall)

Then:

  • if WITH EXPLAIN is specified, the statement simply returns the
    text of the SQL query it would use if WITH EXPLAIN was not
    specified. This can be used for learning or troubleshooting.

See text of release notes below for more details; also the explanatory
comment at the top of pkg/sql/delegate/show_ranges.go.


Example use.

To test this, use for example the following setup:

> -- Enable merge of adjacent ranges with same zone config.
> set cluster setting spanconfig.host_coalesce_adjacent.enabled = true;
> -- Table t has two indexes with some split points.
> create table t(x int primary key, y int);
> create index sec_idx on t(y);
> alter index t@primary split at values(3);
> alter index t@sec_idx split at values(3);
> -- Tables u and v share a range with t@sec_idx.
> create table u(x int);
> create table v(x int);
> -- Make some other tables with forced split points due to different
> -- zone configs.
> create schema otherschema;
> create table otherschema.w(x int);
> create table otherschema.z(x int);
> alter table otherschema.w configure zone using num_replicas = 5;
> alter table otherschema.z configure zone using num_replicas = 7;

Example output for SHOW RANGES FROM DATABASE:

> show ranges from database defaultdb; -- 1 row per range
> show ranges from current_catalog; -- implicit db from session

    start_key    |    end_key     | range_id | ...
-----------------+----------------+----------+----
  /Table/104     | /Table/104/1/3 |       56 | ...
  /Table/104/1/3 | /Table/104/2   |       57 | ...
  /Table/104/2   | /Table/104/2/3 |       55 | ...
  /Table/104/2/3 | /Table/108     |       58 | ...
  /Table/108     | /Table/109     |       59 | ...
  /Table/109     | /Max           |       60 | ...

New syntax: WITH TABLES / WITH INDEXES:

> show ranges from database defaultdb with tables; -- 1 row per range/table intersection

    start_key    |    end_key     | range_id | schema_name | table_name | table_start_key |    table_end_key     | ...
-----------------+----------------+----------+-------------+------------+-----------------+----------------------+----
  /Table/104     | /Table/104/1/3 |       56 | public      | t          | /Table/104      | /Table/105           | ...
  /Table/104/1/3 | /Table/104/2   |       57 | public      | t          | /Table/104      | /Table/105           | ...
  /Table/104/2   | /Table/104/2/3 |       55 | public      | t          | /Table/104      | /Table/105           | ...
  /Table/104/2/3 | /Table/108     |       58 | public      | t          | /Table/104      | /Table/105           | ...
  /Table/104/2/3 | /Table/108     |       58 | public      | u          | /Table/105      | /Table/106           | ...
  /Table/104/2/3 | /Table/108     |       58 | public      | v          | /Table/106      | /Table/107           | ...
  /Table/108     | /Table/109     |       59 | otherschema | w          | /Table/108      | /Table/109           | ...
  /Table/109     | /Max           |       60 | otherschema | z          | /Table/109      | /Table/109/PrefixEnd | ...
> show ranges from database defaultdb with indexes; -- 1 row per range/index intersection

    start_key    |    end_key     | range_id | schema_name | table_name | index_name | index_start_key | index_end_key | ...
-----------------+----------------+----------+-------------+------------+------------+-----------------+---------------+----
  /Table/104     | /Table/104/1/3 |       56 | public      | t          | t_pkey     | /Table/104/1    | /Table/104/2  | ...
  /Table/104/1/3 | /Table/104/2   |       57 | public      | t          | t_pkey     | /Table/104/1    | /Table/104/2  | ...
  /Table/104/2   | /Table/104/2/3 |       55 | public      | t          | sec_idx    | /Table/104/2    | /Table/104/3  | ...
  /Table/104/2/3 | /Table/108     |       58 | public      | t          | sec_idx    | /Table/104/2    | /Table/104/3  | ...
  /Table/104/2/3 | /Table/108     |       58 | public      | u          | u_pkey     | /Table/105/1    | /Table/105/2  | ...
  /Table/104/2/3 | /Table/108     |       58 | public      | v          | v_pkey     | /Table/106/1    | /Table/106/2  | ...
  /Table/108     | /Table/109     |       59 | otherschema | w          | w_pkey     | /Table/108/1    | /Table/108/2  | ...
  /Table/109     | /Max           |       60 | otherschema | z          | z_pkey     | /Table/109/1    | /Table/109/2  | ...

Example output for SHOW RANGES FROM TABLE:

> show ranges from table t;

   start_key   |      end_key       | range_id | ...
---------------+--------------------+----------+----
  …/<TableMin> | …/1/3              |       56 | ...
  …/1/3        | …/2                |       57 | ...
  …/2          | …/2/3              |       55 | ...
  …/2/3        | <after:/Table/108> |       58 | ...
> show ranges from table u;

         start_key        |      end_key       | range_id | ...
--------------------------+--------------------+----------+----
  <before:/Table/104/2/3> | <after:/Table/108> |       58 | ...
> show ranges from table otherschema.w;

  start_key    |  end_key     | range_id | ...
---------------+--------------+----------+----
  …/<TableMin> | …/<TableMax> |       59 | ...

New syntax: SHOW RANGES FROM TABLE ... WITH INDEXES:

> show ranges from table t with indexes;

  start_key    |      end_key       | range_id | index_name | index_start_key | index_end_key | ...
---------------+--------------------+----------+------------+-----------------+---------------+----
  …/<TableMin> | …/1/3              |       56 | t_pkey     | …/1             | …/2           | ...
  …/1/3        | …/<IndexMax>       |       57 | t_pkey     | …/1             | …/2           | ...
  …/<IndexMin> | …/2/3              |       55 | sec_idx    | …/2             | …/3           | ...
  …/2/3        | <after:/Table/108> |       58 | sec_idx    | …/2             | …/3           | ...
> show ranges from table u with indexes;

         start_key        |      end_key       | range_id | index_name | index_start_key | index_end_key | ...
--------------------------+--------------------+----------+------------+-----------------+---------------+----
  <before:/Table/104/2/3> | <after:/Table/108> |       58 | u_pkey     | …/1             | …/2           | ...
> show ranges from table otherschema.w with indexes;

  start_key    |  end_key     | range_id | index_name | index_start_key | index_end_key | ...
---------------+--------------+----------+------------+-----------------+---------------+----
  …/<TableMin> | …/<TableMax> |       59 | w_pkey     | …/1             | …/2           | ...

Example output for SHOW RANGES FROM INDEX:

> show ranges from index t@t_pkey;

  start_key    |  end_key     | range_id | ...
---------------+--------------+----------+----
  …/<TableMin> | …/3          |       56 | ...
  …/3          | …/<IndexMax> |       57 | ...
> show ranges from index t@sec_idx;

  start_key    |      end_key       | range_id | ...
---------------+--------------------+----------+----
  …/<IndexMin> | …/3                |       55 | ...
  …/3          | <after:/Table/108> |       58 | ...
> show ranges from index u@u_pkey;

         start_key        |      end_key       | range_id | ...
--------------------------+--------------------+----------+----
  <before:/Table/104/2/3> | <after:/Table/108> |       58 | ...
> show ranges from index otherschema.w@w_pkey;

  start_key    |  end_key     | range_id | ...
---------------+--------------+----------+----
  …/<TableMin> | …/<TableMax> |       59 | ...

See release notes below for details.


attention banner

Backward-incompatible changes.

Release note (backward-incompatible change): CockroachDB now supports
sharing storage ranges across multiple indexes/tables. As a result,
there is no more guarantee that there is at most one SQL object (e.g.
table/index/sequence/materialized view) per storage range.

Therefore, the columns table_id, database_name, schema_name,
table_name and index_name in crdb_internal.ranges and
.ranges_no_leases have become nonsensical: a range cannot be
attributed to a single table/index any more.

As a result:

  • The aforementioned columns in the crdb_internal virtual tables
    have been removed. Existing code can use the SHOW RANGES
    statement instead, optionally using WITH KEYS to expose
    the raw start/end keys.

  • SHOW RANGES FROM DATABASE continues to report one row per range,
    but stops returning the database / schema / table / index name.

  • SHOW RANGES FROM TABLE continues to report one row per range,
    but stops returning the index name.

Suggested replacements:

  • Instead of SELECT range_id FROM crdb_internal.ranges WHERE table_name = 'x'

    Use: SELECT range_id FROM [SHOW RANGES FROM TABLE x]

  • Instead of SELECT range_id FROM crdb_internal.ranges WHERE table_name = $1 OR table_id = $2
    (variable / unpredictable table name or ID)

    Use: SELECT range_id FROM [SHOW RANGES FROM CURRENT_CATALOG WITH TABLES] WHERE table_name = $1 OR table_id = $2

  • Instead of SELECT start_key FROM crdb_internal.ranges WHERE table_name = 'x'

    Use: SELECT raw_start_key FROM [SHOW RANGES FROM TABLE x WITH KEYS]

  • Instead of SELECT start_key FROM crdb_internal.ranges WHERE table_name = $1 OR table_id = $2
    (unpredictable / variable table name or ID)

    Use: SELECT raw_start_key FROM [SHOW RANGES FROM CURRENT_CATALOG WITH TABLES, KEYS] WHERE table_name = $1 OR table_id = $2

Release note (backward-incompatible change): The format of the
columns start_key and end_key for SHOW RANGES FROM DATABASE
and SHOW RANGES FROM TABLE have been extended to include which
table/index the key belongs to. This is necessary because a range
can now contain data from more than one table/index.

Release note (backward-incompatible change): The format of
the columns start_key and end_key for SHOW RANGE ... FOR ROW
has been changed to stay consistent with the output of SHOW RANGES FROM INDEX.

Release note (backward-incompatible change): The output of SHOW RANGES does not include range_size, range_size_mb, lease_holder
and lease_holder_localities any more by default. This ensures that
SHOW RANGES remains fast in the common case. Use the (NEW) option
WITH DETAILS to include these columns.


Other changes.

Release note (bug fix): In some cases the start/end key columns of the
output of SHOW RANGES was missing. This was corrected.

Release note (sql change): Two new virtual tables
crdb_internal.index_spans and .table_spans have been introduced,
which list the logical keyspace used by each index/table.


New features.

Release note (sql change): The following new statements are
introduced:

  • SHOW RANGES FROM CURRENT_CATALOG and SHOW RANGES without
    parameter: alias for SHOW RANGES FROM DATABASE on the session's
    current database.

  • SHOW RANGES FROM DATABASE ... WITH TABLES
    Reports at least one row per table. It's possible for the same
    range ID to be repeated across multiple rows, when a range spans
    multiple tables.

  • SHOW RANGES FROM DATABASE ... WITH INDEXES
    Reports at least one row per index. It's possible for the same
    range ID to be repeated across multiple rows, when a range spans
    multiple indexes.

  • SHOW RANGES FROM TABLE ... WITH INDEXES
    Reports at least one row per index. It's possible for the same
    range ID to be repeated across multiple rows, when a range spans
    multiple indexes.

  • SHOW CLUSTER RANGES [ WITH { INDEXES | TABLES } ] Reports ranges
    across the entire cluster, including ranges that don't contain table
    data. The behavior of WITH INDEXES and WITH TABLES is the same
    as for SHOW RANGES FROM DATABASE.

Additionally, the following new options have been added to the SHOW RANGES statement:

  • WITH KEYS: produce the raw bytes of the start/end key boundaries.
  • WITH DETAILS: produce more details, using computations that
    require extra network roundtrips. Makes the operation slower
    overall.
  • WITH EXPLAIN: produce the text of the SQL query used to
    run the statement.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@knz knz force-pushed the 20221214-show-ranges branch 5 times, most recently from 4236e48 to 9f83fca Compare December 15, 2022 21:20
@knz knz added the A-multitenancy Related to multi-tenancy label Dec 15, 2022
@knz knz force-pushed the 20221214-show-ranges branch 2 times, most recently from 283d96b to 47a4ca1 Compare December 16, 2022 11:37
@knz
Copy link
Contributor Author

knz commented Dec 16, 2022

todo: update commit message with the new WITH clause

@knz knz force-pushed the 20221214-show-ranges branch 2 times, most recently from b30034d to 2a3c34a Compare December 16, 2022 19:46
@knz knz marked this pull request as ready for review December 16, 2022 20:48
@knz knz requested review from a team as code owners December 16, 2022 20:48
@knz knz requested review from a team December 16, 2022 20:48
@knz knz requested review from a team as code owners December 16, 2022 20:48
@knz knz requested review from rhu713 and miretskiy and removed request for a team December 16, 2022 20:48
@knz
Copy link
Contributor Author

knz commented Dec 16, 2022

This is good to go now.
Can I get review from:

  • @ecwall for the SQL bits
  • @arulajmani to review the proposed semantics (as per commit message + doc in sql/delegate/show_ranges.go) to see if this suitably solves the problem at hand.

cc @ajwerner since we chatted about it.

craig bot pushed a commit that referenced this pull request Dec 23, 2022
94233: roachtest: update `failover` tests to use `SHOW RANGES` r=erikgrinaker a=erikgrinaker

This patch updates the `failover` roachtests to use the new `SHOW RANGES` syntax, because of the recent `crdb_internal.ranges` changes.

Resolves #94218.
Resolves #94217.
Resolves #94216.
Resolves #94215.
Resolves #94214.
Resolves #94213.
Resolves #94212.
Resolves #94210.
Touches #93644.

Epic: none
Release note: None

Co-authored-by: Erik Grinaker <grinaker@cockroachlabs.com>
@knz knz deleted the 20221214-show-ranges branch January 10, 2023 08:00
irfansharif added a commit to irfansharif/cockroach that referenced this pull request May 7, 2023
Fixes cockroachdb#81008.

We built the basic infrastructure to coalesce ranges across table
boundaries back in 22.2 as part of cockroachdb#66063. We've enabled this
optimization for secondary tenants since then, but hadn't for the system
tenant because of two primary blockers:

- cockroachdb#93617: SHOW RANGES was broken by coalesced ranges.
- cockroachdb#84105: APIs to compute sizes for schema objects (used in our UI) was
  broken by coalesced ranges.

In both these cases we baked in assumptions about there being a minimum
of one-{table,index,partition}-per-range. These blockers didn't apply to
secondary tenants at the time since they didn't have access to SHOW
RANGES, nor the UI pages where these schema statistics were displayed.

We've addressed both these blockers in the 23.1 cycle as part of
bridging the compatibility between secondary tenants and yesteryear's
system tenant.
- cockroachdb#93644 revised SHOW RANGES and crdb_internal.ranges{,_no_leases}, both
  internally and its external UX, to accommodate ranges straddling
  table/database boundaries.
- cockroachdb#96223 re-worked our SpanStats API to work in the face of coalesced
  ranges, addressing cockroachdb#84105.

Release note (general change): CockroachDB would previously use separate
ranges for each table, index, or partition. This is no longer true --
it's possible now to have multiple tables, indexes, and partitions to
get packed into the same range. For users with many such "schema
objects", this will reduce the total range count in their clusters. This
is especially true if individual tables, indexes, or partitions are
smaller than the default configured maximum range size (controlled using
zone configs, specifically the range_max_bytes parameter).
We made this change to improve scalability with respect to the number of
schema objects, since the underlying range count now no longer a
bottleneck. Users upgrading from 22.2, once finalizing their upgrade,
may observe a round of range merges and snapshot transfers (to power
said range merges) as a result of this change. If users want to opt-out
of this optimization, they can use the following cluster setting:

  SET CLUSTER SETTING spanconfig.storage_coalesce_adjacent.enabled = false;
irfansharif added a commit to irfansharif/cockroach that referenced this pull request May 8, 2023
Fixes cockroachdb#81008.

We built the basic infrastructure to coalesce ranges across table
boundaries back in 22.2 as part of cockroachdb#66063. We've enabled this
optimization for secondary tenants since then, but hadn't for the system
tenant because of two primary blockers:

- cockroachdb#93617: SHOW RANGES was broken by coalesced ranges.
- cockroachdb#84105: APIs to compute sizes for schema objects (used in our UI) was
  broken by coalesced ranges.

In both these cases we baked in assumptions about there being a minimum
of one-{table,index,partition}-per-range. These blockers didn't apply to
secondary tenants at the time since they didn't have access to SHOW
RANGES, nor the UI pages where these schema statistics were displayed.

We've addressed both these blockers in the 23.1 cycle as part of
bridging the compatibility between secondary tenants and yesteryear's
system tenant.
- cockroachdb#93644 revised SHOW RANGES and crdb_internal.ranges{,_no_leases}, both
  internally and its external UX, to accommodate ranges straddling
  table/database boundaries.
- cockroachdb#96223 re-worked our SpanStats API to work in the face of coalesced
  ranges, addressing cockroachdb#84105.

Release note (general change): CockroachDB would previously use separate
ranges for each table, index, or partition. This is no longer true --
it's possible now to have multiple tables, indexes, and partitions to
get packed into the same range. For users with many such "schema
objects", this will reduce the total range count in their clusters. This
is especially true if individual tables, indexes, or partitions are
smaller than the default configured maximum range size (controlled using
zone configs, specifically the range_max_bytes parameter).
We made this change to improve scalability with respect to the number of
schema objects, since the underlying range count now no longer a
bottleneck. Users upgrading from 22.2, once finalizing their upgrade,
may observe a round of range merges and snapshot transfers (to power
said range merges) as a result of this change. If users want to opt-out
of this optimization, they can use the following cluster setting:

  SET CLUSTER SETTING spanconfig.storage_coalesce_adjacent.enabled = false;
craig bot pushed a commit that referenced this pull request May 8, 2023
98820: spanconfig: enable range coalescing by default r=irfansharif a=irfansharif

Fixes #81008.

We built the basic infrastructure to coalesce ranges across table boundaries back in 22.2 as part of #66063. We've enabled this optimization for secondary tenants since then, but hadn't for the system tenant because of two primary blockers:

- #93617: SHOW RANGES was broken by coalesced ranges.
- #84105: APIs to compute sizes for schema objects (used in our UI) was broken by coalesced ranges.

In both these cases we baked in assumptions about there being a minimum of one-{table,index,partition}-per-range. These blockers didn't apply to secondary tenants at the time since they didn't have access to SHOW RANGES, nor the UI pages where these schema statistics were displayed.

We've addressed both these blockers in the 23.1 cycle as part of bridging the compatibility between secondary tenants and yesteryear's system tenant.
- #93644 revised SHOW RANGES and crdb_internal.ranges{,_no_leases}, both internally and its external UX, to accommodate ranges straddling table/database boundaries.
- #96223 re-worked our SpanStats API to work in the face of coalesced ranges, addressing #84105.

Release note (general change): CockroachDB would previously use separate ranges for each table, index, or partition. This is no longer true -- it's possible now to have multiple tables, indexes, and partitions to get packed into the same range. For users with many such "schema objects", this will reduce the total range count in their clusters. This is especially true if individual tables, indexes, or partitions are smaller than the default configured maximum range size (controlled using zone configs, specifically the range_max_bytes parameter). We made this change to improve scalability with respect to the number of schema objects, since the underlying range count now no longer a bottleneck. Users upgrading from 22.2, once finalizing their upgrade, may observe a round of range merges and snapshot transfers (to power said range merges) as a result of this change. If users want to opt-out of this optimization, they can use the following cluster setting:
```
  SET CLUSTER SETTING spanconfig.storage_coalesce_adjacent.enabled = false; 
```

Co-authored-by: irfan sharif <irfanmahmoudsharif@gmail.com>
irfansharif added a commit to irfansharif/cockroach that referenced this pull request May 9, 2023
We enabled range coalescing by default in 23.2 as part of cockroachdb#98820.
Alongside that change, we want to flip the SHOW RANGES behavior to be
compatible with coalesced ranges, which this commit does. See cockroachdb#93644 and
the accompanying release notes.

Release note (backward-incompatible change): The pre-v23.1 output
produced by SHOW RANGES, crdb_internal.ranges,
crdb_internal.ranges_no_leases was deprecated in 23.1, and is now
replaced by default with output that's compatible with coalesced ranges
(i.e. ranges that pack multiple tables/indexes/partitions into
individual ranges). See the 23.1 release notes for SHOW RANGES for more
details.
craig bot pushed a commit that referenced this pull request May 9, 2023
101825: sql: add crdb_internal.pretty_value r=Xiang-Gu,msbutler a=stevendanna

This composes nicely with crdb_internal.scan to allow inspection of table data and other command line tools like cockroach debug pebble.

Epic: none

Release note: None

102907: workload: remove initial prefix from bank workload payload r=herkolategan,srosenberg a=renatolabs

An `initial-` prefix is added to the payload column of the `bank` table when the workload is initialized. It was introduced about 6 years ago [1] and its purpose at the time is not clear. There are two main problems with it:

* the `initial-` prefix suggests the payload may be updated, but that actually never happens.
* as currently implemented, it assumes that the `payload-bytes` command line flag is at least `len([]byte("initial-"))`. Passing a lower value to that command line flag leads to a panic. This is an implicit assumption that should not exist.

This changes the row generation function so that `payload-bytes` bytes are randomly generated and inserted into the `payload` column, without the `initial-` prefix.

[1] d49d535

Epic: none

Release note: None

102961: sql: default sql.show_ranges_deprecated_behavior.enabled to true r=irfansharif a=irfansharif

We enabled range coalescing by default in 23.2 as part of #98820. Alongside that change, we want to flip the SHOW RANGES behavior to be compatible with coalesced ranges, which this commit does. See #93644 and the accompanying release notes.

Release note (backward-incompatible change): The pre-v23.1 output produced by SHOW RANGES, crdb_internal.ranges,
crdb_internal.ranges_no_leases was deprecated in 23.1, and is now replaced by default with output that's compatible with coalesced ranges (i.e. ranges that pack multiple tables/indexes/partitions into individual ranges). See the 23.1 release notes for SHOW RANGES for more details.

Co-authored-by: Steven Danna <danna@cockroachlabs.com>
Co-authored-by: Renato Costa <renato@cockroachlabs.com>
Co-authored-by: irfan sharif <irfanmahmoudsharif@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-multitenancy Related to multi-tenancy
Projects
None yet
3 participants