Skip to content

Improve ordering of connection initialization #401

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 1 commit into from
Aug 27, 2018

Conversation

lutovich
Copy link
Contributor

@lutovich lutovich commented Aug 27, 2018

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 and Transaction. 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 special ConnectionErrorHandler. This handler is different for direct and routing drivers.

@lutovich lutovich force-pushed the 1.7-eager-conn-init branch 3 times, most recently from 6d137dd to 5ee9421 Compare August 27, 2018 14:02
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.

Commit also moves error handling to the connection layer. Before, error
handling/processing was in both `StreamObserver` and `Transaction`.
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 special `ConnectionErrorHandler`.
This handler is different for direct driver and routing drivers.
@lutovich lutovich force-pushed the 1.7-eager-conn-init branch from 5ee9421 to 986b4b0 Compare August 27, 2018 14:13
@lutovich lutovich merged commit 3c42269 into neo4j:1.7 Aug 27, 2018
@lutovich lutovich deleted the 1.7-eager-conn-init branch August 27, 2018 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant