summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCheahuychou Mao <mao.cheahuychou@gmail.com>2022-05-02 16:28:27 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-05-02 17:46:29 +0000
commitb33af4ceafa190f021630d9136e0024e6048bc3f (patch)
treeffec6164fbdc46d4cac1c3af74f6fb2dfbbd3062
parentb8e2306d66f5e9c644b3966f1a7e7d42b9d3731d (diff)
downloadmongo-b33af4ceafa190f021630d9136e0024e6048bc3f.tar.gz
SERVER-66104 Not label InternalTransactionNotSupported as a transient transaction error
(cherry picked from commit 3bef8610d3274be1e758b146008abdc103e7792c)
-rw-r--r--src/mongo/db/error_labels.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/db/error_labels.cpp b/src/mongo/db/error_labels.cpp
index b66d0df2d74..50c904ec07e 100644
--- a/src/mongo/db/error_labels.cpp
+++ b/src/mongo/db/error_labels.cpp
@@ -189,6 +189,18 @@ BSONObj getErrorLabels(OperationContext* opCtx,
bool isTransientTransactionError(ErrorCodes::Error code,
bool hasWriteConcernError,
bool isCommitOrAbort) {
+ if (code == ErrorCodes::InternalTransactionNotSupported) {
+ // InternalTransactionNotSupported is a retryable write error. This allows a retryable
+ // WouldChangeOwningShard update or findAndModify statement that fails to execute using an
+ // internal transaction during downgrade to be retried by the drivers; the retry would use
+ // the legacy way of handling WouldChangeOwningShard errors which does not require an
+ // internal transaction. Don't label InternalTransactionNotSupported as a transient
+ // transaction error since otherwise the transaction API would retry the internal
+ // transaction until it exhausts the maximum number of retries before returning an error to
+ // the drivers.
+ return false;
+ }
+
bool isTransient;
switch (code) {
case ErrorCodes::WriteConflict: