Skip to content
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-4038: Ensure retryable read OperationFailures re-raise exception when 0 or NoneType error code is provided. #1425

Merged
merged 3 commits into from
Nov 15, 2023

Conversation

Jibola
Copy link
Contributor

@Jibola Jibola commented Nov 8, 2023

TICKET: https://jira.mongodb.org/browse/PYTHON-4038

Pymongo is retrying a failed find connection ONCE that has a 0 or NoneType error code.

This is undesired behavior because if, theoretically, we introduce an error type that does not have an error code but is an instance of an OperationFailure, we will mistakenly retry leading to unexpected consequences.

Added 3 tests:

  • Test nonetype case
  • Test 0 case
  • Test 1 case

@Jibola Jibola requested a review from a team as a code owner November 8, 2023 19:53
@Jibola Jibola requested review from NoahStapp and removed request for a team November 8, 2023 19:53
@Jibola Jibola marked this pull request as draft November 8, 2023 19:58
@Jibola
Copy link
Contributor Author

Jibola commented Nov 8, 2023

I need to add a test case into PyMongo to ensure this doesn't recur

@Jibola Jibola marked this pull request as ready for review November 10, 2023 19:40
Copy link
Member

@ShaneHarvey ShaneHarvey left a comment

Choose a reason for hiding this comment

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

Still needs a mockupdb test where the server returns a missing or 0 error code.

Also could you update the PR title and changelog to describe the bug that's being fixed?

@Jibola Jibola changed the title PYTHON-4038: Explicitly check for OperationFailure exception type in retryable reads PYTHON-4038: Ensure non-retry eligible reads raise exception when "nullish" error code is provided. Nov 14, 2023
@Jibola Jibola changed the title PYTHON-4038: Ensure non-retry eligible reads raise exception when "nullish" error code is provided. PYTHON-4038: Ensure retryable reads OperationFailures re-raise exception when 0 or NoneType error code is provided. Nov 14, 2023
@Jibola Jibola changed the title PYTHON-4038: Ensure retryable reads OperationFailures re-raise exception when 0 or NoneType error code is provided. PYTHON-4038: Ensure retryable read OperationFailures re-raise exception when 0 or NoneType error code is provided. Nov 14, 2023
@Jibola Jibola merged commit 0ff6a87 into mongodb:master Nov 15, 2023
17 checks passed
@Jibola Jibola deleted the PYTHON-4038 branch November 15, 2023 20:03
Jibola added a commit to Jibola/mongo-python-driver that referenced this pull request Nov 15, 2023
…tion when 0 or NoneType error code is provided. (mongodb#1425)

(cherry picked from commit 0ff6a87)
Jibola added a commit that referenced this pull request Nov 16, 2023
…e exception when 0 or NoneType error code is provided. (#1425) (#1429)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants