-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-23967 Improve the accuracy of the method sizeToString #1273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
virajjasani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for the change, formatting would make it better
| if (size >= (1L << 20)) return String.format("%dM", size / (1L << 20)); | ||
| if (size >= (1L << 10)) return String.format("%dK", size / (1L << 10)); | ||
| return String.format("%dB", size); | ||
| if (size >= (1L << 50)) return String.format("%.2fP", (double)size / (1L << 50)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please try to provide formatting for every condition i.e.
if (size >= (1L << 50)) {
return String.format("%.2fP", (double)size / (1L << 50));
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please try to provide formatting for every condition i.e.
if (size >= (1L << 50)) { return String.format("%.2fP", (double)size / (1L << 50)); }
Formatted, thanks for your review
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
Signed-off-by: Viraj Jasani <vjasani@apache.org> Signed-off-by: Jan Hentschel <jan.hentschel@ultratendency.com>
Signed-off-by: Viraj Jasani <vjasani@apache.org> Signed-off-by: Jan Hentschel <jan.hentschel@ultratendency.com>
Signed-off-by: Viraj Jasani <vjasani@apache.org> Signed-off-by: Jan Hentschel <jan.hentschel@ultratendency.com>
Signed-off-by: Viraj Jasani <vjasani@apache.org> Signed-off-by: Jan Hentschel <jan.hentschel@ultratendency.com>
Signed-off-by: Viraj Jasani <vjasani@apache.org> Signed-off-by: Jan Hentschel <jan.hentschel@ultratendency.com>
) Signed-off-by: Viraj Jasani <vjasani@apache.org> Signed-off-by: Jan Hentschel <jan.hentschel@ultratendency.com> (cherry picked from commit f17f0aa) Change-Id: I4fdad49a9d6c47d27953dcdb48bd98937affb0ba
In QuotaSettings,the method of sizeToString reserved integer. But, this is not very accurate.
hbase(main):001:0> set_quota TYPE => SPACE, TABLE => 't1', LIMIT => '2000G', POLICY => NO_INSERTS hbase(main):002:0> list_quotas OWNER QUOTAS TABLE => t1 TYPE => SPACE, TABLE => t1, LIMIT => 1T, VIOLATION_POLICY => NO_INSERTS 1 row(s) in 0.0340 secondsafter patch:
hbase(main):001:0> set_quota TYPE => SPACE, TABLE => 't1', LIMIT => '2000G', POLICY => NO_INSERTS hbase(main):002:0> list_quotas OWNER QUOTAS TABLE => t1 TYPE => SPACE, TABLE => t1, LIMIT => 1.95T, VIOLATION_POLICY => NO_INSERTS 1 row(s) in 0.0230 seconds