npawar commented on a change in pull request #6322:
URL: https://github.com/apache/incubator-pinot/pull/6322#discussion_r536891806
##########
File path:
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
##########
@@ -1895,6 +1895,24 @@ public void toggleQueryQuotaStateForBroker(String
brokerInstanceName, String sta
return serverToSegmentsMap;
}
+ /**
+ * Returns a list of CONSUMING segments for the given realtime table.
+ */
+ public List<String> getConsumingSegments(String tableNameWithType) {
+ IdealState idealState =
_helixAdmin.getResourceIdealState(_helixClusterName, tableNameWithType);
+ if (idealState == null) {
+ throw new IllegalStateException("Ideal state does not exist for table: "
+ tableNameWithType);
+ }
+ List<String> consumingSegments = new ArrayList<>();
+ for (String segment : idealState.getPartitionSet()) {
+ Map<String, String> instanceStateMap =
idealState.getInstanceStateMap(segment);
+ if (instanceStateMap.containsValue(SegmentStateModel.CONSUMING)) {
Review comment:
shouldn't need null check (or even Set) because we're iterating over the
segments fetched from the ideal state. Changed it to Set anyway.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]