-
Notifications
You must be signed in to change notification settings - Fork 0
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 #1
Conversation
@@ -29,7 +30,8 @@ | |||
*/ | |||
@InterfaceAudience.Public | |||
@InterfaceStability.Stable | |||
public abstract class KeySharedPolicy { | |||
public abstract class KeySharedPolicy implements Serializable { | |||
private static final long serialVersionUID = 1L; |
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.
Add private static final long serialVersionUID = 1L;
to the implementation classes of the abstract KeySharedPolicy
class instead of adding it to the abstract class where it is unnecessary.
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.
Yes, my bad! Made these changes.
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.
Since this change is also included in this PR, I guess the transient
definition for the keyHashRanges
field in ReaderConfigurationData could be removed.
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.
Agreed. Removed the transient keyword there too.
I think it would be useful to reproduce the serialization problem that you explained in the issue apache#23704 |
btw. I didn't notice until now that this is the PR in your fork to run Pulsar CI. Once you are ready with the initial pass, you can go ahead and open the PR at apache/pulsar for this PR branch. I can continue the review on that PR. I usually don't add review comments in the shadowed PR in the fork (which is for having full control of Pulsar CI and getting that feedback while working on the PR). |
Sure. I just need one clarification though. When you said that it would be useful to reproduce the serialization problem, Did you mean for me to enhance the tests for that class to include checks on these fields? |
I meant that there should be a test case what you described in the issue itself: "Create an instance of ConsumerConfigurationData class and set a deadLetterPolicy on it. Serialize it and de-serialize it back to get a new instance of the same. The deadLetterPolicy previously set should not be present after deserialization.". |
@lhotari All the CI actions, (except the code coverage upload actions) have run successfully. I have raised a PR against the main repo master branch (apache#23718). Please do let me know if anything else is needed from my end. |
Closing this PR as it is merged on the main repo (apache#23718) |
Fixes apache#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 thePulsarSpout
seems to be lost when the topology is started. Upon investigation, we found that this is due to thedeadLetterPolicy
attribute inConsumerConfigurationData
being marked astransient
. This prevents us from utilising the dead letter queue feature in our topology.Modifications
Made
DeadLetterPolicy
,KeySharedPolicy
andRange
classes implement thejava.io.Serializable
interface and removed thetransient
keyword from the corresponding fields in theConsumerConfigurationData
class.Verifying this change
This change is already covered by existing tests, such
ClientConfigurationDataTest.java
Does this pull request potentially affect one of the following parts:
Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: