You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/09/28 13:03:19 UTC

[GitHub] [ozone] adoroszlai commented on a change in pull request #2685: HDDS-5734. add a command to trigger datanode executing du immediately

adoroszlai commented on a change in pull request #2685:
URL: https://github.com/apache/ozone/pull/2685#discussion_r717537735



##########
File path: hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/fs/CachingSpaceUsageSource.java
##########
@@ -45,31 +38,18 @@
   private static final Logger LOG =
       LoggerFactory.getLogger(CachingSpaceUsageSource.class);
 
-  private final ScheduledExecutorService executor;
   private final AtomicLong cachedValue = new AtomicLong();
-  private final Duration refresh;
+  private final Duration refreshInterVal;
   private final SpaceUsageSource source;
   private final SpaceUsagePersistence persistence;
   private boolean running;
-  private ScheduledFuture<?> scheduledFuture;
-
-  public CachingSpaceUsageSource(SpaceUsageCheckParams params) {
-    this(params, createExecutor(params));
-  }
 
   @VisibleForTesting
-  CachingSpaceUsageSource(SpaceUsageCheckParams params,
-      ScheduledExecutorService executor) {

Review comment:
       Being able to provide `executor` is helpful for testing.  I think switching to a thread that's always started, even for unit tests, is a step back.  I think immediate refresh can be achieved by scheduling a new refresh task without delay (keeping track of last refresh time might be useful as well).

##########
File path: hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/fs/CachingSpaceUsageSource.java
##########
@@ -45,31 +38,18 @@
   private static final Logger LOG =
       LoggerFactory.getLogger(CachingSpaceUsageSource.class);
 
-  private final ScheduledExecutorService executor;
   private final AtomicLong cachedValue = new AtomicLong();
-  private final Duration refresh;
+  private final Duration refreshInterVal;
   private final SpaceUsageSource source;
   private final SpaceUsagePersistence persistence;
   private boolean running;
-  private ScheduledFuture<?> scheduledFuture;
-
-  public CachingSpaceUsageSource(SpaceUsageCheckParams params) {
-    this(params, createExecutor(params));
-  }
 
   @VisibleForTesting

Review comment:
       No longer `@VisibleForTesting`, since this is the constructor used by production code.




-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org