Skip to content
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

Default destination resolver in DeadLetterPublishingRecoverer issue when DLT partitions are less than original topic partitions #1700

Closed
ecapoccia opened this issue Feb 6, 2021 · 2 comments · Fixed by #1706

Comments

@ecapoccia
Copy link

The default destination resolver in the DeadLetterPublishingRecoverer routes the records to a topic partition with the same name as the incoming consumer record + the suffix ".DLT", and the same partition as the incoming consumer record.

DEFAULT_DESTINATION_RESOLVER = (cr, e) -> new TopicPartition(cr.topic() + ".DLT", cr.partition());

This is a problem as this logic assumes that the number of partitions for the DLT is the same as the number of partitions of the original topic, which is not necessarily true.
In case the partitions for the DLT are less, this result in exceptions, as the destination partitions do not exist. Likewise in the (unlikely) case the DTL has more partitions than the original topic, some of them will be idle.

The solution I have successfully used is to set the destination partition to -1, which will delegate the choice of the destination partition within the DLT to Kafka.

DEFAULT_DESTINATION_RESOLVER = (cr, e) -> new TopicPartition(cr.topic() + ".DLT", -1);

Will submit a PR with a test to prove the case. I think this should be the default mechanism.

@garyrussell
Copy link
Contributor

As I said on the PR; we can't just change the default like that; we will make the documentation more visible,

@garyrussell
Copy link
Contributor

On reflection, I think we could inspect the DLT (if we have permissions) and log a WARN if the resolved partition doesn't exist.

That will satisfy your request, and prevent a breaking behavior change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants