Skip to content

fix: supportsMultiDb and supportsTransactionConfig where not trying resolved adresseses #725

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
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,11 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
for (let i = 0; i < addresses.length; i++) {
try {
const connection = await createChannelConnection(
this._address,
addresses[i],
this._config,
this._createConnectionErrorHandler(),
this._log
)

const protocolVersion = connection.protocol()
? connection.protocol().version
: null
Expand All @@ -194,8 +193,6 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
} catch (error) {
lastError = error
}

return false
}

if (lastError) {
Expand Down
2 changes: 1 addition & 1 deletion bolt-connection/src/connection/connection-channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export default class ChannelConnection extends Connection {
if (metadata) {
// read server version from the response metadata, if it is available
const serverVersion = metadata.server
if (!this.version) {
if (!this.version || serverVersion) {
this.version = serverVersion
}

Expand Down
2 changes: 1 addition & 1 deletion test/internal/node/routing.driver.boltkit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ describe('#stub-routing routing driver with stub server', () => {

function getRoutingTable (driver, database) {
const connectionProvider = driver._getOrCreateConnectionProvider()
return connectionProvider._routingTables[database || '']
return connectionProvider._routingTableRegistry.get(database || '', {})
}

function numberOfOpenConnections (driver) {
Expand Down
2 changes: 1 addition & 1 deletion test/resources/boltstub/v3/acquire_endpoints.script
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9007","127.0.0.1:9008"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9005","127.0.0.1:9006"], "role": "READ"},{"addresses": ["127.0.0.1:9001","127.0.0.1:9002","127.0.0.1:9003"], "role": "ROUTE"}]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
!: AUTO HELLO
!: AUTO RESET

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9007","127.0.0.1:9008"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9005","127.0.0.1:9006"], "role": "READ"},{"addresses": ["127.0.0.1:9001","127.0.0.1:9002","127.0.0.1:9003"], "role": "ROUTE"}]]
Expand Down
2 changes: 1 addition & 1 deletion test/resources/boltstub/v3/acquire_endpoints_dead.script
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
!: AUTO HELLO
!: AUTO RESET

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: <EXIT>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9001"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9002","127.0.0.1:9003"], "role": "READ"},{"addresses": ["127.0.0.1:9001","127.0.0.1:9002"], "role": "ROUTE"}]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9001"],"role": "WRITE"},{"addresses": ["127.0.0.1:9001","127.0.0.1:9002","127.0.0.1:9003"], "role": "ROUTE"}]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
SUCCESS {}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9001"],"role": "WRITE"},{"addresses": ["127.0.0.1:9001"], "role": "READ"}]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [9223372036854775807, []]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["notTtl", "noServers"]}
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9001"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9002","127.0.0.1:9003"], "role": "READ"},{"addresses": ["127.0.0.1:9001","127.0.0.1:9002","127.0.0.1:9003"], "role": "ROUTE"}]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["notTtl", "servers"]}
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9001"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9002","127.0.0.1:9003"], "role": "READ"},{"addresses": ["127.0.0.1:9001","127.0.0.1:9002","127.0.0.1:9003"], "role": "ROUTE"}]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [9223372036854775807, [{"addresses": [],"role": "WRITE"}, {"addresses": ["127.0.0.1:9005","127.0.0.1:9006"], "role": "READ"},{"addresses": ["127.0.0.1:9001","127.0.0.1:9002","127.0.0.1:9003"], "role": "ROUTE"}]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
C: PULL_ALL
S: FAILURE {"code": "Neo.ClientError.Procedure.ProcedureNotFound", "message": "blabla"}
S: IGNORED
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9001","127.0.0.1:9002"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9003","127.0.0.1:9004"], "role": "READ"},{"addresses": ["127.0.0.1:9005"], "role": "ROUTE"}]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9001"], "role": "ROUTE"}]]
SUCCESS {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9004"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9005"], "role": "READ"},{"addresses": ["127.0.0.1:9002","127.0.0.1:9003","127.0.0.1:9004"], "role": "ROUTE"}]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9008"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9001","127.0.0.1:9009","127.0.0.1:9010"], "role": "READ"},{"addresses": ["127.0.0.1:9001","127.0.0.1:9011"], "role": "ROUTE"}]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [0, [{"addresses": ["127.0.0.1:9007","127.0.0.1:9008"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9004"], "role": "READ"},{"addresses": ["127.0.0.1:9001","127.0.0.1:9002","127.0.0.1:9003"], "role": "ROUTE"}]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [9223372036854775807, [{"addresses": {{{writers}}},"role": "WRITE"}, {"addresses": {{{readers}}}, "role": "READ"},{"addresses": {{{routers}}}, "role": "ROUTE"}]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9002"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9001"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9002","127.0.0.1:9003"], "role": "READ"},{"addresses": ["127.0.0.1:9001","127.0.0.1:9002","127.0.0.1:9003"], "role": "ROUTE"}]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
!: AUTO HELLO
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9010"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9011"], "role": "READ"},{"addresses": ["127.0.0.1:9004"], "role": "ROUTE"}]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
!: AUTO HELLO
!: AUTO RESET

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9009"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9002","127.0.0.1:9003"], "role": "READ"},{"addresses": ["127.0.0.1:9001","127.0.0.1:9002","127.0.0.1:9003"], "role": "ROUTE"}]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
!: BOLT 3
!: AUTO HELLO

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9001", "127.0.0.1:9002"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9001", "127.0.0.1:9002"], "role": "READ"},{"addresses": ["127.0.0.1:9001", "127.0.0.1:9002"], "role": "ROUTE"}]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [9223372036854775807, [{"notAddresses": ["127.0.0.1:9001"],"memberRole": "WRITER"}, {"notAddresses": ["127.0.0.1:9002","127.0.0.1:9003"], "memberRole": "READER"},{"notAddresses": ["127.0.0.1:9001","127.0.0.1:9002"], "memberRole": "ROUTER"}]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [{ttl: 9223372036854775807}, [{"addresses": ["127.0.0.1:9001"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9002","127.0.0.1:9003"], "role": "READ"},{"addresses": ["127.0.0.1:9001","127.0.0.1:9002"], "role": "ROUTE"}]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"policy": "my_policy", "region": "china"}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"policy": "my_policy", "region": "china", "address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9001", "127.0.0.1:9002"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9001", "127.0.0.1:9002"], "role": "READ"},{"addresses": ["127.0.0.1:9001", "127.0.0.1:9002"], "role": "ROUTE"}]]
Expand Down
4 changes: 2 additions & 2 deletions test/resources/boltstub/v3/acquire_endpoints_zero_ttl.script
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [0, [{"addresses": ["127.0.0.1:9091","127.0.0.1:9092","127.0.0.1:9093","127.0.0.1:9999"],"role": "ROUTE"}, {"addresses": ["127.0.0.1:9999"], "role": "READ"},{"addresses": ["127.0.0.1:9999"], "role": "WRITE"}]]
Expand All @@ -12,7 +12,7 @@ C: RUN "MATCH (n) RETURN n" {} {}
PULL_ALL
S: SUCCESS {"fields": ["n"]}
SUCCESS {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [0, [{"addresses": ["127.0.0.1:9999"],"role": "ROUTE"}, {"addresses": ["127.0.0.1:9999"], "role": "READ"},{"addresses": ["127.0.0.1:9999"], "role": "WRITE"}]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9001", "[::1]:9001"],"role": "READ"}, {"addresses": ["[2001:db8:a0b:12f0::1]:9002","[3731:54:65fe:2::a7]:9003"], "role": "WRITE"},{"addresses": ["[ff02::1]:9001","[684D:1111:222:3333:4444:5555:6:77]:9002","[::1]:9003"], "role": "ROUTE"}]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!: AUTO RESET
!: AUTO GOODBYE

C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
PULL_ALL
S: SUCCESS {"fields": ["ttl", "servers"]}
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9001"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9002","127.0.0.1:9003"], "role": "READ"},{"addresses": ["127.0.0.1:9001","127.0.0.1:9002","127.0.0.1:9003"], "role": "ROUTE"}]]
Expand Down