Skip to content

GODRIVER-1931 Sync new cursors and SDAM LB tests #655

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 29, 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
75 changes: 75 additions & 0 deletions data/load-balancers/cursors.json
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,81 @@
]
}
]
},
{
"description": "change streams pin to a connection",
"operations": [
{
"name": "createChangeStream",
"object": "collection0",
"arguments": {
"pipeline": []
},
"saveResultAsEntity": "changeStream0"
},
{
"name": "assertNumberConnectionsCheckedOut",
"object": "testRunner",
"arguments": {
"client": "client0",
"connections": 1
}
},
{
"name": "close",
"object": "changeStream0"
},
{
"name": "assertNumberConnectionsCheckedOut",
"object": "testRunner",
"arguments": {
"client": "client0",
"connections": 0
}
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"commandName": "aggregate"
}
},
{
"commandSucceededEvent": {
"commandName": "aggregate"
}
},
{
"commandStartedEvent": {
"commandName": "killCursors"
}
},
{
"commandSucceededEvent": {
"commandName": "killCursors"
}
}
]
},
{
"client": "client0",
"eventType": "cmap",
"events": [
{
"connectionReadyEvent": {}
},
{
"connectionCheckedOutEvent": {}
},
{
"connectionCheckedInEvent": {}
}
]
}
]
}
]
}
39 changes: 39 additions & 0 deletions data/load-balancers/cursors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -462,3 +462,42 @@ tests:
# Events for listIndexes and getMore.
- connectionCheckedOutEvent: {}
- connectionCheckedInEvent: {}

- description: change streams pin to a connection
operations:
- name: createChangeStream
object: *collection0
arguments:
pipeline: []
saveResultAsEntity: &changeStream0 changeStream0
- name: assertNumberConnectionsCheckedOut
object: testRunner
arguments:
client: *client0
connections: 1
- name: close
object: *changeStream0
- name: assertNumberConnectionsCheckedOut
object: testRunner
arguments:
client: *client0
connections: 0
expectEvents:
- client: *client0
events:
- commandStartedEvent:
commandName: aggregate
- commandSucceededEvent:
commandName: aggregate
- commandStartedEvent:
commandName: killCursors
- commandSucceededEvent:
commandName: killCursors
- client: *client0
eventType: cmap
events:
# Events for creating the change stream.
- connectionReadyEvent: {}
- connectionCheckedOutEvent: {}
# Events for closing the change stream.
- connectionCheckedInEvent: {}
133 changes: 132 additions & 1 deletion data/load-balancers/sdam-error-handling.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,17 @@
{
"collectionName": "singleColl",
"databaseName": "singleDB",
"documents": []
"documents": [
{
"_id": 1
},
{
"_id": 2
},
{
"_id": 3
}
]
},
{
"collectionName": "multiColl",
Expand Down Expand Up @@ -372,6 +382,127 @@
]
}
]
},
{
"description": "stale errors are ignored",
"operations": [
{
"name": "failPoint",
"object": "testRunner",
"arguments": {
"client": "failPointClient",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 2
},
"data": {
"failCommands": [
"getMore"
],
"closeConnection": true
}
}
}
},
{
"name": "createFindCursor",
"object": "singleColl",
"arguments": {
"filter": {},
"batchSize": 2
},
"saveResultAsEntity": "cursor0"
},
{
"name": "createFindCursor",
"object": "singleColl",
"arguments": {
"filter": {},
"batchSize": 2
},
"saveResultAsEntity": "cursor1"
},
{
"name": "iterateUntilDocumentOrError",
"object": "cursor0"
},
{
"name": "iterateUntilDocumentOrError",
"object": "cursor0"
},
{
"name": "iterateUntilDocumentOrError",
"object": "cursor0",
"expectError": {
"isClientError": true
}
},
{
"name": "close",
"object": "cursor0"
},
{
"name": "iterateUntilDocumentOrError",
"object": "cursor1"
},
{
"name": "iterateUntilDocumentOrError",
"object": "cursor1"
},
{
"name": "iterateUntilDocumentOrError",
"object": "cursor1",
"expectError": {
"isClientError": true
}
},
{
"name": "close",
"object": "cursor1"
}
],
"expectEvents": [
{
"client": "singleClient",
"eventType": "cmap",
"events": [
{
"connectionCreatedEvent": {}
},
{
"connectionReadyEvent": {}
},
{
"connectionCheckedOutEvent": {}
},
{
"connectionCreatedEvent": {}
},
{
"connectionReadyEvent": {}
},
{
"connectionCheckedOutEvent": {}
},
{
"poolClearedEvent": {}
},
{
"connectionCheckedInEvent": {}
},
{
"connectionClosedEvent": {}
},
{
"connectionCheckedInEvent": {}
},
{
"connectionClosedEvent": {}
}
]
}
]
}
]
}
74 changes: 73 additions & 1 deletion data/load-balancers/sdam-error-handling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ createEntities:
initialData:
- collectionName: *singleCollName
databaseName: *singleDBName
documents: []
documents:
- _id: 1
- _id: 2
- _id: 3
- collectionName: *multiCollName
databaseName: *multiDBName
documents:
Expand Down Expand Up @@ -196,3 +199,72 @@ tests:
reason: error
- connectionCheckOutFailedEvent:
reason: connectionError

- description: stale errors are ignored
operations:
- name: failPoint
object: testRunner
arguments:
client: *failPointClient
failPoint:
configureFailPoint: failCommand
mode: { times: 2 }
data:
failCommands: [getMore]
closeConnection: true
# Force two connections to be checked out from the pool.
- name: createFindCursor
object: *singleColl
arguments:
filter: {}
batchSize: 2
saveResultAsEntity: &cursor0 cursor0
- name: createFindCursor
object: *singleColl
arguments:
filter: {}
batchSize: 2
saveResultAsEntity: &cursor1 cursor1
# Iterate cursor0 three times to force a network error.
- name: iterateUntilDocumentOrError
object: *cursor0
- name: iterateUntilDocumentOrError
object: *cursor0
- name: iterateUntilDocumentOrError
object: *cursor0
expectError:
isClientError: true
- name: close
object: *cursor0
# Iterate cursor1 three times to force a network error.
- name: iterateUntilDocumentOrError
object: *cursor1
- name: iterateUntilDocumentOrError
object: *cursor1
- name: iterateUntilDocumentOrError
object: *cursor1
expectError:
isClientError: true
- name: close
object: *cursor1
expectEvents:
- client: *singleClient
eventType: cmap
events:
# Events for creating both cursors.
- connectionCreatedEvent: {}
- connectionReadyEvent: {}
- connectionCheckedOutEvent: {}
- connectionCreatedEvent: {}
- connectionReadyEvent: {}
- connectionCheckedOutEvent: {}
# Events for iterating and closing the first cursor. The failed
# getMore should cause a poolClearedEvent to be published.
- poolClearedEvent: {}
- connectionCheckedInEvent: {}
- connectionClosedEvent: {}
# Events for iterating and closing the second cursor. The failed
# getMore should not clear the pool because the connection's
# generation number is stale.
- connectionCheckedInEvent: {}
- connectionClosedEvent: {}