Skip to content

Commit 5c748dd

Browse files
author
iwysiu
committed
GODRIVER-1487 fix adding UnknownTransactionCommitResult (#307)
1 parent 98345d4 commit 5c748dd

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

x/mongo/driver/errors.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ var (
1515
nodeIsRecoveringCodes = []int32{11600, 11602, 13436, 189, 91}
1616
notMasterCodes = []int32{10107, 13435}
1717
nodeIsShuttingDownCodes = []int32{11600, 91}
18+
19+
unknownReplWriteConcernCode = int32(79)
20+
unsatisfiableWriteConcernCode = int32(100)
1821
)
1922

2023
var (

x/mongo/driver/operation.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,10 @@ func (op Operation) Execute(ctx context.Context, scratch []byte) error {
432432
Code: int32(tt.WriteConcernError.Code),
433433
Message: tt.WriteConcernError.Message,
434434
}
435-
if err.Code == 64 || err.Code == 50 || tt.WriteConcernError.Retryable() {
436-
err.Labels = []string{UnknownTransactionCommitResult}
435+
// The UnknownTransactionCommitResult label is added to all writeConcernErrors besides unknownReplWriteConcernCode
436+
// and unsatisfiableWriteConcernCode
437+
if err.Code != unknownReplWriteConcernCode && err.Code != unsatisfiableWriteConcernCode {
438+
err.Labels = append(err.Labels, UnknownTransactionCommitResult)
437439
}
438440
return err
439441
}

0 commit comments

Comments
 (0)