cockroachdb / cockroachdb/cockroach
keys: improve key pretty-printer to not be confused by tenant ID encoding
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
**Describe the problem**
Currently if a key contain an invalid encoding in the tenant prefix due to using PrefixEnd when generating the key, the pretty-print function fails and prints out an error.
For example: `/Tenant/{511-err:insufficient bytes to decode uvarint value: "\x02"}`
This is inconsistent with other pretty-print logic which handles PrefixEnd properly. For example the pretty-printer can generate `/Table/42/255/PrefixEnd` when the prefixend byte occurs in the SQL row value part.
**To Reproduce**
try to pretty-print `MakeTenantPrefix(511).PrefixEnd()`
**Expected behavior**
We should use the same logic for pretty-printing the tenant prefix that we also use elsewhere. In the example above we would like the pretty-printer to output `/Tenant/511/PrefixEnd`.
Epic: CRDB-26091
Jira issue: CRDB-31315
Contributor guide
Assessment
This issue has not been assessed yet.