codelipenghui commented on code in PR #20867: URL: https://github.com/apache/pulsar/pull/20867#discussion_r1325206354
########## pip/pip-286.md: ########## @@ -0,0 +1,57 @@ +# Background knowledge + +In https://github.com/apache/pulsar/pull/11139 we support get position based on timestamp, but it doesn't work well with topic compaction enabled because the data may have been move to the compacted ledger. + +In [PIP-278](https://github.com/apache/pulsar/pull/20624) we introduced the pluggable topic compaction service to extend the compaction. + +# Motivation + +In order for `get-message-id` to work well with topic compaction enabled we need to find the position according to publish time from topic compaction service, +but `TopicCompactionService` missing a method that find positions according to publish time or other metadata, so we should add it. + +In addition, this method can also be used to find the position/offset according to offset/timestamp in the KoP. + +# Goals + +# High Level Design + +We need to add a method to `Topic Compaction Service` that can find the matching position and other metadata information according to publishTime/index. + +# Detailed Design + +Add `findEntryByPublishTime` in the `TopicCompactionService` API. + +Add `findEntryByEntryIndex` in the `TopicCompactionService` API. + +Implement them in the `PulsarTopicCompactionService` using binary search. + +When get messageId by timestamp, find position from topicCompactionService if we can't find position in the manageLedger. + +## Public-facing Changes + + ```java + + public interface TopicCompactionService extends AutoCloseable { Review Comment: Please mention that this interface has `@InterfaceStability.Evolving` annotation. So that we are able to add new methods directly. -- 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]
