mattisonchao commented on code in PR #21208:
URL: https://github.com/apache/pulsar/pull/21208#discussion_r1360109360


##########
pulsar-broker/src/main/java/org/apache/pulsar/compaction/PulsarTopicCompactionService.java:
##########
@@ -106,6 +111,78 @@ public CompletableFuture<Position> 
getLastCompactedPosition() {
         return 
CompletableFuture.completedFuture(compactedTopic.getCompactionHorizon().orElse(null));
     }
 
+    @Override
+    public CompletableFuture<Entry> findEntryByPublishTime(long publishTime) {
+        final Predicate<Entry> predicate = entry -> {
+            try {
+                return 
Commands.parseMessageMetadata(entry.getDataBuffer()).getPublishTime() >= 
publishTime;
+            } finally {
+                entry.release();
+            }
+        };
+        return findFirstMatchEntry(predicate);
+    }
+
+    @Override
+    public CompletableFuture<Entry> findEntryByEntryIndex(long entryIndex) {
+        final Predicate<Entry> predicate = entry -> {

Review Comment:
   How do you handle if the entry index is minus value?



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

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

Reply via email to