-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
PYTHON-4227 Unified tests: Advance cluster_time of ClientSessions after initialData creation #1603
PYTHON-4227 Unified tests: Advance cluster_time of ClientSessions after initialData creation #1603
Conversation
I'm investigating the new failure that popped up. I can reproduce locally.
|
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.
LGTM!
test/unified_format.py
Outdated
if cluster_time: | ||
for entity in self.entity_map._entities.values(): | ||
if isinstance(entity, ClientSession): | ||
entity.advance_cluster_time(cluster_time) |
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.
We need to do this for sessions created later on in _testOperation_createEntities
too.
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.
Where is _testOperation_createEntities
called from? Would we want to ping again before updating?
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.
We should only run ping once, store the cluster_time, then use it later when _testOperation_createEntities is called.
test/unified_format.py
Outdated
# to ensure consistency in transactions against a sharded deployment, | ||
cluster_time = self.client.admin.command("ping").get("$clusterTime") | ||
if cluster_time: | ||
for entity in self.entity_map._entities.values(): |
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.
Suggest adding a EntityMapUtil.values() method that we can call here so we don't need to look at the internals.
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.
LGTM once the typing issue is fixed.
@ShaneHarvey, @blink1073 |
Yeah, apparently https://jira.mongodb.org/browse/PYTHON-4182 was unrelated, I unblocked it and put it in scheduled. |
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.
LGTM!
test/unified_format.py
Outdated
"""Manually synchronize entities when desired""" | ||
if not self._cluster_time: | ||
self._cluster_time = self.test.client.admin.command("ping").get("$clusterTime") | ||
for entity in self._entities: |
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.
for entity in self._entities: | |
for entity in self._entities.values(): |
The current version iterates over the names instead of the values and never passes the isinstance
check.
test/unified_format.py
Outdated
if "unpin after non-transient error on abort" in spec["description"]: | ||
if client_context.version[0] == 8: | ||
self.skipTest("Skipping TransientTransactionError pending PYTHON-4182") | ||
if "unpin after TransientTransactionError error on" in spec["description"]: |
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.
Is this intended? The failure is the same for PYTHON-4182, so I would expect this PR to fix that ticket as well.
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.
I can try it out. The failure was popping back up earlier but now that everything is cleaner, and I've synced everything up to master, it is worth trying again.
…ending PYTHON-4182
2afe41b
to
8bc865b
Compare
Merging so we can check the waterfall afterward. |
Changes
After initialData is added in test.unified_format's run_scenario, we get the $clusterTime from the server, and add this to each of the ClientSession entities before further operations.
Motivation for the change.
DRIVERS-2816
Here is the pertinent section of the specifications