...
1runOn:
2 - minServerVersion: "4.3.1"
3 topology: ["replicaset", "sharded", "load-balanced"]
4
5data:
6 - { _id: 1, x: 11 }
7 - { _id: 2, x: 22 }
8
9tests:
10 - description: "ReplaceOne succeeds with RetryableWriteError from server"
11 failPoint:
12 configureFailPoint: failCommand
13 mode: { times: 1 }
14 data:
15 failCommands: ["update"]
16 errorCode: 112 # WriteConflict, not a retryable error code
17 errorLabels: ["RetryableWriteError"] # Override server behavior: send RetryableWriteError label with non-retryable error code
18 operation:
19 name: "replaceOne"
20 arguments:
21 filter: { _id: 1 }
22 replacement: { _id: 1, x: 111 }
23 outcome: # Driver retries operation and it succeeds
24 result:
25 matchedCount: 1
26 modifiedCount: 1
27 upsertedCount: 0
28 collection:
29 data:
30 - { _id: 1, x: 111 }
31 - { _id: 2, x: 22 }
32
33 - description: "ReplaceOne fails if server does not return RetryableWriteError"
34 failPoint:
35 configureFailPoint: failCommand
36 mode: { times: 1 }
37 data:
38 failCommands: ["update"]
39 errorCode: 11600 # InterruptedAtShutdown, normally a retryable error code
40 errorLabels: [] # Override server behavior: do not send RetryableWriteError label with retryable code
41 operation:
42 name: "replaceOne"
43 arguments:
44 filter: { _id: 1 }
45 replacement: { _id: 1, x: 111 }
46 outcome:
47 error: true # Driver does not retry operation because there was no RetryableWriteError label on response
48 result:
49 errorLabelsOmit: ["RetryableWriteError"]
50 collection:
51 data:
52 - { _id: 1, x: 11 }
53 - { _id: 2, x: 22 }
View as plain text