Skip to content

Conversation

@sanych-sun
Copy link
Member

This PR contains additional refactoring to Server Selection code, that is a part of Command Execution requirement. I've decided to have this as a separate PR to let more detailed review/investigation on the changes where and when we build list of connected servers used on Server Selection. The changes will let me easily capture both: selected server and server description that was used while the server selection, as we need that description to fulfill Command Execution requirements.

@sanych-sun sanych-sun requested a review from a team as a code owner June 12, 2025 18:53
@sanych-sun sanych-sun added the feature Adds new user-facing functionality. label Jun 12, 2025
Copy link
Contributor

@BorisDog BorisDog left a comment

Choose a reason for hiding this comment

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

No major comments

var operationCountSelector = new OperationsCountServerSelector(Array.Empty<IClusterableServer>());
allSelectors.Add(operationCountSelector);

return (new CompositeServerSelector(allSelectors), operationCountSelector, Stopwatch.StartNew());
Copy link
Contributor

Choose a reason for hiding this comment

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

We should consider ClusterCompositeServerSelector instead of this list creation. No necessary for this PR.

@sanych-sun sanych-sun requested a review from BorisDog June 13, 2025 23:30
Copy link
Contributor

@BorisDog BorisDog left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@adelinowona adelinowona left a comment

Choose a reason for hiding this comment

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

No major comments from me either. Great work!

EventContext.OperationName));
}

public Exception HandleServerSelectionException(ClusterDescription clusterDescription, IServerSelector selector, Exception exception, Stopwatch stopwatch)
Copy link
Contributor

Choose a reason for hiding this comment

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

looks to me like an internal detail so can this be private?
Also given the name of the method, is it better if this method takes care of throwing the exception instead of returning the exception? what do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to private, thanks! Cannot make the method throw, as it will confuse compiler and it will think we should return something from the method, as there will be no guaranty that HandleServerSelectionException throws.

@sanych-sun sanych-sun requested a review from adelinowona June 14, 2025 00:36
Copy link
Contributor

@adelinowona adelinowona left a comment

Choose a reason for hiding this comment

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

LGTM!

@sanych-sun sanych-sun merged commit 0cbd39b into mongodb:main Jun 16, 2025
31 of 35 checks passed
@sanych-sun sanych-sun deleted the csharp5608 branch June 16, 2025 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Adds new user-facing functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants