Skip to content

Async routing improvements #411

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 9 commits into from
Oct 4, 2017

Conversation

lutovich
Copy link
Contributor

@lutovich lutovich commented Oct 2, 2017

PR makes async routing respect Config#withRoutingRetryDelay() setting and retry rediscovery configured amount of times with this delay. Retries are scheduled in Netty even loop. Also it makes load balancer "loop" until a working connection is acquired instead of failing on first failed acquisition attempt.

Based on #409

@lutovich lutovich requested review from zhenlineo and ali-ince October 2, 2017 14:37
Copy link
Contributor

@ali-ince ali-ince left a comment

Choose a reason for hiding this comment

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

LGTM.

To return both result and invoked procedure at the same time.
Previously procedure had to be accessed separately via getter. This is
a preparation for async, where full result will make it easier to
chain futures.
This commit makes `RoutingProcedureRunner` able to invoke routing
procedures asynchronously using given connection future. Server
version check is performed to determine which procedure to call.
This commit makes `ClusterCompositionProvider` able to interpret async
responses from `RoutingProcedureRunner`.
This commit makes `LoadBalancer` able to serve async connections.
Rediscovery procedure is also executed asynchronously. Connections
returned by `LoadBalancer` have special error handling logic to
remove failed instances from the routing table and purge their
connections from the pool.

Also made `AsyncConnection` expose server address and version
instead of `ServerInfo`.

Couple TODOs are introduced. They will be addressed in the
subsequent commits.
This commit makes async `Rediscovery` use and respect routing retry
delay exposed via `Config#withRoutingRetryDelay()` method. This is
done by scheduling retries in Netty even loop. It's quite different
compared to blocking version because we can't `Thread#sleep()`
in async.

Also added more unit tests for async rediscovery.
Previously load balancer selected a single address and tried to acquire
connection for it. Connection failure would then surface to the user.
This was done even though routing table could possibly contain other
valid machines that might respond.

This commit makes load balancer chain connection acquisition futures to
probe all known machines before failure.
Better method location and naming, removed printout.
@lutovich lutovich force-pushed the 1.5-async-routing-improvements branch from 2dfb470 to e37d21e Compare October 3, 2017 10:12
@lutovich lutovich force-pushed the 1.5-async-routing-improvements branch from 23d2e57 to ca640ae Compare October 3, 2017 16:54
@zhenlineo zhenlineo merged commit 9c9e61d into neo4j:1.5 Oct 4, 2017
@lutovich lutovich deleted the 1.5-async-routing-improvements branch October 4, 2017 09:44
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.

3 participants