yashmayya commented on code in PR #17453:
URL: https://github.com/apache/pinot/pull/17453#discussion_r2684029034


##########
pinot-server/src/main/java/org/apache/pinot/server/starter/helix/BaseServerStarter.java:
##########
@@ -183,6 +183,7 @@ public abstract class BaseServerStarter implements 
ServiceStartable {
   protected volatile boolean _isServerReadyToServeQueries = false;
   protected ScheduledExecutorService _helixMessageCountScheduler;
   protected ServerReloadJobStatusCache _reloadJobStatusCache;
+  protected StateTransitionThreadPoolManager _transitionThreadPoolManager;

Review Comment:
   Let's add a comment here for more context on customizability.



##########
pinot-server/src/main/java/org/apache/pinot/server/starter/helix/SegmentOnlineOfflineStateModelFactory.java:
##########
@@ -247,4 +254,43 @@ public void onBecomeDroppedFromError(Message message, 
NotificationContext contex
       }
     }
   }
+
+  /**
+   *Get thread pool to handle the given state transition message.

Review Comment:
   nit: formatting



##########
pinot-server/src/main/java/org/apache/pinot/server/starter/helix/SegmentOnlineOfflineStateModelFactory.java:
##########
@@ -247,4 +254,43 @@ public void onBecomeDroppedFromError(Message message, 
NotificationContext contex
       }
     }
   }
+
+  /**
+   *Get thread pool to handle the given state transition message.
+   * If this method returns null, the threadpool returned from
+   * {@link StateModelFactory#getExecutorService(String resourceName, String 
fromState, String toState)} will be used;
+   * it this method returns null the threadpool returned from

Review Comment:
   nit: it -> if



##########
pinot-server/src/main/java/org/apache/pinot/server/starter/helix/StateTransitionThreadPoolManager.java:
##########
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.server.starter.helix;
+
+import java.util.concurrent.ExecutorService;
+import javax.annotation.Nullable;
+import org.apache.helix.model.Message;
+import org.apache.helix.participant.statemachine.StateModelFactory;
+
+
+/**
+ * Manages the custom Helix state transition thread pools for Pinot server.
+ * {@link StateTransitionThreadPoolManager#getExecutorService} may only be 
called once for each argument combination,
+ * and the returned {@link ExecutorService} would then be cached in Helix to 
serve all subsequent state transition
+ * messages of that argument combination. See {@link 
StateModelFactory#getExecutorService(Message.MessageInfo)}
+ */
+public interface StateTransitionThreadPoolManager {
+  @Nullable
+  StateModelFactory.CustomizedExecutorService 
getExecutorService(Message.MessageInfo messageInfo);
+
+  @Nullable
+  ExecutorService getExecutorService(String resourceName, String fromState, 
String toState);
+
+  @Nullable
+  ExecutorService getExecutorService(String resourceName);

Review Comment:
   Javadocs would be useful here, particularly with examples on scenarios where 
each executor would be used.



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