jugomezv commented on code in PR #9994:
URL: https://github.com/apache/pinot/pull/9994#discussion_r1065190160


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/tablestate/TableStateUtils.java:
##########
@@ -39,37 +39,56 @@ private TableStateUtils() {
   }
 
   /**
-   * Checks if all segments for the given @param tableNameWithType are 
succesfully loaded
-   * This function will get all segments in IDEALSTATE and CURRENTSTATE for 
the given table,
-   * and then check if all ONLINE segments in IDEALSTATE match with 
CURRENTSTATE.
-   * @param helixManager helix manager for the server instance
-   * @param tableNameWithType table name for which segment state is to be 
checked
-   * @return true if all segments for the given table are succesfully loaded. 
False otherwise
+   * Returns all segments in a given state for a given table.
+   *
+   * @param helixManager instance of Helix manager
+   * @param tableNameWithType table for which we are obtaining ONLINE segments
+   * @param state state of the segments to be returned
+   *
+   * @return List of segment names in a given state.
    */
-  public static boolean isAllSegmentsLoaded(HelixManager helixManager, String 
tableNameWithType) {
+  public static Set<String> 
getSegmentsInGivenStateForThisInstance(HelixManager helixManager, String 
tableNameWithType,
+      String state) {
     HelixDataAccessor dataAccessor = helixManager.getHelixDataAccessor();
     PropertyKey.Builder keyBuilder = dataAccessor.keyBuilder();
     IdealState idealState = 
dataAccessor.getProperty(keyBuilder.idealStates(tableNameWithType));
+    Set<String> segmentsInGivenState = new HashSet<>();
     if (idealState == null) {
       LOGGER.warn("Failed to find ideal state for table: {}", 
tableNameWithType);
-      return false;
+      return segmentsInGivenState;
     }
 
     // Get all ONLINE segments from idealState

Review Comment:
   done



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to