You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2022/10/20 08:04:53 UTC

[GitHub] [druid] abhishekagarwal87 commented on a diff in pull request #13221: Remove skip ignorable shards

abhishekagarwal87 commented on code in PR #13221:
URL: https://github.com/apache/druid/pull/13221#discussion_r1000279869


##########
extensions-core/kinesis-indexing-service/src/main/java/org/apache/druid/indexing/kinesis/KinesisRecordSupplier.java:
##########
@@ -803,11 +805,21 @@ private Set<Shard> getShardsUsingListShards(String stream)
   public Set<String> getPartitionIds(String stream)
   {
     return wrapExceptions(() -> {
-      ImmutableSet.Builder<String> partitionIds = ImmutableSet.builder();
-      for (Shard shard : getShards(stream)) {
-        partitionIds.add(shard.getShardId());
+      final Set<String> retVal = new TreeSet<>();
+      ListShardsRequest request = new ListShardsRequest().withStreamName(stream);
+      while (true) {
+        ListShardsResult result = kinesis.listShards(request);
+        retVal.addAll(result.getShards()
+                            .stream()
+                            .map(Shard::getShardId)
+                            .collect(Collectors.toList())
+        );
+        String nextToken = result.getNextToken();
+        if (nextToken == null) {
+          return retVal;
+        }
+        request = new ListShardsRequest().withNextToken(nextToken);

Review Comment:
   what is the difference between this and `getShardsUsingListShards`? 



-- 
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-unsubscribe@druid.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org