Skip to content

Commit e0cdb25

Browse files
committed
fix: supportsMultiDb and supportsTransactionConfig where not trying resolved adresses
This methods were only trying to connect to the seed server address to check the protocol version.
1 parent 059f49a commit e0cdb25

30 files changed

+32
-35
lines changed

bolt-connection/src/connection-provider/connection-provider-routing.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,11 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
174174
for (let i = 0; i < addresses.length; i++) {
175175
try {
176176
const connection = await createChannelConnection(
177-
this._address,
177+
addresses[i],
178178
this._config,
179179
this._createConnectionErrorHandler(),
180180
this._log
181181
)
182-
183182
const protocolVersion = connection.protocol()
184183
? connection.protocol().version
185184
: null
@@ -194,8 +193,6 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
194193
} catch (error) {
195194
lastError = error
196195
}
197-
198-
return false
199196
}
200197

201198
if (lastError) {

bolt-connection/src/connection/connection-channel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ export default class ChannelConnection extends Connection {
188188
if (metadata) {
189189
// read server version from the response metadata, if it is available
190190
const serverVersion = metadata.server
191-
if (!this.version) {
191+
if (!this.version || serverVersion) {
192192
this.version = serverVersion
193193
}
194194

test/internal/node/routing.driver.boltkit.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ describe('#stub-routing routing driver with stub server', () => {
617617

618618
function getRoutingTable (driver, database) {
619619
const connectionProvider = driver._getOrCreateConnectionProvider()
620-
return connectionProvider._routingTables[database || '']
620+
return connectionProvider._routingTableRegistry.get(database || '', {})
621621
}
622622

623623
function numberOfOpenConnections (driver) {

test/resources/boltstub/v3/acquire_endpoints.script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
!: AUTO RESET
44
!: AUTO GOODBYE
55

6-
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
6+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
77
PULL_ALL
88
S: SUCCESS {"fields": ["ttl", "servers"]}
99
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"}]]

test/resources/boltstub/v3/acquire_endpoints_and_exit.script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
!: AUTO HELLO
33
!: AUTO RESET
44

5-
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
5+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
66
PULL_ALL
77
S: SUCCESS {"fields": ["ttl", "servers"]}
88
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"}]]

test/resources/boltstub/v3/acquire_endpoints_dead.script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
!: AUTO HELLO
33
!: AUTO RESET
44

5-
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
5+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
66
PULL_ALL
77
S: <EXIT>

test/resources/boltstub/v3/acquire_endpoints_multiple_records.script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
!: AUTO RESET
44
!: AUTO GOODBYE
55

6-
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
6+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
77
PULL_ALL
88
S: SUCCESS {"fields": ["ttl", "servers"]}
99
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"}]]

test/resources/boltstub/v3/acquire_endpoints_no_readers.script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
!: AUTO RESET
44
!: AUTO GOODBYE
55

6-
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
6+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
77
PULL_ALL
88
S: SUCCESS {"fields": ["ttl", "servers"]}
99
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"}]]

test/resources/boltstub/v3/acquire_endpoints_no_records.script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
!: AUTO RESET
44
!: AUTO GOODBYE
55

6-
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
6+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
77
PULL_ALL
88
S: SUCCESS {"fields": ["ttl", "servers"]}
99
SUCCESS {}

test/resources/boltstub/v3/acquire_endpoints_no_routers.script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
!: AUTO RESET
44
!: AUTO GOODBYE
55

6-
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
6+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
77
PULL_ALL
88
S: SUCCESS {"fields": ["ttl", "servers"]}
99
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9001"],"role": "WRITE"},{"addresses": ["127.0.0.1:9001"], "role": "READ"}]]

0 commit comments

Comments
 (0)