Repository navigation
[fix] [broker] Topic close failure leaves subscription in a permanent fence state - #19692
Conversation
| */ | ||
| public synchronized CompletableFuture<Void> resumeAfterFence() { | ||
| CompletableFuture<Void> result = new CompletableFuture<>(); | ||
| fenceFuture.whenComplete((ignore, ignore2) -> { |
There was a problem hiding this comment.
fenceFuture may be null here
| result.complete(null); | ||
| } catch (Exception ex){ | ||
| result.completeExceptionally(ex); | ||
| log.error("[{}] Resume subscription[{}] failure: {}", topicName, subName, ex.getMessage(), ex); |
There was a problem hiding this comment.
please move this before completeExceptionally, otherwise logs may be hard to understand
| } | ||
|
|
||
| private void unfenceTopicToResume() { | ||
| subscriptions.values().forEach(sub -> sub.resumeAfterFence()); |
There was a problem hiding this comment.
resumeAfterFence returns a CompletableFuture, don't we need to "wait"
There was a problem hiding this comment.
During the execution of the method resumeAfterFence, consumers will keep trying to reconnect. When the execution of method resumeAfterFence is complete, the consumer will automatically connect successfully and can consume the message. So it's okay not to wait.
There was a problem hiding this comment.
Then you can make resumeAfterFence return "void", can't you ?
There was a problem hiding this comment.
Good suggestion. Already fixed.
| return fenceFuture; | ||
| } | ||
| if (fenceFuture != null && fenceFuture.isDone() && !fenceFuture.isCompletedExceptionally()){ | ||
| return fenceFuture; |
There was a problem hiding this comment.
It seems that if PersistentSubscription disconnect successfully, but PersistentTopic close failed and resume, the PersistentSubscription can't disconnect again.
There was a problem hiding this comment.
Good catch. already fixed.
|
/pulsarbot rerun-failure-checks |
1 similar comment
|
/pulsarbot rerun-failure-checks |
| if (fenceFuture != null && !fenceFuture.isDone()){ | ||
| return fenceFuture; | ||
| } | ||
| if (fenceFuture != null && fenceFuture.isDone() && !fenceFuture.isCompletedExceptionally()){ | ||
| return fenceFuture; |
There was a problem hiding this comment.
It looks like we can simplify to
if (fenceFuture != null && !fenceFuture.isCompletedExceptionally()) {
return fenceFuture;
}And why must we create a new future if the existing fenceFuture is completed with an exception? To make it retryable?
If yes, we'd better add a comment here to help us to understand why it should be retryable in the future.
There was a problem hiding this comment.
I think you are right. There has no scenario that needs to retry.
| } | ||
| fenceFuture = null; | ||
| } catch (Exception ex) { | ||
| log.error("[{}] Resume subscription[{}] failure: {}", topicName, subName, ex.getMessage(), ex); |
There was a problem hiding this comment.
| log.error("[{}] Resume subscription[{}] failure: {}", topicName, subName, ex.getMessage(), ex); | |
| log.error("[{}] Resume subscription [{}] failure", topicName, subName, ex); |
53a3f6a to
513f663
Compare
|
/pulsarbot rerun-failure-checks |
2 similar comments
|
/pulsarbot rerun-failure-checks |
|
/pulsarbot rerun-failure-checks |
… fence state (#19692) Motivation : After a Topic close failure or a delete failure, the fence state will be reset to get the topic back to work,but it will not reset the fence state of the subscription, which will result in the consumer never being able to connect to the broker. Modifications: Reset the fence state of subscriptions if the operation of topic close is failed. (cherry picked from commit cdeef00)
… fence state (#19692) Motivation : After a Topic close failure or a delete failure, the fence state will be reset to get the topic back to work,but it will not reset the fence state of the subscription, which will result in the consumer never being able to connect to the broker. Modifications: Reset the fence state of subscriptions if the operation of topic close is failed. (cherry picked from commit cdeef00)
… fence state (#19692) Motivation : After a Topic close failure or a delete failure, the fence state will be reset to get the topic back to work,but it will not reset the fence state of the subscription, which will result in the consumer never being able to connect to the broker. Modifications: Reset the fence state of subscriptions if the operation of topic close is failed. (cherry picked from commit cdeef00)
… fence state (apache#19692) Motivation : After a Topic close failure or a delete failure, the fence state will be reset to get the topic back to work,but it will not reset the fence state of the subscription, which will result in the consumer never being able to connect to the broker. Modifications: Reset the fence state of subscriptions if the operation of topic close is failed. (cherry picked from commit cdeef00) (cherry picked from commit 751eeea)
Motivation
After a Topic close failure or a delete failure, the fence state will be reset to get the topic back to work,but it will not reset the fence state of the subscription, which will result in the consumer never being able to connect to the broker.
Modifications
Reset the fence state of subscriptions if the operation of topic close is failed.
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: