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


##########
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:
   It will return the first entry of compacted data, this is also consistent 
with the method definition, what do you think?



-- 
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]

Reply via email to