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

DRIVERS-2695 Add a case of CSOT not enabled for the retryable writes. #1466

Merged
merged 2 commits into from
Oct 19, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions source/retryable-writes/retryable-writes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ The above rules are implemented in the following pseudo-code:
retryableCommand = addTransactionIdToCommand(command, session);
Exception previousError = null;
retrying = false;
while true {
try {
return executeCommand(server, retryableCommand);
Expand Down Expand Up @@ -519,23 +520,15 @@ The above rules are implemented in the following pseudo-code:
if (timeoutMS == null) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have not merged the conditions to keep the reference code straightforward with the comments.

/* If CSOT is not enabled, allow any retryable error from the second
* attempt to propagate to our caller, as it will be just as relevant
* (if not more relevant) than the original error. For exceptions that
* originate from the driver, we should raise the previous error. Other
* exceptions originating from the server should be allowed to
* propagate. */
try {
return executeCommand(server, retryableCommand);
} catch (DriverException ignoredError) {
* (if not more relevant) than the original error. */
if (retrying) {
throw previousError;
} catch (Exception secondError) {
handleError(secondError);
throw secondError;
}
break
} else if (isExpired(timeoutMS)) {
/* CSOT is enabled and the operation has timed out. */
throw previousError;
}
retrying = true;
}
}
Expand Down
Loading