cockroachdb / cockroachdb/cockroach
cluster-settings: garbage error message for invalid byte-size value in SET CLUSTER SETTING
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
**Describe the problem**
Setting a byte-size cluster setting to an invalid value returns an error
that leaks Go standard-library implementation details and doesn't tell
the user what was wrong or what format is expected.
**To Reproduce**
Affects all byte-size cluster settings; here using two as examples:
```sql
> SET CLUSTER SETTING sql.status.active_query_text.max_bytes = 'banana';
ERROR: strconv.ParseFloat: parsing "": invalid syntax
> SET CLUSTER SETTING bulkio.backup.file_size = 'not a size';
ERROR: strconv.ParseFloat: parsing "": invalid syntax
> SET CLUSTER SETTING bulkio.backup.file_size = '12X';
ERROR: unhandled size name: x
```
The error:
1. Mentions an empty parsed string `""` rather than the user's input.
2. Mentions a Go standard library function (`strconv.ParseFloat`) that
isn't relevant to the user.
3. Doesn't say what input formats are accepted (e.g. `1000 B`, `16 KiB`,
`1 MiB`).
**Expected behavior**
An error like:
```
ERROR: invalid byte-size value 'banana': expected a number with an
optional unit suffix (B, KiB, MiB, GiB, ...)
```
**Environment:**
- CockroachDB v26.3.0-beta.2-dev. Also reproduces in earlier versions —
this is pre-existing behavior in the byte-size setting parser, not
specific to any one setting.
- Client app: `cockroach sql`
**Additional context**
Discovered while QA-testing the new
`sql.status.active_query_text.max_bytes` setting in 26.3.
Jira issue: CRDB-65176
Contributor guide
Research direction
Start at the byte-size setting parser used by SET CLUSTER SETTING and reproduce the invalid inputs shown in the issue. Trace how parsing errors are surfaced for byte-size cluster settings, then verify that invalid values report the user's input, describe accepted unit formats, and do not leak strconv or other implementation details.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100