adoroszlai commented on a change in pull request #2685:
URL: https://github.com/apache/ozone/pull/2685#discussion_r725896656
##########
File path:
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/fs/CachingSpaceUsageSource.java
##########
@@ -114,16 +115,26 @@ public void shutdown() {
}
}
+ public void refreshNow() {
+ //refresh immediately
+ executor.schedule(this::refresh, 0, MILLISECONDS);
+ }
+
private void loadInitialValue() {
final OptionalLong initialValue = persistence.load();
initialValue.ifPresent(cachedValue::set);
}
private void refresh() {
- try {
- cachedValue.set(source.getUsedSpace());
- } catch (RuntimeException e) {
- LOG.warn("Error refreshing space usage for {}", source, e);
+ //only one `refresh` can be running at a certain moment
+ if(isRefreshRunning.compareAndSet(false, true)) {
Review comment:
Note: this guards against concurrent execution, but not against too
frequent serial execution.
--
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]