Repository navigation
[feat][admin] PIP-415: Support getting message ID by index - #24222
Conversation
035132b to
75194f7
Compare
There was a problem hiding this comment.
#24220 PIP has a lot of adjustments.
@liangyepianzhou please ping me after you modify the code and I will review it again.
|
Good jobs |
dao-jun
left a comment
There was a problem hiding this comment.
Just some small comments, Overall LGTM.
By the way, if you rely on the AppendMessageIndexInterceptor, I'd suggest you need to check whether the interceptor configured before start the broker.
c531f37 to
35a5ae5
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #24222 +/- ##
============================================
+ Coverage 73.57% 74.33% +0.76%
- Complexity 32624 32765 +141
============================================
Files 1877 1868 -9
Lines 139502 145497 +5995
Branches 15299 16643 +1344
============================================
+ Hits 102638 108157 +5519
+ Misses 28908 28789 -119
- Partials 7956 8551 +595
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
) PIP:apache#24220 ### Motivation we can now obtain the offset of a message by its message id: 1. Get the message by id using `get-message-by-id` cmd 2. Get the index of the message using `Message.getIndex()` But we cannot obtain the message id by offset. Then we need to add a new API to get the message id by offset. ### Modifications Add a new http API to retrieve the message ID by offset. We propose to add a new API to retrieve the message ID by offset, enabling us to cache the mapping between message ID and offset. This will allow us to use offsets for seek and acknowledgment operations when consuming messages through the standardized API.
) PIP:apache#24220 ### Motivation we can now obtain the offset of a message by its message id: 1. Get the message by id using `get-message-by-id` cmd 2. Get the index of the message using `Message.getIndex()` But we cannot obtain the message id by offset. Then we need to add a new API to get the message id by offset. ### Modifications Add a new http API to retrieve the message ID by offset. We propose to add a new API to retrieve the message ID by offset, enabling us to cache the mapping between message ID and offset. This will allow us to use offsets for seek and acknowledgment operations when consuming messages through the standardized API.
|
@liangyepianzhou |
PIP:#24220 we can now obtain the offset of a message by its message id: 1. Get the message by id using `get-message-by-id` cmd 2. Get the index of the message using `Message.getIndex()` But we cannot obtain the message id by offset. Then we need to add a new API to get the message id by offset. Add a new http API to retrieve the message ID by offset. We propose to add a new API to retrieve the message ID by offset, enabling us to cache the mapping between message ID and offset. This will allow us to use offsets for seek and acknowledgment operations when consuming messages through the standardized API. (cherry picked from commit ed28c21)
) PIP:apache#24220 we can now obtain the offset of a message by its message id: 1. Get the message by id using `get-message-by-id` cmd 2. Get the index of the message using `Message.getIndex()` But we cannot obtain the message id by offset. Then we need to add a new API to get the message id by offset. Add a new http API to retrieve the message ID by offset. We propose to add a new API to retrieve the message ID by offset, enabling us to cache the mapping between message ID and offset. This will allow us to use offsets for seek and acknowledgment operations when consuming messages through the standardized API. (cherry picked from commit ed28c21) (cherry picked from commit 8350352)
) PIP:apache#24220 we can now obtain the offset of a message by its message id: 1. Get the message by id using `get-message-by-id` cmd 2. Get the index of the message using `Message.getIndex()` But we cannot obtain the message id by offset. Then we need to add a new API to get the message id by offset. Add a new http API to retrieve the message ID by offset. We propose to add a new API to retrieve the message ID by offset, enabling us to cache the mapping between message ID and offset. This will allow us to use offsets for seek and acknowledgment operations when consuming messages through the standardized API. (cherry picked from commit ed28c21) (cherry picked from commit 8350352)
Implements Apache Pulsar PIP-415 as a REST admin endpoint, per upstream intent: the spec's "Binary protocol" section is intentionally empty and the canonical PR (apache/pulsar#24222) touches only admin/broker/CLI Java code. No proto changes. - AdminClient::topic_get_message_id_by_index(topic, index) -> MessageId hits GET /admin/v2/persistent/{tenant}/{ns}/{topic}/getMessageIdByIndex with the canonical Java endpoint annotation. - Deserialise-only DTO mirrors Java's MessageIdImpl JSON shape ({ledgerId, entryId, partitionIndex}); batch_index/batch_size collapse to -1 since the broker resolves at entry granularity. - Drive-by fix in url() helper: pop_if_empty() before pushing API segments. The trailing slash on /admin/v2/ left an empty sentinel segment that caused /admin/v2//persistent/... — tolerated by real brokers, rejected by strict mocks, and a divergence from Java's PulsarAdmin emit form. All existing admin methods inherit the fix. - 5 wiremock-driven tests pin path, verb, query param, JSON wire shape, and the 412/404 error paths called out in PIP-415 §Error Responses. Parity matrix and follow-ups updated to reflect the REST-only nature. Signed-off-by: Florentin Dubois <[email protected]>
PIP:#24220
Motivation
we can now obtain the offset of a message by its message id:
get-message-by-idcmdMessage.getIndex()But we cannot obtain the message id by offset. Then we need to add a new API to get the message id by offset.
Modifications
Add a new http API to retrieve the message ID by offset.
We propose to add a new API to retrieve the message ID by offset, enabling us to cache the mapping between message ID and offset.
This will allow us to use offsets for seek and acknowledgment operations when consuming messages through the standardized API.
Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: