Skip to content

Conversation

isabelatkinson
Copy link
Contributor

@@ -403,30 +407,6 @@ impl Client {
implicit_session,
},
Err(mut err) => {
// If the error is a reauthentication required error, we reauthenticate and
// retry the operation.
if err.is_reauthentication_required() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This needed to be moved outside of this retry loop so that reauthentication can be done, if needed, when we're calling getMore directly with execute_operation_on_connection. The main functional difference is that we're now retrying the operation on the same connection rather than going through server selection/connection checkout again. The auth spec doesn't require either of these paths, and I think it's reasonable to reuse the freshly-reauthenticated connection in this case.

@@ -484,327 +464,275 @@ impl Client {
}

/// Executes an operation on a given connection, optionally using a provided session.
async fn execute_operation_on_connection<T: Operation>(
pub(crate) async fn execute_operation_on_connection<T: Operation>(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

suggest hiding whitespace changes in the diff to reduce noise here

@@ -837,6 +765,98 @@ impl Client {
})
}

async fn reauthenticate_connection(&self, connection: &mut PooledConnection) -> Result<()> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

no functional changes in the contents of these methods, just moved them for readability

@isabelatkinson isabelatkinson marked this pull request as ready for review April 14, 2025 15:00
@isabelatkinson isabelatkinson requested a review from abr-egn April 14, 2025 15:00
self.execute_operation_with_retry(op, session).await
})
.await
// If the current transaction has been committed/aborted and it is not being
Copy link
Contributor

Choose a reason for hiding this comment

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

I like having this here instead of in execute_operation_with_retry - it makes the purpose of that method cleaner - but for my own understanding, was there a functional reason for this change beyond that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope, this and the reshuffling above were to simplify execute_operation_with_retry and execute_operation_on_connection

Copy link
Contributor

@kevinAlbs kevinAlbs left a comment

Choose a reason for hiding this comment

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

LGTM with a possible suggestion and assert removal.

@isabelatkinson isabelatkinson requested a review from a team as a code owner April 17, 2025 19:11
@isabelatkinson isabelatkinson merged commit dbff9ef into mongodb:main Apr 18, 2025
15 of 17 checks passed
@isabelatkinson isabelatkinson deleted the no-cursor branch May 9, 2025 19:11
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.

3 participants