devmadhuu commented on code in PR #9954:
URL: https://github.com/apache/ozone/pull/9954#discussion_r3092508189
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/StorageVolumeChecker.java:
##########
@@ -246,18 +255,44 @@ public Set<? extends StorageVolume> checkAllVolumes(
// Wait until our timeout elapses, after which we give up on
// the remaining volumes.
- if (!latch.await(maxAllowedTimeForCheckMs, TimeUnit.MILLISECONDS)) {
- LOG.warn("checkAllVolumes timed out after {} ms",
- maxAllowedTimeForCheckMs);
- }
+ boolean completedOnTime =
+ latch.await(maxAllowedTimeForCheckMs, TimeUnit.MILLISECONDS);
synchronized (this) {
- // All volumes that have not been detected as healthy should be
- // considered failed. This is a superset of 'failedVolumes'.
- //
- // Make a copy under the mutex as Sets.difference() returns a view
- // of a potentially changing set.
- return new HashSet<>(Sets.difference(allVolumes, healthyVolumes));
+ if (!completedOnTime) {
+ LOG.warn("checkAllVolumes timed out after {} ms."
+ + " Evaluating per-volume latch-timeout tolerance.",
+ maxAllowedTimeForCheckMs);
+ }
+
+ // Volumes that explicitly reported FAILED via check() are always
+ // returned — the IO-failure sliding window in StorageVolume.check()
+ // already applied its own tolerance.
+ final Set<StorageVolume> result = new HashSet<>(failedVolumes);
+
+ // Volumes still pending (neither healthy nor explicitly failed) at
+ // latch-timeout time. onFailure() may have already handled some of
+ // these via timeoutHandledSet; skip those to avoid double-counting.
+ final Set<StorageVolume> pendingVolumes =
+ new HashSet<>(Sets.difference(allVolumes,
+ Sets.union(healthyVolumes, failedVolumes)));
Review Comment:
Great catch. Handled the race condition.
--
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]