You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Changes which errors are considered resumable on change streams,
adding support for the new ResumableChangeStreamError label.
- Removes ElectionInProgress (216) from ResumableChangeStreamError.
- Updates ChangeStream prose tests which described startAfter
behavior for unsupported server versions.
- Fixes use of startAfter/resumeAfter when resuming from an
invalidate event. Implement prose tests #17 and #18.
NODE-2478NODE-2522
Copy file name to clipboardExpand all lines: lib/error.js
+29-16
Original file line number
Diff line number
Diff line change
@@ -9,25 +9,34 @@ const GET_MORE_NON_RESUMABLE_CODES = new Set([
9
9
11601// Interrupted
10
10
]);
11
11
12
-
// From spec@https://github.com./mongodb/specifications/blob/7a2e93d85935ee4b1046a8d2ad3514c657dc74fa/source/change-streams/change-streams.rst#resumable-error:
13
-
//
14
-
// An error is considered resumable if it meets any of the following criteria:
15
-
// - any error encountered which is not a server error (e.g. a timeout error or network error)
16
-
// - any server error response from a getMore command excluding those containing the error label
17
-
// NonRetryableChangeStreamError and those containing the following error codes:
18
-
// - Interrupted: 11601
19
-
// - CappedPositionLost: 136
20
-
// - CursorKilled: 237
21
-
//
22
-
// An error on an aggregate command is not a resumable error. Only errors on a getMore command may be considered resumable errors.
12
+
// From spec@https://github.com./mongodb/specifications/blob/f93d78191f3db2898a59013a7ed5650352ef6da8/source/change-streams/change-streams.rst#resumable-error
13
+
constGET_MORE_RESUMABLE_CODES=newSet([
14
+
6,// HostUnreachable
15
+
7,// HostNotFound
16
+
89,// NetworkTimeout
17
+
91,// ShutdownInProgress
18
+
189,// PrimarySteppedDown
19
+
262,// ExceededTimeLimit
20
+
9001,// SocketException
21
+
10107,// NotMaster
22
+
11600,// InterruptedAtShutdown
23
+
11602,// InterruptedDueToReplStateChange
24
+
13435,// NotMasterNoSlaveOk
25
+
13436,// NotMasterOrSecondary
26
+
63,// StaleShardVersion
27
+
150,// StaleEpoch
28
+
13388,// StaleConfig
29
+
234,// RetryChangeStream
30
+
133// FailedToSatisfyReadPreference
31
+
]);
23
32
24
33
functionisGetMoreError(error){
25
34
if(error[mongoErrorContextSymbol]){
26
35
returnerror[mongoErrorContextSymbol].isGetMore;
27
36
}
28
37
}
29
38
30
-
functionisResumableError(error){
39
+
functionisResumableError(error,wireVersion){
31
40
if(!isGetMoreError(error)){
32
41
returnfalse;
33
42
}
@@ -36,10 +45,14 @@ function isResumableError(error) {
0 commit comments