Skip to content

[fix](debug) roll byte sizes up at exact unit boundaries in getByteUint#65778

Open
arpitjain099 wants to merge 1 commit into
apache:masterfrom
arpitjain099:fix/debugutil-byte-unit-boundary
Open

[fix](debug) roll byte sizes up at exact unit boundaries in getByteUint#65778
arpitjain099 wants to merge 1 commit into
apache:masterfrom
arpitjain099:fix/debugutil-byte-unit-boundary

Conversation

@arpitjain099

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

getByteUint used strict > for each unit threshold, so a value that lands exactly on a boundary drops to the next smaller unit. A 1 TB data quota shows up as "1024.000 GB", 1 GB as "1024.000 MB", and so on. This is visible in SHOW DATA and in the "data size exceeds quota[...]" error from Database.checkDataSizeQuota, and round quotas like SET DATA QUOTA 1T hit it directly.

The sibling method getUint already uses >= for the same kind of formatting, so this just makes getByteUint consistent with it. Changed the four comparisons to >= so exact multiples of 1024 roll up to the right unit.

Release note

None

Check List

Added boundary cases (1 KB, 1 MB, 1 GB, 1 TB) to DebugUtilTest. The existing non-boundary assertions are unchanged.

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants