-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fetch Pulsar offsets from Consumer interface instead of Reader #8017
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8017 +/- ##
============================================
- Coverage 71.34% 69.56% -1.79%
- Complexity 4215 4279 +64
============================================
Files 1596 1664 +68
Lines 82778 87342 +4564
Branches 12348 13227 +879
============================================
+ Hits 59062 60758 +1696
- Misses 19728 22299 +2571
- Partials 3988 4285 +297
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Hi @KKcorps We have tested your PR and it seems to miss messages, it seems to have an issue in the method getNextStreamParitionMsgOffsetAtIndex : if the message is part of a Pulsar batch (BatchMessageIdImpl), you add +1 to the entry id every time, that doesn't seem to be correct because in fact the next message id will have only the batch index incremented with the same entry id (all messages inside a Pulsar batch share the same entry id).
|
Hi |
@mathieudruart can you send me some doc/examples to produce batch message scenarios where the code fails. |
Hi @KKcorps, here is an example scenario with which we reproduce the problem :
Don't hesitate to ask me for clarification. |
@mathieudruart Thanks for the help. I reproduced the scenario and it works fine with new code. I have also added a few unit test cases for Batch Id. The test cases still don't cover your scenario since it falls under Integration Test. I have added that as well but need to sort out a few dependency conflicts for test package before raising a PR. You can find the code here - https://github.com/KKcorps/incubator-pinot/blob/pulsar_integration_test/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/RealtimePulsarIntegrationTest.java |
With the latest version of this patch, we have no more issues. |
...pulsar/src/main/java/org/apache/pinot/plugin/stream/pulsar/PulsarStreamMetadataProvider.java
Outdated
Show resolved
Hide resolved
...pulsar/src/main/java/org/apache/pinot/plugin/stream/pulsar/PulsarStreamMetadataProvider.java
Show resolved
Hide resolved
...pulsar/src/main/java/org/apache/pinot/plugin/stream/pulsar/PulsarStreamMetadataProvider.java
Show resolved
Hide resolved
...pulsar/src/main/java/org/apache/pinot/plugin/stream/pulsar/PulsarStreamMetadataProvider.java
Outdated
Show resolved
Hide resolved
...pulsar/src/main/java/org/apache/pinot/plugin/stream/pulsar/PulsarStreamMetadataProvider.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
Only 1 optional comment, feel free to merge with or without it
...ingestion/pinot-pulsar/src/main/java/org/apache/pinot/plugin/stream/pulsar/PulsarConfig.java
Outdated
Show resolved
Hide resolved
public int choosePartition(Message<?> msg, TopicMetadata metadata) { | ||
return partition; | ||
} | ||
}).batchingMaxMessages(BATCH_SIZE).batchingMaxPublishDelay(1, TimeUnit.SECONDS).create(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any chance this is related to recent flakiness in #8537 ?
The Pulsar Plugin fails to consume data if the
auto.offset.reset
property is set tolargest
. The reason is the reader interface always resets to after the last message in the topic. The solution is either to use large fetch timeouts so that records pushed are consumed before a new pulsar consumer is created.OR
Ditch the Pulsar Reader interface and use the Consumer interface. The Consumer interface can return the last valid message-id in the topic and hence the PulsarConsumer can begin consumption after that.