-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Branch-2.8][improve][broker]Add retry for zk operation on connection loss #17226
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
[Branch-2.8][improve][broker]Add retry for zk operation on connection loss #17226
Conversation
| future.complete(Optional.empty()); | ||
| } else { | ||
| } else if (code == Code.CONNECTIONLOSS) { | ||
| // There is the chance that we caused a connection reset by sending or requesting a batch |
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.
Do we need to log something before retrying?
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.
Good idea
| } else if (code == Code.CONNECTIONLOSS) { | ||
| // There is the chance that we caused a connection reset by sending or requesting a batch | ||
| // that passed the max ZK limit. Retry with the individual operations | ||
| executor.schedule(() -> getChildrenFromStore(path), |
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.
We need pass the result of getChildrenFromStore to future in this.
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.
Good point, addressed.
Motivation
In the master branch, we have supported zk retry logic for connection loss cases, which will reduce data inconsistency for Pulsar broker with Zookeeper.
pulsar/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKMetadataStore.java
Lines 163 to 169 in 423ab75
Modification
We backport this feature into branch-2.8