smengcl commented on code in PR #8587:
URL: https://github.com/apache/ozone/pull/8587#discussion_r2377401797
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmBucketInfo.java:
##########
@@ -261,10 +285,40 @@ public void incrUsedBytes(long bytes) {
this.usedBytes += bytes;
}
+ public void decrUsedBytes(long bytes, boolean increasePendingDeleteBytes) {
+ this.usedBytes -= bytes;
+ if (increasePendingDeleteBytes) {
+ incrSnapshotUsedBytes(bytes);
+ }
+ }
Review Comment:
I do not think having the second parameter here is a good idea. Mainly
because it is implicitly adjusting another metric.
I'd say simply call `incrSnapshotUsedBytes(bytes)` explicitly whenever it is
necessary (when `increasePendingDeleteBytes == true`) would make it more
maintainable. In that case `incrUsedBytes()` alone would suffice.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]