This is an automated email from the ASF dual-hosted git repository.

chihsuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 5844b8c0115 HDDS-17010. Avoid disk check timeout for empty volume sets 
(#11545)
5844b8c0115 is described below

commit 5844b8c01150ab2905deb481ad35a3df7dc7a03b
Author: Andy Huang <[email protected]>
AuthorDate: Thu Oct 15 21:58:03 2026 +0800

    HDDS-17010. Avoid disk check timeout for empty volume sets (#11545)
---
 .../container/common/volume/StorageVolumeChecker.java    |  4 ++++
 .../common/volume/TestStorageVolumeChecker.java          | 16 ++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/StorageVolumeChecker.java
 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/StorageVolumeChecker.java
index aa47f70d57a..6ce8617f483 100644
--- 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/StorageVolumeChecker.java
+++ 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/StorageVolumeChecker.java
@@ -29,6 +29,7 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Optional;
@@ -219,6 +220,9 @@ public synchronized void checkAllVolumeSets() {
   public Set<? extends StorageVolume> checkAllVolumes(
       Collection<? extends StorageVolume> volumes)
       throws InterruptedException {
+    if (volumes.isEmpty()) {
+      return Collections.emptySet();
+    }
     final Set<StorageVolume> healthyVolumes = ConcurrentHashMap.newKeySet();
     final Set<StorageVolume> failedVolumes = ConcurrentHashMap.newKeySet();
     final Set<StorageVolume> allVolumes = new HashSet<>();
diff --git 
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestStorageVolumeChecker.java
 
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestStorageVolumeChecker.java
index da8aa0ce95b..3c556340421 100644
--- 
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestStorageVolumeChecker.java
+++ 
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestStorageVolumeChecker.java
@@ -21,6 +21,7 @@
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.isNull;
@@ -39,6 +40,7 @@
 import java.time.Duration;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
 import java.util.Set;
@@ -202,6 +204,20 @@ public void testCheckAllVolumes(VolumeCheckResult 
checkResult) throws Exception
     checker.shutdownAndWait(0, TimeUnit.SECONDS);
   }
 
+  @Test
+  public void testCheckAllVolumesWithNoVolumes() throws Exception {
+    DatanodeConfiguration dnConf = conf.getObject(DatanodeConfiguration.class);
+    dnConf.setDiskCheckTimeout(Duration.ofMinutes(10));
+    conf.setFromObject(dnConf);
+    StorageVolumeChecker checker = new StorageVolumeChecker(conf, new 
FakeTimer(), "");
+    try {
+      Set<? extends StorageVolume> failedVolumes = 
assertTimeoutPreemptively(Duration.ofSeconds(10),
+          () -> checker.checkAllVolumes(Collections.emptyList()));
+      assertThat(failedVolumes).isEmpty();
+    } finally {
+      checker.shutdownAndWait(0, TimeUnit.SECONDS);
+    }
+  }
 
   /**
    * Test {@link StorageVolumeChecker#checkAllVolumes} propagates


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to