-
Notifications
You must be signed in to change notification settings - Fork 892
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
GODRIVER-2335 Preemptively cancel in progress operations when SDAM heartbeats timeout. #1423
Merged
Merged
Changes from 8 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
eb7f25e
WIP
qingyang-hu 4cfdf49
WIP
qingyang-hu ef6679f
WIP
qingyang-hu 78e4d2c
WIP
qingyang-hu b4352fc
Fix race condition
qingyang-hu d938fed
updates
qingyang-hu 9dfddd9
Simplify logic to check in all non-idle connections for interuption.
qingyang-hu 97d4d33
Merge branch 'master' into godriver2335
qingyang-hu 10bd0ef
Simplify logic.
qingyang-hu 61e0bc0
Merge branch 'master' into godriver2335
qingyang-hu 31b50f1
minor changes
qingyang-hu c3233d8
minor changes
qingyang-hu f998418
Merge branch 'master' into godriver2335
qingyang-hu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
77 changes: 77 additions & 0 deletions
77
testdata/connection-monitoring-and-pooling/pool-clear-interrupt-immediately.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,77 @@ | ||
{ | ||
"version": 1, | ||
"style": "unit", | ||
"description": "Connections MUST be interrupted as soon as possible (interruptInUseConnections=true)", | ||
"poolOptions": { | ||
"backgroundThreadIntervalMS": 10000 | ||
}, | ||
"operations": [ | ||
{ | ||
"name": "ready" | ||
}, | ||
{ | ||
"name": "checkOut" | ||
}, | ||
{ | ||
"name": "checkOut", | ||
"label": "conn" | ||
}, | ||
{ | ||
"name": "clear", | ||
"interruptInUseConnections": true | ||
}, | ||
{ | ||
"name": "waitForEvent", | ||
"event": "ConnectionPoolCleared", | ||
"count": 1, | ||
"timeout": 1000 | ||
}, | ||
{ | ||
"name": "waitForEvent", | ||
"event": "ConnectionClosed", | ||
"count": 2, | ||
"timeout": 1000 | ||
}, | ||
{ | ||
"name": "close" | ||
} | ||
], | ||
"events": [ | ||
{ | ||
"type": "ConnectionCheckedOut", | ||
"connectionId": 1, | ||
"address": 42 | ||
}, | ||
{ | ||
"type": "ConnectionCheckedOut", | ||
"connectionId": 2, | ||
"address": 42 | ||
}, | ||
{ | ||
"type": "ConnectionPoolCleared", | ||
"interruptInUseConnections": true | ||
}, | ||
{ | ||
"type": "ConnectionClosed", | ||
"reason": "stale", | ||
"address": 42 | ||
}, | ||
{ | ||
"type": "ConnectionClosed", | ||
"reason": "stale", | ||
"address": 42 | ||
}, | ||
{ | ||
"type": "ConnectionPoolClosed", | ||
"address": 42 | ||
} | ||
], | ||
"ignore": [ | ||
"ConnectionCreated", | ||
"ConnectionPoolReady", | ||
"ConnectionReady", | ||
"ConnectionCheckOutStarted", | ||
"ConnectionPoolCreated", | ||
"ConnectionCheckedIn" | ||
] | ||
} |
46 changes: 46 additions & 0 deletions
46
testdata/connection-monitoring-and-pooling/pool-clear-interrupt-immediately.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,46 @@ | ||
version: 1 | ||
style: unit | ||
description: Connections MUST be interrupted as soon as possible (interruptInUseConnections=true) | ||
poolOptions: | ||
# ensure it's not involved by default | ||
backgroundThreadIntervalMS: 10000 | ||
operations: | ||
- name: ready | ||
- name: checkOut | ||
- name: checkOut | ||
label: conn | ||
- name: clear | ||
interruptInUseConnections: true | ||
- name: waitForEvent | ||
event: ConnectionPoolCleared | ||
count: 1 | ||
timeout: 1000 | ||
- name: waitForEvent | ||
event: ConnectionClosed | ||
count: 2 | ||
timeout: 1000 | ||
- name: close | ||
events: | ||
- type: ConnectionCheckedOut | ||
connectionId: 1 | ||
address: 42 | ||
- type: ConnectionCheckedOut | ||
connectionId: 2 | ||
address: 42 | ||
- type: ConnectionPoolCleared | ||
interruptInUseConnections: true | ||
- type: ConnectionClosed | ||
reason: stale | ||
address: 42 | ||
- type: ConnectionClosed | ||
reason: stale | ||
address: 42 | ||
- type: ConnectionPoolClosed | ||
address: 42 | ||
ignore: | ||
- ConnectionCreated | ||
- ConnectionPoolReady | ||
- ConnectionReady | ||
- ConnectionCheckOutStarted | ||
- ConnectionPoolCreated | ||
- ConnectionCheckedIn |
77 changes: 77 additions & 0 deletions
77
testdata/connection-monitoring-and-pooling/pool-clear-interrupting-pending-connections.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,77 @@ | ||
{ | ||
"version": 1, | ||
"style": "integration", | ||
"description": "clear with interruptInUseConnections = true closes pending connections", | ||
"runOn": [ | ||
{ | ||
"minServerVersion": "4.9.0" | ||
} | ||
], | ||
"failPoint": { | ||
"configureFailPoint": "failCommand", | ||
"mode": "alwaysOn", | ||
"data": { | ||
"failCommands": [ | ||
"isMaster", | ||
"hello" | ||
], | ||
"closeConnection": false, | ||
"blockConnection": true, | ||
"blockTimeMS": 1000 | ||
} | ||
}, | ||
"poolOptions": { | ||
"minPoolSize": 0 | ||
}, | ||
"operations": [ | ||
{ | ||
"name": "ready" | ||
}, | ||
{ | ||
"name": "start", | ||
"target": "thread1" | ||
}, | ||
{ | ||
"name": "checkOut", | ||
"thread": "thread1" | ||
}, | ||
{ | ||
"name": "waitForEvent", | ||
"event": "ConnectionCreated", | ||
"count": 1 | ||
}, | ||
{ | ||
"name": "clear", | ||
"interruptInUseConnections": true | ||
}, | ||
{ | ||
"name": "waitForEvent", | ||
"event": "ConnectionCheckOutFailed", | ||
"count": 1 | ||
} | ||
], | ||
"events": [ | ||
{ | ||
"type": "ConnectionCheckOutStarted" | ||
}, | ||
{ | ||
"type": "ConnectionCreated" | ||
}, | ||
{ | ||
"type": "ConnectionPoolCleared", | ||
"interruptInUseConnections": true | ||
}, | ||
{ | ||
"type": "ConnectionClosed" | ||
}, | ||
{ | ||
"type": "ConnectionCheckOutFailed" | ||
} | ||
], | ||
"ignore": [ | ||
"ConnectionCheckedIn", | ||
"ConnectionCheckedOut", | ||
"ConnectionPoolCreated", | ||
"ConnectionPoolReady" | ||
] | ||
} |
42 changes: 42 additions & 0 deletions
42
testdata/connection-monitoring-and-pooling/pool-clear-interrupting-pending-connections.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,42 @@ | ||
version: 1 | ||
style: integration | ||
description: clear with interruptInUseConnections = true closes pending connections | ||
runOn: | ||
- | ||
minServerVersion: "4.9.0" | ||
failPoint: | ||
configureFailPoint: failCommand | ||
mode: "alwaysOn" | ||
data: | ||
failCommands: ["isMaster","hello"] | ||
closeConnection: false | ||
blockConnection: true | ||
blockTimeMS: 1000 | ||
poolOptions: | ||
minPoolSize: 0 | ||
operations: | ||
- name: ready | ||
- name: start | ||
target: thread1 | ||
- name: checkOut | ||
thread: thread1 | ||
- name: waitForEvent | ||
event: ConnectionCreated | ||
count: 1 | ||
- name: clear | ||
interruptInUseConnections: true | ||
- name: waitForEvent | ||
event: ConnectionCheckOutFailed | ||
count: 1 | ||
events: | ||
- type: ConnectionCheckOutStarted | ||
- type: ConnectionCreated | ||
- type: ConnectionPoolCleared | ||
interruptInUseConnections: true | ||
- type: ConnectionClosed | ||
- type: ConnectionCheckOutFailed | ||
ignore: | ||
- ConnectionCheckedIn | ||
- ConnectionCheckedOut | ||
- ConnectionPoolCreated | ||
- ConnectionPoolReady |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This style of running operations on a "thread" doesn't guarantee that operations will be run in the specified order. The runOnThread operation in the unified test format spec fails to mention that property, but my understanding is that unified spec test runners must preserve the order of ops run in a "thread".
The legacy "runOnThread" implementation here uses a job queue per "thread". Consider using a similar approach and/or copying the code from the legacy spec test runner.