ChenSammi commented on code in PR #8827:
URL: https://github.com/apache/ozone/pull/8827#discussion_r2281865944
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerSet.java:
##########
@@ -469,6 +471,35 @@ public void listContainer(long startContainerId, long
count,
}
}
+ /**
+ * This method can be used to get total bytes pending for deletion
+ * in cached interval of time. This can be utilized by either storage
+ * report or other services.
+ */
+ public long getPendingDeletionBytes() {
+ CachedPendingDeletion currentCache = cachedPendingDeletion;
+ if (currentCache != null && !currentCache.isExpired()) {
+ return currentCache.getSize();
+ }
+
+ synchronized (cacheLock) {
+ currentCache = cachedPendingDeletion;
+ if (currentCache != null && !currentCache.isExpired()) {
+ return currentCache.getSize();
+ }
+ long total = 0L;
+ List<Container<?>> containers = new ArrayList<>(containerMap.values());
+ for (Container<?> container : containers) {
+ total += container.getContainerData()
+ .getStatistics()
+ .getBlockPendingDeletionBytes();
+ }
+ long cacheDurationMillis = 5 * 60 * 1000;
Review Comment:
Please relate this with storage report interval, for example, if storage
report interval is 60s, then
cacheDurationMillis = 5 * storage report interval
This way, we can avoid introducing a new property for this trivial cache by
leveraging storage policy report interval, and it will be adjustable too.
--
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]