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


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationServer.java:
##########
@@ -154,11 +156,36 @@ public int getPort() {
     return port;
   }
 
+  public void setPoolSize(int size) {
+    if (size <= 0) {
+      throw new IllegalArgumentException("Pool size must be positive.");
+    }
+
+    int currentCorePoolSize = executor.getCorePoolSize();
+
+    // In ThreadPoolExecutor, maximumPoolSize must always be greater than or
+    // equal to the corePoolSize. We must make sure this invariant holds when
+    // changing the pool size. Therefore, we take into account whether the
+    // new size is greater or smaller than the current core pool size.
+    if (size > currentCorePoolSize) {
+      executor.setMaximumPoolSize(size);
+      executor.setCorePoolSize(size);
+    } else {
+      executor.setCorePoolSize(size);
+      executor.setMaximumPoolSize(size);
+    }
+  }
+
+  @VisibleForTesting
+  public ThreadPoolExecutor getExecutor() {
+    return executor;
+  }
+
   /**
    * Replication-related configuration.
    */
   @ConfigGroup(prefix = ReplicationConfig.PREFIX)
-  public static final class ReplicationConfig {
+  public static final class ReplicationConfig extends ReconfigurableConfig {

Review Comment:
   To utilize `ReconfigurableConfig`, we'd need to register it with the 
`ReconfigurationHandler` (in `HddsDatanodeService`).  Since the only 
reconfigurable property is also registered explicitly:
   
   
https://github.com/apache/ozone/blob/06fa27f4510699bf4ebd94ef6f27a3d5c82d2c27/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/HddsDatanodeService.java#L296-L297
   
   I don't think we need to make `ReplicationConfig extends 
ReconfigurableConfig`.



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationServer.java:
##########
@@ -184,6 +211,7 @@ public static final class ReplicationConfig {
     @Config(key = STREAMS_LIMIT_KEY,
         type = ConfigType.INT,
         defaultValue = "10",
+        reconfigurable = true,

Review Comment:
   I guess we don't need this.



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