chihsuan commented on code in PR #10989:
URL: https://github.com/apache/ozone/pull/10989#discussion_r3785455711


##########
hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneClusterProvider.java:
##########
@@ -215,14 +219,22 @@ private Thread createClusters() {
           cluster = builder.build();
           cluster.waitForClusterToBeReady();
           createdCount++;
-          clusters.put(cluster);
+          clusterResults.put(ClusterCreationResult.success(cluster));
         } catch (InterruptedException e) {
           if (cluster != null) {
             cluster.shutdown();
           }
           break;
         } catch (IOException | TimeoutException e) {
-          throw new RuntimeException("Unable to build cluster", e);
+          LOG.warn("Unable to build cluster", e);
+          if (cluster != null) {
+            cluster.shutdown();
+          }
+          try {
+            clusterResults.put(ClusterCreationResult.failure(e));

Review Comment:
   If an interrupt was already consumed during cluster creation or cleanup, 
`put()` can block on a full queue while `shutdown()` waits in `join()`. Would a 
bounded `offer()` be safer?



##########
hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneClusterProvider.java:
##########
@@ -215,14 +219,22 @@ private Thread createClusters() {
           cluster = builder.build();
           cluster.waitForClusterToBeReady();
           createdCount++;
-          clusters.put(cluster);
+          clusterResults.put(ClusterCreationResult.success(cluster));
         } catch (InterruptedException e) {
           if (cluster != null) {
             cluster.shutdown();
           }
           break;
         } catch (IOException | TimeoutException e) {
-          throw new RuntimeException("Unable to build cluster", e);
+          LOG.warn("Unable to build cluster", e);
+          if (cluster != null) {
+            cluster.shutdown();

Review Comment:
   Just a thought: This cleanup may be interrupted before it completes. It runs 
on the create thread, which provider shutdown interrupts, while the reaper 
thread intentionally avoids interrupting cluster cleanup
   
   The branch above does the same thing, so it may be fine to leave it as is. 
Would routing through `expiredClusters` be worth considering?



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