Several config specifies a large byte size, which is not very readable (and some DBAs are still unfamiliar with the underscore-as-number-separator TOML feature).
What is changed and how it works?
Using docker/go-units (already used by Dumpling and PD), we support parsing human-readable byte size for the following config:
Byte size can be specified using integers (65536 or 65_536, backward-compatible with existing config), floating point (6.5536e+4), or a string involving byte units ('64k', '64 K', '64KiB', '64 kb', '0.0625 MB', all equivalent).
(This PR is submitted mainly because we expect that disk-quota is also going to need some huge numbers in a custom config, similar to TiKV's ReadableSize struct. Interestingly no such thing exists in TiDB except in dealing with INSPECTION_RULES.)
Check List
Tests
Unit test
Side effects
Related changes
Need to update the documentation
Need to be included in the release note
Release notes
The 4 configuration specified above can now accept human-readable format in the form "2.5 GiB".
What problem does this PR solve?
Several config specifies a large byte size, which is not very readable (and some DBAs are still unfamiliar with the underscore-as-number-separator TOML feature).
What is changed and how it works?
Using
docker/go-units
(already used by Dumpling and PD), we support parsing human-readable byte size for the following config:Byte size can be specified using integers (
65536
or65_536
, backward-compatible with existing config), floating point (6.5536e+4
), or a string involving byte units ('64k'
,'64 K'
,'64KiB'
,'64 kb'
,'0.0625 MB'
, all equivalent).(This PR is submitted mainly because we expect that disk-quota is also going to need some huge numbers in a custom config, similar to TiKV's
ReadableSize
struct. Interestingly no such thing exists in TiDB except in dealing with INSPECTION_RULES.)Check List
Tests
Side effects
Related changes
Release notes
"2.5 GiB"
.