Improve ordering of connection initialization #401
Merged
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.
Make sure every connection acquired from the connection pool is fully initialized and authenticated. Before this change, a connection was created in a synchronous way. Then protocol handshake and INIT message were sent asynchronously. So creation of a connection looked like a sync operation but it is not. Authentication info was also sent with INIT message regardless of the Bolt protocol negotiation. This worked fine for Bolt V1 and V2 because they used same INIT message. However, for Bolt V3 initialization has to happen after protocol version negotiation because the initialization message is different.
PR also moves error handling to the connection layer. Before, error handling/processing was in both
StreamObserver
andTransaction
. It's mostly needed to handle failures in RoutingDriver (forget address from the routing table). Now handling of errors will be done in a single place -Connection
object using a specialConnectionErrorHandler
. This handler is different for direct and routing drivers.