You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2020/12/05 21:00:05 UTC
[GitHub] [incubator-pinot] npawar commented on a change in pull request #6322: API to get status of consumption of a table
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org