[JAVA-5186] Change server pinning implementation to not rely on Cluster#getDescription Created: 01/Oct/23  Updated: 28/Oct/23  Resolved: 04/Oct/23

Status: Closed
Project: Java Driver
Component/s: Internal
Affects Version/s: None
Fix Version/s: 4.11.0

Type: Improvement Priority: Unknown
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Documentation Changes: Not Needed
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

The current implementation of server address pinning for transactions on sharded and load-balanced clusters relies on the Cluster#getDescription method. This means that blocking has to be done twice instead of just once via Cluster#selectServer. It would be easy to refactor so that the cluster type (which is all that is needed) is derived instead from the ConnectionSource after it's selected.

This would simplify the code, allow the removal of Cluster#getDescription, and make server selection timeout logging and exception message more consistent.



 Comments   
Comment by Githook User [ 04/Oct/23 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Refactor transaction server pinning (#1211)

  • Determine whether TransactionContext is required based on ConnectionSource's ServerDescription
    instead of the ClusterDescription
  • Remove Cluster#getDescription and update tests that relied on it

JAVA-5186
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/92c90c6b77065a551fc7d7cd7f0a3f820f7ca8bf

Generated at Thu Feb 08 09:03:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.