Skip to content

Commit cb27f95

Browse files
committed
Adding address to routing context in routing procedure call (neo4j#704)
* Passing the URI configured by the user to the Server's routing procedure. This allows the server to provide more suitable routing suggestions when in a single instance mode using the neo4j scheme
1 parent 286693e commit cb27f95

29 files changed

+156
-55
lines changed

driver/src/main/java/org/neo4j/driver/internal/cluster/RoutingContext.java

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@
2222
import java.util.HashMap;
2323
import java.util.Map;
2424

25+
import org.neo4j.driver.internal.BoltServerAddress;
26+
2527
import static java.util.Collections.emptyMap;
2628
import static java.util.Collections.unmodifiableMap;
2729

2830
public class RoutingContext
2931
{
3032
public static final RoutingContext EMPTY = new RoutingContext();
33+
private static final String ROUTING_ADDRESS_KEY = "address";
3134

3235
private final Map<String,String> context;
3336

@@ -43,7 +46,7 @@ public RoutingContext( URI uri )
4346

4447
public boolean isDefined()
4548
{
46-
return !context.isEmpty();
49+
return context.size() > 1;
4750
}
4851

4952
public Map<String,String> asMap()
@@ -60,13 +63,25 @@ public String toString()
6063
private static Map<String,String> parseParameters( URI uri )
6164
{
6265
String query = uri.getQuery();
66+
String address;
6367

64-
if ( query == null || query.isEmpty() )
68+
if ( uri.getPort() == -1 )
6569
{
66-
return emptyMap();
70+
address = String.format( "%s:%s", uri.getHost(), BoltServerAddress.DEFAULT_PORT );
71+
}
72+
else
73+
{
74+
address = String.format( "%s:%s", uri.getHost(), uri.getPort() );
6775
}
6876

6977
Map<String,String> parameters = new HashMap<>();
78+
parameters.put( ROUTING_ADDRESS_KEY, address );
79+
80+
if ( query == null || query.isEmpty() )
81+
{
82+
return parameters;
83+
}
84+
7085
String[] pairs = query.split( "&" );
7186
for ( String pair : pairs )
7287
{
@@ -77,19 +92,29 @@ private static Map<String,String> parseParameters( URI uri )
7792
"Invalid parameters: '" + pair + "' in URI '" + uri + "'" );
7893
}
7994

80-
String key = trimAndVerify( keyValue[0], "key", uri );
81-
String value = trimAndVerify( keyValue[1], "value", uri );
82-
83-
String previousValue = parameters.put( key, value );
95+
String previousValue = parameters.put( trimAndVerifyKey( keyValue[0], "key", uri ),
96+
trimAndVerify( keyValue[1], "value", uri ) );
8497
if ( previousValue != null )
8598
{
8699
throw new IllegalArgumentException(
87-
"Duplicated query parameters with key '" + key + "' in URI '" + uri + "'" );
100+
"Duplicated query parameters with key '" + previousValue + "' in URI '" + uri + "'" );
88101
}
89102
}
90103
return parameters;
91104
}
92105

