Skip to content

sql: SHOW RANGES does not show start/end keys #80906

@erikgrinaker

Description

@erikgrinaker

Describe the problem

The SHOW RANGES command appears to not emit the start_key and end_key of the ranges. They are always NULL.

To Reproduce

root@localhost:26257/defaultdb> SHOW RANGES FROM DATABASE system;
            table_name            | start_key | end_key | range_id | range_size_mb | lease_holder |               lease_holder_locality               |  replicas   |                                                                                                                          replica_localities
----------------------------------+-----------+---------+----------+---------------+--------------+---------------------------------------------------+-------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  comments                        | NULL      | NULL    |       20 |             0 |            4 | cloud=gce,region=europe-west1,zone=europe-west1-b | {1,2,3,4,5} | {"cloud=gce,region=europe-west1,zone=europe-west1-b","cloud=gce,region=europe-west1,zone=europe-west1-b","cloud=gce,region=europe-west1,zone=europe-west1-b","cloud=gce,region=europe-west1,zone=europe-west1-b","cloud=gce,region=europe-west1,zone=europe-west1-b"}

This is because it strips the table prefix from the keys, but the key bounds in a single-range table are just e.g. /Table/50 and /Table/51, so the entire key is stripped, yielding NULL.

This is really misleading. We should show the complete key. Discussed in https://cockroachlabs.slack.com/archives/C0KB9Q03D/p1660947554266819.

Additional data / screenshots

Seen on both master, 21.2.9 and 21.2.10.

Jira issue: CRDB-15457

Epic CRDB-22701

Metadata

Metadata

Assignees

Labels

A-kv-observabilityC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.T-kvKV Team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions