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

[fix][client] Make DeadLetterPolicy & KeySharedPolicy serializable #23718

Merged
merged 4 commits into from
Dec 24, 2024

Conversation

AnuragReddy2000
Copy link
Contributor

@AnuragReddy2000 AnuragReddy2000 commented Dec 12, 2024

Fixes #23704

Motivation

We use the pulsar client to consume messages from a Pulsar broker in a Storm topology. Recently, we encountered an issue where the deadLetterPolicy that we set on the PulsarSpout seems to be lost when the topology is started. Upon investigation, we found that this is due to the deadLetterPolicy attribute in ConsumerConfigurationData being marked as transient. This prevents us from utilising the dead letter queue feature in our topology.

Modifications

Made DeadLetterPolicy, KeySharedPolicy and Range classes implement the java.io.Serializable interface and removed the transient keyword from the corresponding fields in the ConsumerConfigurationData class. In addition, two tests were also modified / updated.

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

  • Extended existing unit test for the ConsumerConfigurationData class to validate the retention of deadLetterPolicy through serialization & deserialization.

Does this pull request potentially affect one of the following parts:

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: AnuragReddy2000#1

@dao-jun
Copy link
Member

dao-jun commented Dec 13, 2024

oh, that is a unconventional use case I've been never seen. @lhotari Do you think is this change makes sense?

Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good work @AnuragReddy2000

@AnuragReddy2000
Copy link
Contributor Author

/pulsarbot rerun-failure-checks

@AnuragReddy2000
Copy link
Contributor Author

@lhotari A test is failing on this PR which did not fail on the PR that raised in my fork. I checked the test, I'm not sure how my changes may cause it to fail. What do you suggest I do here?

@lhotari
Copy link
Member

lhotari commented Dec 23, 2024

@lhotari A test is failing on this PR which did not fail on the PR that raised in my fork. I checked the test, I'm not sure how my changes may cause it to fail. What do you suggest I do here?

@AnuragReddy2000 there are quite a few flaky tests. Reporting ones that haven't already been reported and retrying is the way to handle it.

@codecov-commenter
Copy link

codecov-commenter commented Dec 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.41%. Comparing base (bbc6224) to head (1152743).
Report is 813 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #23718      +/-   ##
============================================
+ Coverage     73.57%   74.41%   +0.83%     
- Complexity    32624    34588    +1964     
============================================
  Files          1877     1945      +68     
  Lines        139502   147480    +7978     
  Branches      15299    16277     +978     
============================================
+ Hits         102638   109742    +7104     
- Misses        28908    29278     +370     
- Partials       7956     8460     +504     
Flag Coverage Δ
inttests 27.26% <75.00%> (+2.67%) ⬆️
systests 24.33% <75.00%> (+<0.01%) ⬆️
unittests 73.81% <100.00%> (+0.96%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...org/apache/pulsar/client/api/DeadLetterPolicy.java 87.50% <ø> (ø)
.../org/apache/pulsar/client/api/KeySharedPolicy.java 93.93% <100.00%> (+3.03%) ⬆️
.../main/java/org/apache/pulsar/client/api/Range.java 86.20% <ø> (+8.93%) ⬆️
...ar/client/impl/conf/ConsumerConfigurationData.java 92.63% <100.00%> (+0.07%) ⬆️
...lsar/client/impl/conf/ReaderConfigurationData.java 89.36% <100.00%> (ø)

... and 668 files with indirect coverage changes

@dao-jun dao-jun merged commit 14129e3 into apache:master Dec 24, 2024
58 of 59 checks passed
lhotari pushed a commit that referenced this pull request Jan 2, 2025
lhotari pushed a commit that referenced this pull request Jan 2, 2025
lhotari pushed a commit that referenced this pull request Jan 2, 2025
nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request Jan 3, 2025
…pache#23718)

Co-authored-by: anurag.reddy <[email protected]>
(cherry picked from commit 14129e3)
(cherry picked from commit b9ce087)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Jan 3, 2025
…pache#23718)

Co-authored-by: anurag.reddy <[email protected]>
(cherry picked from commit 14129e3)
(cherry picked from commit b9ce087)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] deadLetterPolicy attribute in the ConsumerConfigurationData class marked as transient
4 participants