-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-2390 - Retryable reads use the same implicit session #2544
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
Changes from 1 commit
979208b
382a94c
d423bc3
e79290e
daf5f84
d65fe45
8026e7a
af572bd
55aaee3
9a27445
cee6c5a
6f5bda7
9479af6
d95ce5d
f5495ca
bfc9a70
1a88e8e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -216,6 +216,38 @@ def test_retryable_reads_are_retried_on_the_same_mongos_when_no_others_are_avail | |
# Assert that both events occurred on the same mongos. | ||
assert listener.succeeded_events[0].connection_id == listener.failed_events[0].connection_id | ||
|
||
@client_context.require_failCommand_fail_point | ||
def test_retryable_reads_are_retried_on_the_same_implicit_session(self): | ||
fail_command = { | ||
"configureFailPoint": "failCommand", | ||
"mode": {"times": 1}, | ||
"data": {"failCommands": ["count"], "errorCode": 6}, | ||
} | ||
|
||
listener = OvertCommandListener() | ||
client = self.rs_or_single_client( | ||
directConnection=False, | ||
event_listeners=[listener], | ||
retryReads=True, | ||
) | ||
|
||
set_fail_point(client, fail_command) | ||
|
||
client.t.t.estimated_document_count() | ||
|
||
|
||
# Disable failpoint. | ||
fail_command["mode"] = "off" | ||
set_fail_point(client, fail_command) | ||
|
||
# Assert that both events occurred on the same session. | ||
lsids = [ | ||
event.command["lsid"] | ||
for event in listener.started_events | ||
if event.command_name == "count" | ||
] | ||
self.assertEqual(len(lsids), 2) | ||
self.assertEqual(lsids[0], lsids[1]) | ||
|
||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
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.
Let's use self.fail_point() here.