Skip to content

Commit 8c237fd

Browse files
bigmontzrobsdedude
andauthored
Make more error codes fail fast during the rediscovery (#536)
(Most) drivers will try really hard to fetch a valid RT. This entails going to the next know router if the previous one failed. In this process many errors that are considered unrecoverable in the transaction context are considered retryable. However, a hand full of errors should not be retried to improve user experience. Namely those that are caused by malformed user-input. Instead of asking all routers if they can make sense of it and ultimately failing with a generic routing update error, it's better to fail fast and give the raw error of the server to the user. Currently, these errors are - `Neo.ClientError.Database.DatabaseNotFound` - `Neo.ClientError.Transaction.InvalidBookmark` - `Neo.ClientError.Transaction.InvalidBookmarkMixture` Added three more: - `Neo.ClientError.Statement.ArgumentError`, which happens on failed attempts of impersonation (user or permissions missing) - `Neo.ClientError.Request.Invalid`, which happens when trying things like impersonating an integer - `Neo.ClientError.Statement.TypeError`, which happens when try to use a number as database name in protocol versions which don't support the `ROUTE` message. Co-authored-by: Rouven Bauer <[email protected]>
1 parent b6ad083 commit 8c237fd

16 files changed

+189
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
!: BOLT #VERSION#
2+
3+
C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007"#EXTR_HELLO_ROUTING_PROPS#}
4+
S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"}
5+
*: RESET
6+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": #ROUTINGCTX#} {"[mode]": "r"}
7+
S: FAILURE {"code": "Neo.ClientError.Statement.ArgumentError", "message": "Kaboooom."}
8+
{?
9+
C: PULL_ALL
10+
S: IGNORED
11+
?}
12+
*: RESET
13+
?: GOODBYE
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
!: BOLT #VERSION#
2+
3+
C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007"#EXTR_HELLO_ROUTING_PROPS#}
4+
S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"}
5+
*: RESET
6+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": #ROUTINGCTX#} {"[mode]": "r"}
7+
S: FAILURE {"code": "Neo.ClientError.Request.Invalid", "message": "Kaboooom."}
8+
{?
9+
C: PULL_ALL
10+
S: IGNORED
11+
?}
12+
*: RESET
13+
?: GOODBYE
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
!: BOLT #VERSION#
2+
3+
C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007"#EXTR_HELLO_ROUTING_PROPS#}
4+
S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"}
5+
*: RESET
6+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": #ROUTINGCTX#} {"[mode]": "r"}
7+
S: FAILURE {"code": "Neo.ClientError.Statement.TypeError", "message": "Kaboooom."}
8+
{?
9+
C: PULL_ALL
10+
S: IGNORED
11+
?}
12+
*: RESET
13+
?: GOODBYE
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
!: BOLT #VERSION#
2+
3+
C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007", "routing": #ROUTINGCTX#}
4+
S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"}
5+
*: RESET
6+
C: RUN "CALL dbms.routing.getRoutingTable($context, $database)" {"context": #ROUTINGCTX#, "[database]": "*"} {"[mode]": "r", "db": "system", "bookmarks": ["foobar"]}
7+
S: FAILURE {"code": "Neo.ClientError.Statement.ArgumentError", "message": "Kaboooom."}
8+
{?
9+
C: PULL {"n": {"Z": "*"}}
10+
S: IGNORED
11+
?}
12+
*: RESET
13+
?: GOODBYE
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
!: BOLT #VERSION#
2+
3+
C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007", "routing": #ROUTINGCTX#}
4+
S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"}
5+
*: RESET
6+
C: RUN "CALL dbms.routing.getRoutingTable($context, $database)" {"context": #ROUTINGCTX#, "[database]": "*"} {"[mode]": "r", "db": "system", "bookmarks": ["foobar"]}
7+
S: FAILURE {"code": "Neo.ClientError.Request.Invalid", "message": "Kaboooom."}
8+
{?
9+
C: PULL {"n": {"Z": "*"}}
10+
S: IGNORED
11+
?}
12+
*: RESET
13+
?: GOODBYE
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
!: BOLT #VERSION#
2+
3+
C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007", "routing": #ROUTINGCTX#}
4+
S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"}
5+
*: RESET
6+
C: RUN "CALL dbms.routing.getRoutingTable($context, $database)" {"context": #ROUTINGCTX#, "[database]": "*"} {"[mode]": "r", "db": "system", "bookmarks": ["foobar"]}
7+
S: FAILURE {"code": "Neo.ClientError.Statement.TypeError", "message": "Kaboooom."}
8+
{?
9+
C: PULL {"n": {"Z": "*"}}
10+
S: IGNORED
11+
?}
12+
*: RESET
13+
?: GOODBYE
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
!: BOLT #VERSION#
2+
3+
C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007", "routing": #ROUTINGCTX# , "[patch_bolt]": "*"}
4+
S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"}
5+
*: RESET
6+
C: ROUTE #ROUTINGCTX# ["foobar"] "*"
7+
S: FAILURE {"code": "Neo.ClientError.Statement.ArgumentError", "message": "Kaboooom!"}
8+
*: RESET
9+
?: GOODBYE
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
!: BOLT #VERSION#
2+
3+
C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007", "routing": #ROUTINGCTX# , "[patch_bolt]": "*"}
4+
S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"}
5+
*: RESET
6+
C: ROUTE #ROUTINGCTX# ["foobar"] "*"
7+
S: FAILURE {"code": "Neo.ClientError.Request.Invalid", "message": "Kaboooom!"}
8+
*: RESET
9+
?: GOODBYE
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
!: BOLT #VERSION#
2+
3+
C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007", "routing": #ROUTINGCTX# , "[patch_bolt]": "*"}
4+
S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"}
5+
*: RESET
6+
C: ROUTE #ROUTINGCTX# ["foobar"] "*"
7+
S: FAILURE {"code": "Neo.ClientError.Statement.TypeError", "message": "Kaboooom!"}
8+
*: RESET
9+
?: GOODBYE
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
!: BOLT #VERSION#
2+
3+
C: HELLO {"scheme": "basic", "credentials": "c", "principal": "p", "user_agent": "007", "routing": #ROUTINGCTX#, "[patch_bolt]": "*"}
4+
S: SUCCESS {"server": "#SERVER_AGENT#", "connection_id": "bolt-123456789"}
5+
*: RESET
6+
C: ROUTE #ROUTINGCTX# ["foobar"] {"[db]": "*"}
7+
S: FAILURE {"code": "Neo.ClientError.Statement.ArgumentError", "message": "Kaboooom."}
8+
*: RESET
9+
?: GOODBYE

0 commit comments

Comments
 (0)