cockroachdb / cockroachdb/cockroach
CLI cockroach node status does not show correct number of ranges for each node
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
**Describe the problem**
The `CLI`, when we run the command `cockroach node status --all` shows the total number of ranges for the entire cluster, and not the range count for a given node, as one might expect.
**To Reproduce**
The `CLI output shows the total ranges`, this `matches with the UI when you select the entire cluster`. However, when you select a specific host in the UI, the UI displays the number of ranges for that host only, whereas the CLI does not do this and shows the range count for all nodes.
1. `UI` shows the number of `all ranges when selecting CLUSTER from dropdown`, `i.e 51` (this is correct, nothing wrong here)

2. When we `select a specific host`, the `UI` is updated and only shows the number of ranges for that given host, `i.e 16` (this is correct, nothing wrong here)

3. **Unexpected behavior:** This is where the behavior at hand seems to be confusing. The `CLI`, when we run the command `cockroach node status --all` shows the total number of ranges for the entire cluster (`ranges = 51`), and not the range count for a given node (`ranges = 16`), as one might expect. Each node reports (resembling screenshot # 1 above), shouldn't this be the number of ranges in that particular node (resembling screenshot # 2 above)?
```
[root@cockroachdb-0 cockroach]# cockroach node status --all --certs-dir /cockroach/cockroach-certs --format records
-[ RECORD 1 ]
id | 1
address | cockroachdb-0.cockroachdb.cockroach-sts-secure.svc.cluster.local:26257
sql_address | cockroachdb-0.cockroachdb.cockroach-sts-secure.svc.cluster.local:26257
build | v22.2.5
started_at | 2023-03-21 20:01:29.303301 +0000 UTC
updated_at | 2023-03-22 14:25:30.662009 +0000 UTC
locality | region=us-east,zone=us-east-1
is_available | true
is_live | true
replicas_leaders | 16
replicas_leaseholders | 16
ranges | 51
ranges_unavailable | 0
ranges_underreplicated | 0
live_bytes | 135692100
key_bytes | 564240
value_bytes | 136558228
range_key_bytes | 0
range_value_bytes | 0
intent_bytes | 0
system_bytes | 29023
gossiped_replicas | 51
is_decommissioning | false
membership | active
is_draining | false
-[ RECORD 2 ]
id | 2
address | cockroachdb-1.cockroachdb.cockroach-sts-secure.svc.cluster.local:26257
sql_address | cockroachdb-1.cockroachdb.cockroach-sts-secure.svc.cluster.local:26257
build | v22.2.5
started_at | 2023-03-22 13:02:01.309179 +0000 UTC
updated_at | 2023-03-22 14:25:33.303563 +0000 UTC
locality | region=us-east,zone=us-east-1
is_available | true
is_live | true
replicas_leaders | 20
replicas_leaseholders | 20
ranges | 51
ranges_unavailable | 0
ranges_underreplicated | 0
live_bytes | 135634805
key_bytes | 564216
value_bytes | 136500889
range_key_bytes | 0
range_value_bytes | 0
intent_bytes | 0
system_bytes | 29023
gossiped_replicas | 51
is_decommissioning | false
membership | active
is_draining | false
-[ RECORD 3 ]
id | 3
address | cockroachdb-2.cockroachdb.cockroach-sts-secure.svc.cluster.local:26257
sql_address | cockroachdb-2.cockroachdb.cockroach-sts-secure.svc.cluster.local:26257
build | v22.2.5
started_at | 2023-03-22 13:02:02.69602 +0000 UTC
updated_at | 2023-03-22 14:25:31.744918 +0000 UTC
locality | region=us-east,zone=us-east-1
is_available | true
is_live | true
replicas_leaders | 15
replicas_leaseholders | 15
ranges | 51
ranges_unavailable | 0
ranges_underreplicated | 0
live_bytes | 135577510
key_bytes | 564144
value_bytes | 136443462
range_key_bytes | 0
range_value_bytes | 0
intent_bytes | 0
system_bytes | 29023
gossiped_replicas | 51
is_decommissioning | false
membership | active
is_draining | false
```
**Expected behavior**
`CLI` output of `cockroach node status --all` should display the correct number of ranges for each given node.
Jira issue: CRDB-26029
gz#16399
Contributor guide
Assessment
This issue has not been assessed yet.