Skip to content

Conversation

@hangc0276
Copy link
Contributor

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.

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(() -> {
ops.forEach(o -> batchOperation(Collections.singletonList(o)));
}, 100, TimeUnit.MILLISECONDS);
} else {

Modification

We backport this feature into branch-2.8

@hangc0276 hangc0276 self-assigned this Aug 23, 2022
@hangc0276 hangc0276 added type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages area/metadata release/2.8.5 labels Aug 23, 2022
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
Copy link
Member

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?

Copy link
Contributor Author

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),
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, addressed.

@hangc0276 hangc0276 requested review from Jason918 and zymap August 23, 2022 08:19
@codelipenghui codelipenghui merged commit a9f3664 into apache:branch-2.8 Aug 23, 2022
@zymap zymap added the cherry-picked/branch-2.8 Archived: 2.8 is end of life label Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/metadata cherry-picked/branch-2.8 Archived: 2.8 is end of life release/2.8.5 type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants