adoroszlai commented on code in PR #8843:
URL: https://github.com/apache/ozone/pull/8843#discussion_r2904263142


##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestStorageVolumeHealthChecks.java:
##########
@@ -304,13 +308,23 @@ private void 
testCheckIOUntilFailure(StorageVolume.Builder<?> builder,
     DatanodeConfiguration dnConf = CONF.getObject(DatanodeConfiguration.class);
     dnConf.setVolumeIOTestCount(ioTestCount);
     dnConf.setVolumeIOFailureTolerance(ioFailureTolerance);
+    dnConf.setDiskCheckSlidingWindowTimeout(Duration.ofMillis(ioTestCount));
     CONF.setFromObject(dnConf);
     builder.conf(CONF);
     StorageVolume volume = builder.build();
     volume.format(CLUSTER_ID);
     volume.createTmpDirs(CLUSTER_ID);
+    // Sliding window protocol transitioned from count-based to a time-based 
system
+    // Update the default failure duration of the window from 60 minutes to a 
shorter duration for the test
+    long eventRate = 1L;
+    TestClock testClock = TestClock.newInstance();
+    Field clock = SlidingWindow.class.getDeclaredField("clock");
+    clock.setAccessible(true);
+    clock.set(volume.getIoTestSlidingWindow(), testClock);

Review Comment:
   I think we should add `setClock(Clock)` in `StorageVolume.Builder` to allow 
passing `TestClock`.  `Builder.build()` should use `MonotonicClock` if `clock` 
if no custom clock is set.



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/HddsVolume.java:
##########
@@ -322,38 +307,32 @@ public synchronized VolumeCheckResult check(@Nullable 
Boolean unused)
 
   @VisibleForTesting
   public VolumeCheckResult checkDbHealth(File dbFile) throws 
InterruptedException {
-    if (volumeTestCount == 0) {
+    if (getIoTestCount() == 0) {
       return VolumeCheckResult.HEALTHY;
     }
 
-    final boolean isVolumeTestResultHealthy = true;
     try (ManagedOptions managedOptions = new ManagedOptions();
-         ManagedRocksDB ignored = ManagedRocksDB.openReadOnly(managedOptions, 
dbFile.toString())) {
-      volumeTestResultQueue.add(isVolumeTestResultHealthy);
+         ManagedRocksDB readOnlyDb = 
ManagedRocksDB.openReadOnly(managedOptions, dbFile.toString())) {

Review Comment:
   nit: please keep original name, avoids warnings in IDE about being unused
   
   ```suggestion
            ManagedRocksDB ignored = 
ManagedRocksDB.openReadOnly(managedOptions, dbFile.toString())) {
   ```



-- 
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]

Reply via email to