Skip to content

chore(NODE-6758): rename WriteConcernError enum key to WriteConcernTimeout #4483

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

Merged
merged 3 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/bulk/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ export class BulkWriteResult {
if (i === 0) errmsg = errmsg + ' and ';
}

return new WriteConcernError({ errmsg, code: MONGODB_ERROR_CODES.WriteConcernFailed });
return new WriteConcernError({ errmsg, code: MONGODB_ERROR_CODES.WriteConcernTimeout });
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export const MONGODB_ERROR_CODES = Object.freeze({
FailedToSatisfyReadPreference: 133,
CursorNotFound: 43,
LegacyNotPrimary: 10058,
WriteConcernFailed: 64,
// WriteConcernTimeout is WriteConcernFailed on pre-8.1 servers
WriteConcernTimeout: 64,
NamespaceNotFound: 26,
IllegalOperation: 20,
MaxTimeMSExpired: 50,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@
]
},
{
"description": "InsertOne fails after WriteConcernError WriteConcernFailed",
"description": "InsertOne fails after WriteConcernError WriteConcernTimeout",
"operations": [
{
"name": "failPoint",
Expand All @@ -757,7 +757,6 @@
],
"writeConcernError": {
"code": 64,
"codeName": "WriteConcernFailed",
"errmsg": "waiting for replication timed out",
"errInfo": {
"wtimeout": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ tests:
- { _id: 2, x: 22 }
- { _id: 3, x: 33 } # The write was still applied.
-
description: 'InsertOne fails after WriteConcernError WriteConcernFailed'
description: 'InsertOne fails after WriteConcernError WriteConcernTimeout'
operations:
-
name: failPoint
Expand All @@ -353,7 +353,6 @@ tests:
failCommands: [ insert ]
writeConcernError:
code: 64
codeName: WriteConcernFailed
errmsg: 'waiting for replication timed out'
errInfo:
wtimeout: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
],
"tests": [
{
"description": "commitTransaction is retried after WriteConcernFailed timeout error",
"description": "commitTransaction is retried after WriteConcernTimeout timeout error",
"operations": [
{
"name": "failPoint",
Expand All @@ -74,7 +74,6 @@
],
"writeConcernError": {
"code": 64,
"codeName": "WriteConcernFailed",
"errmsg": "waiting for replication timed out",
"errInfo": {
"wtimeout": true
Expand Down Expand Up @@ -236,7 +235,7 @@
]
},
{
"description": "commitTransaction is retried after WriteConcernFailed non-timeout error",
"description": "commitTransaction is retried after WriteConcernTimeout non-timeout error",
"operations": [
{
"name": "failPoint",
Expand All @@ -254,7 +253,6 @@
],
"writeConcernError": {
"code": 64,
"codeName": "WriteConcernFailed",
"errmsg": "multiple errors reported"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ initialData:

tests:
-
description: commitTransaction is retried after WriteConcernFailed timeout error
description: commitTransaction is retried after WriteConcernTimeout timeout error
operations:
- name: failPoint
object: testRunner
Expand All @@ -47,7 +47,6 @@ tests:
# with writeConcernError (see: SERVER-39292)
writeConcernError:
code: 64
codeName: WriteConcernFailed
errmsg: "waiting for replication timed out"
errInfo: { wtimeout: true }
- &operation
Expand Down Expand Up @@ -126,10 +125,10 @@ tests:
- { _id: 1 }
-
# This test configures the fail point to return an error with the
# WriteConcernFailed code but without errInfo that would identify it as a
# WriteConcernTimeout code but without errInfo that would identify it as a
# wtimeout error. This tests that drivers do not assume that all
# WriteConcernFailed errors are due to a replication timeout.
description: commitTransaction is retried after WriteConcernFailed non-timeout error
# WriteConcernTimeout errors are due to a replication timeout.
description: commitTransaction is retried after WriteConcernTimeout non-timeout error
operations:
- name: failPoint
object: testRunner
Expand All @@ -144,7 +143,6 @@ tests:
# with writeConcernError (see: SERVER-39292)
writeConcernError:
code: 64
codeName: WriteConcernFailed
errmsg: "multiple errors reported"
- *operation
expectEvents: *expectEvents_with_retries
Expand Down
5 changes: 2 additions & 3 deletions test/spec/transactions/unified/error-labels.json
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@
]
},
{
"description": "add UnknownTransactionCommitResult label to writeConcernError WriteConcernFailed",
"description": "add UnknownTransactionCommitResult label to writeConcernError WriteConcernTimeout",
"operations": [
{
"object": "testRunner",
Expand Down Expand Up @@ -1338,7 +1338,7 @@
]
},
{
"description": "add UnknownTransactionCommitResult label to writeConcernError WriteConcernFailed with wtimeout",
"description": "add UnknownTransactionCommitResult label to writeConcernError WriteConcernTimeout with wtimeout",
"operations": [
{
"object": "testRunner",
Expand All @@ -1356,7 +1356,6 @@
],
"writeConcernError": {
"code": 64,
"codeName": "WriteConcernFailed",
"errmsg": "waiting for replication timed out",
"errInfo": {
"wtimeout": true
Expand Down
7 changes: 3 additions & 4 deletions test/spec/transactions/unified/error-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ tests:
databaseName: *database_name
documents: []
-
description: 'add UnknownTransactionCommitResult label to writeConcernError WriteConcernFailed'
description: 'add UnknownTransactionCommitResult label to writeConcernError WriteConcernTimeout'
operations:
-
object: testRunner
Expand All @@ -702,7 +702,7 @@ tests:
failCommands:
- commitTransaction
writeConcernError:
code: 64 # WriteConcernFailed without wtimeout
code: 64 # WriteConcernTimeout without wtimeout
errmsg: 'multiple errors reported'
-
object: *session0
Expand Down Expand Up @@ -782,7 +782,7 @@ tests:
documents:
- { _id: 1 }
-
description: 'add UnknownTransactionCommitResult label to writeConcernError WriteConcernFailed with wtimeout'
description: 'add UnknownTransactionCommitResult label to writeConcernError WriteConcernTimeout with wtimeout'
operations:
-
object: testRunner
Expand All @@ -797,7 +797,6 @@ tests:
- commitTransaction
writeConcernError:
code: 64
codeName: WriteConcernFailed
errmsg: 'waiting for replication timed out'
errInfo:
wtimeout: true
Expand Down