Skip to content

RUST-1274 Fix commitTransaction on check out retries #651

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 8 commits into from
May 16, 2022

Conversation

patrickfreed
Copy link
Contributor

RUST-1274

This backports the fix for InvalidOptions errors that are seen when commitTransaction commands are retried due to connection check out failures. The fix for this was included on main in #628.

@patrickfreed patrickfreed marked this pull request as ready for review May 5, 2022 17:12
@patrickfreed patrickfreed requested review from kmahar, isabelatkinson and abr-egn and removed request for kmahar May 5, 2022 17:13
Copy link
Contributor Author

@patrickfreed patrickfreed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-requesting review, since I changed some logic to fix RUST-1317, which was required to implement the test for this.

topology.notify_topology_changed();
}
self.check_server(&topology, &server).await;
topology.notify_topology_changed();
Copy link
Contributor Author

@patrickfreed patrickfreed May 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once I added a commit to fix RUST-1317, some tests started failing due to this if statement. The problem is if the error stayed the same, this check would not call notify_topology_changed, which in turn would mean that the operation blocked on server selection would not try again and would not request another immediate check. This means that the blocked operation wouldn't succeed until the next heartbeat regularly scheduled, which could be 10s of seconds in the future.

Note that this new implementation matches the pseudocode in the server monitoring spec as well as the Python implementation. Also, by passing the test added in DRIVERS-1251, the C#, Go and Java likely have this behavior too. The spec does allow for our prior only-notify-if-changed behavior though, so I filed DRIVERS-2329 to require the behavior seen here.

@patrickfreed patrickfreed merged commit ab491ae into mongodb:2.2.x May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants