-
Notifications
You must be signed in to change notification settings - Fork 897
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GODRIVER-2339 Use interface for RTTMonitor and add Stats method for e…
…rrors. (#1009) Extends the IsTimeout() helper to recognize the MaxTimeMSExpired error. Modifies the Server interface to contain a new RTTMonitor interface. Adds Stats() method to rttMonitor. Returns RTT monitor stats with ErrDeadlineWouldBeExceeded errors.
- Loading branch information
1 parent
a006621
commit 0e8481a
Showing
15 changed files
with
430 additions
and
97 deletions.
There are no files selected for viewing
181 changes: 181 additions & 0 deletions
181
data/client-side-operations-timeout/error-transformations.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
{ | ||
"description": "MaxTimeMSExpired server errors are transformed into a custom timeout error", | ||
"schemaVersion": "1.9", | ||
"runOnRequirements": [ | ||
{ | ||
"minServerVersion": "4.0", | ||
"topologies": [ | ||
"replicaset" | ||
] | ||
}, | ||
{ | ||
"minServerVersion": "4.2", | ||
"topologies": [ | ||
"replicaset", | ||
"sharded" | ||
] | ||
} | ||
], | ||
"createEntities": [ | ||
{ | ||
"client": { | ||
"id": "failPointClient", | ||
"useMultipleMongoses": false | ||
} | ||
}, | ||
{ | ||
"client": { | ||
"id": "client", | ||
"uriOptions": { | ||
"timeoutMS": 50 | ||
}, | ||
"useMultipleMongoses": false, | ||
"observeEvents": [ | ||
"commandStartedEvent" | ||
] | ||
} | ||
}, | ||
{ | ||
"database": { | ||
"id": "database", | ||
"client": "client", | ||
"databaseName": "test" | ||
} | ||
}, | ||
{ | ||
"collection": { | ||
"id": "collection", | ||
"database": "database", | ||
"collectionName": "coll" | ||
} | ||
} | ||
], | ||
"initialData": [ | ||
{ | ||
"collectionName": "coll", | ||
"databaseName": "test", | ||
"documents": [] | ||
} | ||
], | ||
"tests": [ | ||
{ | ||
"description": "basic MaxTimeMSExpired error is transformed", | ||
"operations": [ | ||
{ | ||
"name": "failPoint", | ||
"object": "testRunner", | ||
"arguments": { | ||
"client": "failPointClient", | ||
"failPoint": { | ||
"configureFailPoint": "failCommand", | ||
"mode": { | ||
"times": 1 | ||
}, | ||
"data": { | ||
"failCommands": [ | ||
"insert" | ||
], | ||
"errorCode": 50 | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "insertOne", | ||
"object": "collection", | ||
"arguments": { | ||
"document": { | ||
"_id": 1 | ||
} | ||
}, | ||
"expectError": { | ||
"isTimeoutError": true | ||
} | ||
} | ||
], | ||
"expectEvents": [ | ||
{ | ||
"client": "client", | ||
"events": [ | ||
{ | ||
"commandStartedEvent": { | ||
"commandName": "insert", | ||
"databaseName": "test", | ||
"command": { | ||
"insert": "coll", | ||
"maxTimeMS": { | ||
"$$type": [ | ||
"int", | ||
"long" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "write concern error MaxTimeMSExpired is transformed", | ||
"operations": [ | ||
{ | ||
"name": "failPoint", | ||
"object": "testRunner", | ||
"arguments": { | ||
"client": "failPointClient", | ||
"failPoint": { | ||
"configureFailPoint": "failCommand", | ||
"mode": { | ||
"times": 1 | ||
}, | ||
"data": { | ||
"failCommands": [ | ||
"insert" | ||
], | ||
"writeConcernError": { | ||
"code": 50, | ||
"errmsg": "maxTimeMS expired" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "insertOne", | ||
"object": "collection", | ||
"arguments": { | ||
"document": { | ||
"_id": 1 | ||
} | ||
}, | ||
"expectError": { | ||
"isTimeoutError": true | ||
} | ||
} | ||
], | ||
"expectEvents": [ | ||
{ | ||
"client": "client", | ||
"events": [ | ||
{ | ||
"commandStartedEvent": { | ||
"commandName": "insert", | ||
"databaseName": "test", | ||
"command": { | ||
"insert": "coll", | ||
"maxTimeMS": { | ||
"$$type": [ | ||
"int", | ||
"long" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
96 changes: 96 additions & 0 deletions
96
data/client-side-operations-timeout/error-transformations.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
description: "MaxTimeMSExpired server errors are transformed into a custom timeout error" | ||
|
||
schemaVersion: "1.9" | ||
|
||
# failCommand is available on 4.0 for replica sets and 4.2 for sharded clusters. | ||
runOnRequirements: | ||
- minServerVersion: "4.0" | ||
topologies: ["replicaset"] | ||
- minServerVersion: "4.2" | ||
topologies: ["replicaset", "sharded"] | ||
|
||
createEntities: | ||
- client: | ||
id: &failPointClient failPointClient | ||
useMultipleMongoses: false | ||
- client: | ||
id: &client client | ||
uriOptions: | ||
timeoutMS: 50 | ||
useMultipleMongoses: false | ||
observeEvents: | ||
- commandStartedEvent | ||
- database: | ||
id: &database database | ||
client: *client | ||
databaseName: &databaseName test | ||
- collection: | ||
id: &collection collection | ||
database: *database | ||
collectionName: &collectionName coll | ||
|
||
initialData: | ||
- collectionName: *collectionName | ||
databaseName: *databaseName | ||
documents: [] | ||
|
||
tests: | ||
# A server response like {ok: 0, code: 50, ...} is transformed. | ||
- description: "basic MaxTimeMSExpired error is transformed" | ||
operations: | ||
- name: failPoint | ||
object: testRunner | ||
arguments: | ||
client: *failPointClient | ||
failPoint: | ||
configureFailPoint: failCommand | ||
mode: { times: 1 } | ||
data: | ||
failCommands: ["insert"] | ||
errorCode: 50 | ||
- name: insertOne | ||
object: *collection | ||
arguments: | ||
document: { _id: 1 } | ||
expectError: | ||
isTimeoutError: true | ||
expectEvents: | ||
- client: *client | ||
events: | ||
- commandStartedEvent: | ||
commandName: insert | ||
databaseName: *databaseName | ||
command: | ||
insert: *collectionName | ||
maxTimeMS: { $$type: ["int", "long"] } | ||
|
||
# A server response like {ok: 1, writeConcernError: {code: 50, ...}} is transformed. | ||
- description: "write concern error MaxTimeMSExpired is transformed" | ||
operations: | ||
- name: failPoint | ||
object: testRunner | ||
arguments: | ||
client: *failPointClient | ||
failPoint: | ||
configureFailPoint: failCommand | ||
mode: { times: 1 } | ||
data: | ||
failCommands: ["insert"] | ||
writeConcernError: | ||
code: 50 | ||
errmsg: "maxTimeMS expired" | ||
- name: insertOne | ||
object: *collection | ||
arguments: | ||
document: { _id: 1 } | ||
expectError: | ||
isTimeoutError: true | ||
expectEvents: | ||
- client: *client | ||
events: | ||
- commandStartedEvent: | ||
commandName: insert | ||
databaseName: *databaseName | ||
command: | ||
insert: *collectionName | ||
maxTimeMS: { $$type: ["int", "long"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.