AmatyaAvadhanula commented on a change in pull request #12235:
URL: https://github.com/apache/druid/pull/12235#discussion_r808758862



##########
File path: 
extensions-core/kinesis-indexing-service/src/main/java/org/apache/druid/indexing/kinesis/supervisor/KinesisSupervisor.java
##########
@@ -481,4 +535,47 @@ protected boolean supportsPartitionExpiration()
 
     return new KinesisDataSourceMetadata(newSequences);
   }
+
+  /**
+   * A shard is considered closed iff it has an ending sequence number.
+   *
+   * @param shard to be checked
+   * @return if shard is closed
+   */
+  private boolean isShardClosed(Shard shard)
+  {
+    return shard.getSequenceNumberRange().getEndingSequenceNumber() != null;
+  }
+
+  /**
+   * Checking if a shard is empty requires polling for records which is quite 
expensive
+   * Fortunately, the results can be cached for closed shards as no more 
records can be written to them
+   * Please use this method only if the info is absent from the cache
+   *
+   * @param stream to which the shard belongs
+   * @param shardId of the shard
+   * @return if the shard is empty
+   */
+  private boolean isClosedShardEmpty(String stream, String shardId)
+  {
+    return ((KinesisRecordSupplier) recordSupplier).isClosedShardEmpty(stream, 
shardId);

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