cockroachdb / cockroachdb/cockroach

cluster-settings: SHOW CLUSTER SETTING rounds byte-size values, hiding configured precision

Open
#172,033 2 comments 0 reactions 0 assignees View on GitHub
A-configurability A-sql-cli-observability branch-master branch-release-26.3 C-bug O-agent O-qa T-db-server
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

**Describe the problem**

For byte-size cluster settings, `SHOW CLUSTER SETTING` and the
`/_admin/v1/settings` HTTP API display a *rounded* value rather than
the exact configured byte count. The stored value is correct, but the
user-visible value is misleading.

This is particularly confusing for the new
`sql.status.active_query_text.max_bytes` setting in 26.3, which
validates inputs in the range `[1000 B, 64 KiB]` — i.e. the user is
expected to be able to configure values that are not round multiples
of KiB.

**To Reproduce**

```sql
> SET CLUSTER SETTING sql.status.active_query_text.max_bytes = '12345B';
SET CLUSTER SETTING

> SHOW CLUSTER SETTING sql.status.active_query_text.max_bytes;
sql.status.active_query_text.max_bytes
------------------------------------------
12 KiB

> SET CLUSTER SETTING sql.status.active_query_text.max_bytes = '65535B';
SET CLUSTER SETTING

> SHOW CLUSTER SETTING sql.status.active_query_text.max_bytes;
sql.status.active_query_text.max_bytes
------------------------------------------
64 KiB
```

The same display rounding affects the HTTP API:

```sh
$ curl 'http://.../_admin/v1/settings?keys=sql.status.active_query_text.max_bytes'
{
"keyValues": {
"sql.status.active_query_text.max_bytes": {
"value": "64 KiB", # actual stored value is 65535
...
```

Behavioral testing confirms the stored value is correct: a query of
~70 KiB submitted while the setting is `65535B` is truncated to exactly
65535 bytes (not 65536). So this is purely a display issue.

The exact value is only available via `crdb_internal.cluster_settings`,
which requires `allow_unsafe_internals = true`.

This issue is not new in 26.3 — it reproduces with any byte-size setting
(e.g. `bulkio.backup.file_size`) — but it is now more user-visible
because `sql.status.active_query_text.max_bytes` is a new public setting
that explicitly accepts sub-KiB precision.

**Expected behavior**

`SHOW CLUSTER SETTING` and the HTTP settings API should display the
exact configured value (e.g. `65535 B`) or a representation that
preserves the original precision (e.g. `65535 B (~64 KiB)`).

**Environment:**
- CockroachDB v26.3.0-beta.2-dev (built from `release-26.3` tip)
- Server OS: macOS, but reproducible anywhere
- Client app: `cockroach sql`

**Additional context**

Discovered while QA-testing the new
`sql.status.active_query_text.max_bytes` setting.

Jira issue: CRDB-65175

Contributor guide

Open the contributing guide

Research direction

Start by tracing how byte-size cluster settings are formatted for `SHOW CLUSTER SETTING` and the `/_admin/v1/settings` HTTP API. The report reproduces the rounding with `sql.status.active_query_text.max_bytes` set to `12345B` and `65535B`; check the relevant tests and make sure both interfaces display the exact configured precision.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.