neo4j / neo4j-go-driver

Neo4j Bolt Driver for Go
Apache License 2.0
485 stars 68 forks source link

feat: support connect failed to force refresh routing table #515

Closed youngxhui closed 1 year ago

youngxhui commented 1 year ago

when one of the neo4j cluster's instance shutdown, the connection will be failed, becuase the routing table ttl is 300s. In the 300s, the routing table can not refresh, the session is failed until next routing table refresh. if modifiy router ttl's value short on neo4j server, the cache is no valueable .

now, if session connection failed, client will be forced refresh routing table and retry connection neo4j server.

s.router.Invalidate(s.databaseName)

The router make the database invalidate, when it next try to connection neo4j cluster ,the router will be create new routing table.

StephenCathcart commented 1 year ago

As per issue #519, a fix for the problem mentioned will be included in a future release.

robsdedude commented 1 year ago

Thank you very much for taking the time to make a contribution @youngxhui :raised_hands:

As mentioned by @StephenCathcart we've been working on a fix for this issue independently. https://github.com/neo4j/neo4j-go-driver/pull/520 should fix it while even being broader: removing bad servers from the routing table should not only happen when using transaction functions (session.runRetriable), but for any other API as well.

I will close this PR for now. However, we will come back to it should we not move forward with the other PR I've linked.

youngxhui commented 1 year ago

Thank you very much for taking the time to make a contribution @youngxhui 🙌

As mentioned by @StephenCathcart we've been working on a fix for this issue independently. #520 should fix it while even being broader: removing bad servers from the routing table should not only happen when using transaction functions (session.runRetriable), but for any other API as well.

I will close this PR for now. However, we will come back to it should we not move forward with the other PR I've linked.

Is there a plan to support 4.4?

StephenCathcart commented 1 year ago

Hi @youngxhui, unfortunately for now there are no plans to support this change in 4.4 - there are too many things to backport for an LTS. Upgrading to the 5.x driver is fairly straightforward, if you don't mind deprecation warnings.