106+
private static String trimAndVerifyKey( String s, String key, URI uri )
107+
{
108+
String trimmed = trimAndVerify( s, key, uri );
109+
110+
if (trimmed.equals( ROUTING_ADDRESS_KEY ))
111+
{
112+
throw new IllegalArgumentException( "The key 'address' is reserved for routing context.");
113+
}
114+
115+
return trimmed;
116+
}
117+
93118
private static String trimAndVerify( String string, String name, URI uri )
94119
{
95120
String result = string.trim();

driver/src/test/java/org/neo4j/driver/GraphDatabaseTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ void throwsWhenBoltSchemeUsedWithRoutingParams()
9797
@Test
9898
void shouldLogWhenUnableToCreateRoutingDriver() throws Exception
9999
{
100-
StubServer server1 = StubServer.start( "discover_not_supported.script", 9001 );
101-
StubServer server2 = StubServer.start( "discover_not_supported.script", 9002 );
100+
StubServer server1 = StubServer.start( "discover_not_supported_9001.script", 9001 );
101+
StubServer server2 = StubServer.start( "discover_not_supported_9002.script", 9002 );
102102

103103
Logging logging = mock( Logging.class );
104104
Logger logger = mock( Logger.class );

driver/src/test/java/org/neo4j/driver/integration/RoutingDriverBoltKitTest.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ void shouldRoundRobinWriteSessionsInTransaction() throws Exception
415415
void shouldFailOnNonDiscoverableServer() throws IOException, InterruptedException
416416
{
417417
// Given
418-
StubServer.start( "discover_not_supported.script", 9001 );
418+
StubServer.start( "discover_not_supported_9001.script", 9001 );
419419
URI uri = URI.create( "neo4j://127.0.0.1:9001" );
420420
final Driver driver = GraphDatabase.driver( uri, INSECURE_CONFIG );
421421

@@ -778,10 +778,10 @@ void shouldRetryWriteTransactionUntilFailure() throws Exception
778778
@Test
779779
void shouldRetryReadTransactionAndPerformRediscoveryUntilSuccess() throws Exception
780780
{
781-
StubServer router1 = StubServer.start( "acquire_endpoints_v3.script", 9010 );
781+
StubServer router1 = StubServer.start( "acquire_endpoints_v3_9010.script", 9010 );
782782
StubServer brokenReader1 = StubServer.start( "dead_read_server_tx.script", 9005 );
783783
StubServer brokenReader2 = StubServer.start( "dead_read_server_tx.script", 9006 );
784-
StubServer router2 = StubServer.start( "discover_servers.script", 9003 );
784+
StubServer router2 = StubServer.start( "discover_servers_9010.script", 9003 );
785785
StubServer reader = StubServer.start( "read_server_v3_read_tx.script", 9004 );
786786

787787
try ( Driver driver = newDriverWithSleeplessClock( "neo4j://127.0.0.1:9010" ); Session session = driver.session() )
@@ -805,9 +805,9 @@ void shouldRetryReadTransactionAndPerformRediscoveryUntilSuccess() throws Except
805805
@Test
806806
void shouldRetryWriteTransactionAndPerformRediscoveryUntilSuccess() throws Exception
807807
{
808-
StubServer router1 = StubServer.start( "discover_servers.script", 9010 );
808+
StubServer router1 = StubServer.start( "discover_servers_9010.script", 9010 );
809809
StubServer brokenWriter1 = StubServer.start( "dead_write_server.script", 9001 );
810-
StubServer router2 = StubServer.start( "acquire_endpoints_v3.script", 9002 );
810+
StubServer router2 = StubServer.start( "acquire_endpoints_v3_9010.script", 9002 );
811811
StubServer brokenWriter2 = StubServer.start( "dead_write_server.script", 9008 );
812812
StubServer writer = StubServer.start( "write_server_v3_write_tx.script", 9007 );
813813

@@ -833,16 +833,16 @@ void shouldRetryWriteTransactionAndPerformRediscoveryUntilSuccess() throws Excep
833833
void shouldUseInitialRouterForRediscoveryWhenAllOtherRoutersAreDead() throws Exception
834834
{
835835
// initial router does not have itself in the returned set of routers
836-
StubServer router = StubServer.start( "acquire_endpoints_v3.script", 9010 );
836+
StubServer router = StubServer.start( "acquire_endpoints_v3.script", 9001 );
837837

838-
try ( Driver driver = GraphDatabase.driver( "neo4j://127.0.0.1:9010", INSECURE_CONFIG ) )
838+
try ( Driver driver = GraphDatabase.driver( "neo4j://127.0.0.1:9001", INSECURE_CONFIG ) )
839839
{
840840
driver.verifyConnectivity();
841841
try ( Session session = driver.session( builder().withDefaultAccessMode( AccessMode.READ ).build() ) )
842842
{
843843
// restart router on the same port with different script that contains itself as reader
844844
assertEquals( 0, router.exitStatus() );
845-
router = StubServer.start( "rediscover_using_initial_router.script", 9010 );
845+
router = StubServer.start( "rediscover_using_initial_router.script", 9001 );
846846

847847
List<String> names = readStrings( "MATCH (n) RETURN n.name AS name", session );
848848
assertEquals( asList( "Bob", "Alice" ), names );
@@ -895,8 +895,8 @@ void shouldSendRoutingContextToServer() throws Exception
895895
@Test
896896
void shouldServeReadsButFailWritesWhenNoWritersAvailable() throws Exception
897897
{
898-
StubServer router1 = StubServer.start( "discover_no_writers.script", 9010 );
899-
StubServer router2 = StubServer.start( "discover_no_writers.script", 9004 );
898+
StubServer router1 = StubServer.start( "discover_no_writers_9010.script", 9010 );
899+
StubServer router2 = StubServer.start( "discover_no_writers_9010.script", 9004 );
900900
StubServer reader = StubServer.start( "read_server_v3_read_tx.script", 9003 );
901901

902902
try ( Driver driver = GraphDatabase.driver( "neo4j://127.0.0.1:9010", INSECURE_CONFIG );
@@ -919,7 +919,7 @@ void shouldAcceptRoutingTableWithoutWritersAndThenRediscover() throws Exception
919919
{
920920
// first router does not have itself in the resulting routing table so connection
921921
// towards it will be closed after rediscovery
922-
StubServer router1 = StubServer.start( "discover_no_writers.script", 9010 );
922+
StubServer router1 = StubServer.start( "discover_no_writers_9010.script", 9010 );
923923
StubServer router2 = null;
924924
StubServer reader = StubServer.start( "read_server_v3_read_tx.script", 9003 );
925925
StubServer writer = StubServer.start( "write_with_bookmarks.script", 9007 );
@@ -930,7 +930,7 @@ void shouldAcceptRoutingTableWithoutWritersAndThenRediscover() throws Exception
930930
try ( Session session = driver.session() )
931931
{
932932
// start another router which knows about writes, use same address as the initial router
933-
router2 = StubServer.start( "acquire_endpoints_v3.script", 9010 );
933+
router2 = StubServer.start( "acquire_endpoints_v3_9010.script", 9010 );
934934

935935
assertEquals( asList( "Bob", "Alice", "Tina" ), readStrings( "MATCH (n) RETURN n.name", session ) );
936936

@@ -983,7 +983,7 @@ void shouldSendMultipleBookmarks() throws Exception
983983
StubServer router = StubServer.start( "acquire_endpoints_v3.script", 9001 );
984984
StubServer writer = StubServer.start( "multiple_bookmarks.script", 9007 );
985985

986-
try ( Driver driver = GraphDatabase.driver( "neo4j://localhost:9001", INSECURE_CONFIG );
986+
try ( Driver driver = GraphDatabase.driver( "neo4j://127.0.0.1:9001", INSECURE_CONFIG );
987987
Session session = driver.session( builder().withBookmarks( InternalBookmark.parse(
988988
asOrderedSet( "neo4j:bookmark:v1:tx5", "neo4j:bookmark:v1:tx29", "neo4j:bookmark:v1:tx94", "neo4j:bookmark:v1:tx56",
989989
"neo4j:bookmark:v1:tx16", "neo4j:bookmark:v1:tx68" ) ) ).build() ) )
@@ -1007,16 +1007,16 @@ void shouldSendMultipleBookmarks() throws Exception
10071007
void shouldForgetAddressOnDatabaseUnavailableError() throws Exception
10081008
{
10091009
// perform initial discovery using router1
1010-
StubServer router1 = StubServer.start( "discover_servers.script", 9010 );
1010+
StubServer router1 = StubServer.start( "discover_servers_9010.script", 9010 );
10111011
// attempt to write using writer1 which fails with 'Neo.TransientError.General.DatabaseUnavailable'
10121012
// it should then be forgotten and trigger new rediscovery
10131013
StubServer writer1 = StubServer.start( "writer_unavailable.script", 9001 );
10141014
// perform rediscovery using router2, it should return a valid writer2
1015-
StubServer router2 = StubServer.start( "acquire_endpoints_v3.script", 9002 );
1015+
StubServer router2 = StubServer.start( "acquire_endpoints_v3_9010.script", 9002 );
10161016
// write on writer2 should be successful
10171017
StubServer writer2 = StubServer.start( "write_server_v3_write_tx.script", 9007 );
10181018

1019-
try ( Driver driver = newDriverWithSleeplessClock( "neo4j://localhost:9010" ); Session session = driver.session() )
1019+
try ( Driver driver = newDriverWithSleeplessClock( "neo4j://127.0.0.1:9010" ); Session session = driver.session() )
10201020
{
10211021
AtomicInteger invocations = new AtomicInteger();
10221022
List<Record> records = session.writeTransaction( queryWork( "CREATE (n {name:'Bob'})", invocations ) );

driver/src/test/java/org/neo4j/driver/integration/RoutingDriverMultidatabaseBoltKitTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void shouldRetryOnEmptyDiscoveryResult() throws IOException, InterruptedExceptio
8484
};
8585

8686
StubServer emptyRouter = StubServer.start( "acquire_endpoints_v4_empty.script", 9001 );
87-
StubServer realRouter = StubServer.start( "acquire_endpoints_v4.script", 9002 );
87+
StubServer realRouter = StubServer.start( "acquire_endpoints_v4_virtual_host.script", 9002 );
8888
StubServer reader = StubServer.start( "read_server_v4_read.script", 9005 );
8989

9090
Config config = insecureBuilder().withResolver( resolver ).build();

driver/src/test/java/org/neo4j/driver/internal/cluster/RoutingContextTest.java

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ void uriWithQueryIsParsed()
6868
expectedMap.put( "key1", "value1" );
6969
expectedMap.put( "key2", "value2" );
7070
expectedMap.put( "key3", "value3" );
71+
expectedMap.put( "address", "localhost:7687" );
7172
assertEquals( expectedMap, context.asMap() );
7273
}
7374

@@ -101,10 +102,32 @@ void mapRepresentationIsUnmodifiable()
101102
URI uri = URI.create( "neo4j://localhost:7687/?key1=value1" );
102103
RoutingContext context = new RoutingContext( uri );
103104

104-
assertEquals( singletonMap( "key1", "value1" ), context.asMap() );
105+
Map<String,String> expectedMap = new HashMap<>();
106+
expectedMap.put( "key1", "value1" );
107+
expectedMap.put( "address", "localhost:7687" );
108+
109+
assertEquals( expectedMap, context.asMap() );
105110

106111
assertThrows( UnsupportedOperationException.class, () -> context.asMap().put( "key2", "value2" ) );
107-
assertEquals( singletonMap( "key1", "value1" ), context.asMap() );
112+
assertEquals( expectedMap, context.asMap() );
113+
}
114+
115+
@Test
116+
void populateAddressWithDefaultPort()
117+
{
118+
URI uri = URI.create( "neo4j://localhost/" );
119+
RoutingContext context = new RoutingContext( uri );
120+
121+
assertEquals( singletonMap( "address", "localhost:7687" ), context.asMap() );
122+
}
123+
124+
@Test
125+
void throwsExceptionIfAddressIsUsedInContext()
126+
{
127+
URI uri = URI.create( "neo4j://localhost:7687/?key1=value1&address=someaddress:9010" );
128+
129+
IllegalArgumentException e = assertThrows( IllegalArgumentException.class, () -> new RoutingContext( uri ) );
130+
assertEquals( "The key 'address' is reserved for routing context.", e.getMessage() );
108131
}
109132

110133
private static void testIllegalUri( URI uri )
@@ -116,7 +139,10 @@ private static void testEmptyRoutingContext( URI uri )
116139
{
117140
RoutingContext context = new RoutingContext( uri );
118141

142+
Map<String,String> expectedMap = new HashMap<>();
143+
expectedMap.put( "address", "localhost:7687" );
144+
119145
assertFalse( context.isDefined() );
120-
assertTrue( context.asMap().isEmpty() );
146+
assertEquals( singletonMap( "address", "localhost:7687" ), context.asMap() );
121147
}
122148
}

driver/src/test/resources/acquire_endpoints_v3.script

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
!: AUTO HELLO
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"]}
9-
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"}]]
9+
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:9004","127.0.0.1:9002","127.0.0.1:9003"], "role": "ROUTE"}]]
1010
SUCCESS {}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
!: BOLT 3
2+
!: AUTO RESET
3+
!: AUTO HELLO
4+
!: AUTO GOODBYE
5+
6+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9010"}} {}
7+
PULL_ALL
8+
S: SUCCESS {"fields": ["ttl", "servers"]}
9+
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"}]]
10+
SUCCESS {}

driver/src/test/resources/acquire_endpoints_v3_empty.script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
!: AUTO HELLO
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": "my.virtual.host:8080"}} {}
77
PULL_ALL
88
S: SUCCESS {"fields": ["ttl", "servers"]}
99
RECORD [9223372036854775807, []]

driver/src/test/resources/acquire_endpoints_v3_leader_killed.script

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
!: AUTO HELLO
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:9004"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9005","127.0.0.1:9006"], "role": "READ"},{"addresses": ["127.0.0.1:9001"], "role": "ROUTE"}]]
1010
SUCCESS {}
11-
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
11+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
1212
PULL_ALL
1313
S: SUCCESS {"fields": ["ttl", "servers"]}
1414
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9004"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9005","127.0.0.1:9006"], "role": "READ"},{"addresses": ["127.0.0.1:9001"], "role": "ROUTE"}]]
1515
SUCCESS {}
16-
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
16+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
1717
PULL_ALL
1818
S: SUCCESS {"fields": ["ttl", "servers"]}
1919
RECORD [9223372036854775807, [{"addresses": [],"role": "WRITE"}, {"addresses": ["127.0.0.1:9005","127.0.0.1:9006"], "role": "READ"},{"addresses": ["127.0.0.1:9001"], "role": "ROUTE"}]]
2020
SUCCESS {}
21-
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
21+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {"address": "127.0.0.1:9001"}} {}
2222
PULL_ALL
2323
S: SUCCESS {"fields": ["ttl", "servers"]}
2424
RECORD [9223372036854775807, [{"addresses": ["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"], "role": "ROUTE"}]]

driver/src/test/resources/acquire_endpoints_v3_point_to_empty_router_and_exit.script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
!: AUTO HELLO
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": "my.virtual.host:8080"}} {}
77
PULL_ALL
88
S: SUCCESS {"fields": ["ttl", "servers"]}
99
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"}]]

driver/src/test/resources/acquire_endpoints_v3_three_servers_and_exit.script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
!: AUTO HELLO
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": "my.virtual.host:8080"}} {}
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","127.0.0.1:9003"], "role": "ROUTE"}]]

driver/src/test/resources/acquire_endpoints_v4.script

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

6-
C: RUN "CALL dbms.routing.getRoutingTable($context, $database)" {"context": {}, "database": "mydatabase"} {"mode": "r", "db": "system"}
6+
C: RUN "CALL dbms.routing.getRoutingTable($context, $database)" {"context": { "address": "127.0.0.1:9001"}, "database": "mydatabase"} {"mode": "r", "db": "system"}
77
PULL {"n": -1}
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"}]]

driver/src/test/resources/acquire_endpoints_v4_database_not_found.script

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

6-
C: RUN "CALL dbms.routing.getRoutingTable($context, $database)" {"context": {}, "database": "mydatabase"} {"mode": "r", "db": "system"}
6+
C: RUN "CALL dbms.routing.getRoutingTable($context, $database)" {"context": {"address": "127.0.0.1:9001" }, "database": "mydatabase"} {"mode": "r", "db": "system"}
77
PULL {"n": -1}
88
S: FAILURE {"code": "Neo.ClientError.Database.DatabaseNotFound", "message": "wut!"}
99
IGNORED

driver/src/test/resources/acquire_endpoints_v4_empty.script

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

6-
C: RUN "CALL dbms.routing.getRoutingTable($context, $database)" {"context": {}, "database": "mydatabase"} {"mode": "r", "db": "system"}
6+
C: RUN "CALL dbms.routing.getRoutingTable($context, $database)" {"context": { "address": "my.virtual.host:8080" }, "database": "mydatabase"} {"mode": "r", "db": "system"}
77
PULL {"n": -1}
88
S: SUCCESS {"fields": ["ttl", "servers"]}
99
RECORD [9223372036854775807, []]

0 commit comments

Comments
 (0)