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

feat(NODE-6231): Add CSOT behaviour for retryable reads and writes #4186

Merged
merged 13 commits into from
Aug 1, 2024

Conversation

W-A-James
Copy link
Contributor

@W-A-James W-A-James commented Jul 29, 2024

Description

What is changing?

  • Add logic to implement time-bounded infinite retry for retryable read and write commands
  • Update Timeout to have cleared flag
  • Update CSOTTimeoutContext to correctly set serverSelectionTimeoutMS when retrying commands
  • Unskip retryability spec tests
Is there new documentation needed for these changes?

No - punting to CSOT release

What is the motivation for this change?

NODE-6231

Double check the following

  • Ran npm run check:lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

Comment on lines +288 to +289
timeoutContext.serverSelectionTimeout?.clear();
timeoutContext.connectionCheckoutTimeout?.clear();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

clear timeouts to ensure correct setting of the serverSelectionTimeoutMS value

@@ -39,6 +39,7 @@ export class Timeout extends Promise<never> {
public ended: number | null = null;
public duration: number;
public timedOut = false;
public cleared = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add cleared flag that gets set on Timeout.clear so that the TimeoutContext can know if it needs to reconstruct a Timeout for retrying operations

Comment on lines +24 to +25
'timeoutMS applies to whole operation, not individual attempts - bulkWrite on collection',
'timeoutMS applies to whole operation, not individual attempts - insertMany on collection'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Skipped for now. We seem to be throwing the TimeoutError at the correct place, but it's getting wrapped by the BulkWriteError

@W-A-James W-A-James marked this pull request as ready for review July 30, 2024 21:47
src/timeout.ts Outdated Show resolved Hide resolved
@durran durran self-assigned this Jul 31, 2024
@durran durran added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Jul 31, 2024
@W-A-James W-A-James requested a review from durran July 31, 2024 18:57
@durran durran added Team Review Needs review from team and removed Primary Review In Review with primary reviewer, not yet ready for team's eyes labels Jul 31, 2024
@durran durran merged commit 938b594 into NODE-6090 Aug 1, 2024
26 checks passed
@durran durran deleted the NODE-6231 branch August 1, 2024 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team Review Needs review from team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants