-
Notifications
You must be signed in to change notification settings - Fork 42
Improve the super stream reconnection #344
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixes #333 Signed-off-by: Gabriele Santomaggio <[email protected]>
Signed-off-by: Gabriele Santomaggio <[email protected]>
* Reconnect the super stream partition with the stream info the stream could change the topology. The new stream info need to be passed to the producer or consumer * Expose stream_info it gives info about the stream location like: leader and followers Signed-off-by: Gabriele Santomaggio <[email protected]>
Signed-off-by: Gabriele Santomaggio <[email protected]>
Signed-off-by: Gabriele Santomaggio <[email protected]>
Signed-off-by: Gabriele Santomaggio <[email protected]>
Add the SuperStream interface Signed-off-by: Gabriele Santomaggio <[email protected]>
Signed-off-by: Gabriele Santomaggio <[email protected]>
Signed-off-by: Gabriele Santomaggio <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #333
Fixes: #335
Preface
The PR is focused on making the client more stable during the server restart and better handling the metadata update event.
Most of the changes are in the super stream producer and consumer.
See the issue #333
1- What's changed in the super stream part
The RawSuperStreamProducer and RawSuperStreamConsumer expose two callbacks:
ConnectionClosedHandler (reason, stream)
MetadataHandler(update)
ISuperStreamProducer
andISuperStreamConsumer
interfacesConnectionClosedHandler
The callback is raised each time a partition is closed for some reason. You can check the reason with:
1- The super stream partition is closed by the
Close()
method, so there are no problems. It can be helpful in terms of alerting or logs.2- The super stream partition is closed in an unexpected way like kill the connection, network problems broker restart etc..
In that case, you can reconnect the partition with the
ReconnectPartition
method.Like:
MetadataHandler
It happens when there is a change in the stream topology.
See the document for more details.
In this case, the server drops all the producers and consumers. So, you need to react to the Metadata Handler event. You can decide to reconnect the producer and consumer
using the
ReconnectPartition
Producer and Consumer classes
The
Producer
andConsumer
classes handle automatically theConnectionClosedHandler
and theMetadataHandler
events for stream and super stream.2- Fail fast
The Producer and Consumer classes can restore the connection automatically when they are up and running.
The classes will fail immediately if there are problems during the first connection.
This behaviour is now like the Java Client's.
3- Survive a cluster restart
Please follow this presentation to understand what happens during a cluster restart
You can create your own way to handle the reconnection based on Raw Classes.