PHPLIB-532: Sync spec tests for retryable writes

parent 8060d725
{
"runOn": [
{
"minServerVersion": "4.3.1",
"topology": [
"replicaset",
"sharded"
]
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"tests": [
{
"description": "BulkWrite succeeds with RetryableWriteError from server",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"update"
],
"errorCode": 112,
"errorLabels": [
"RetryableWriteError"
]
}
},
"operation": {
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
}
}
},
{
"name": "insertOne",
"arguments": {
"document": {
"_id": 3,
"x": 33
}
}
},
{
"name": "updateOne",
"arguments": {
"filter": {
"_id": 2
},
"update": {
"$inc": {
"x": 1
}
}
}
}
],
"options": {
"ordered": true
}
}
},
"outcome": {
"result": {
"deletedCount": 1,
"insertedCount": 1,
"insertedIds": {
"1": 3
},
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0,
"upsertedIds": {}
},
"collection": {
"data": [
{
"_id": 2,
"x": 23
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "BulkWrite fails if server does not return RetryableWriteError",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"update"
],
"errorCode": 11600,
"errorLabels": []
}
},
"operation": {
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
}
}
},
{
"name": "insertOne",
"arguments": {
"document": {
"_id": 3,
"x": 33
}
}
},
{
"name": "updateOne",
"arguments": {
"filter": {
"_id": 2
},
"update": {
"$inc": {
"x": 1
}
}
}
}
],
"options": {
"ordered": true
}
}
},
"outcome": {
"error": true,
"result": {
"errorLabelsOmit": [
"RetryableWriteError"
]
},
"collection": {
"data": [
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
}
]
}
...@@ -35,7 +35,10 @@ ...@@ -35,7 +35,10 @@
"failCommands": [ "failCommands": [
"update" "update"
], ],
"errorCode": 189 "errorCode": 189,
"errorLabels": [
"RetryableWriteError"
]
} }
}, },
"operation": { "operation": {
...@@ -117,7 +120,10 @@ ...@@ -117,7 +120,10 @@
], ],
"writeConcernError": { "writeConcernError": {
"code": 91, "code": 91,
"errmsg": "Replication is being shut down" "errmsg": "Replication is being shut down",
"errorLabels": [
"RetryableWriteError"
]
} }
} }
}, },
...@@ -186,6 +192,81 @@ ...@@ -186,6 +192,81 @@
] ]
} }
} }
},
{
"description": "BulkWrite fails with a RetryableWriteError label after two connection failures",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 2
},
"data": {
"failCommands": [
"update"
],
"closeConnection": true
}
},
"operation": {
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
}
}
},
{
"name": "insertOne",
"arguments": {
"document": {
"_id": 3,
"x": 33
}
}
},
{
"name": "updateOne",
"arguments": {
"filter": {
"_id": 2
},
"update": {
"$inc": {
"x": 1
}
}
}
}
],
"options": {
"ordered": true
}
}
},
"outcome": {
"error": true,
"result": {
"errorLabelsContain": [
"RetryableWriteError"
]
},
"collection": {
"data": [
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
} }
] ]
} }
{
"runOn": [
{
"minServerVersion": "4.3.1",
"topology": [
"replicaset",
"sharded"
]
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"tests": [
{
"description": "DeleteOne succeeds with RetryableWriteError from server",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"delete"
],
"errorCode": 112,
"errorLabels": [
"RetryableWriteError"
]
}
},
"operation": {
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
}
}
},
"outcome": {
"result": {
"deletedCount": 1
},
"collection": {
"data": [
{
"_id": 2,
"x": 22
}
]
}
}
},
{
"description": "DeleteOne fails if server does not return RetryableWriteError",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"delete"
],
"errorCode": 11600,
"errorLabels": []
}
},
"operation": {
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
}
}
},
"outcome": {
"error": true,
"result": {
"errorLabelsOmit": [
"RetryableWriteError"
]
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
}
]
}
...@@ -35,7 +35,10 @@ ...@@ -35,7 +35,10 @@
"failCommands": [ "failCommands": [
"delete" "delete"
], ],
"errorCode": 189 "errorCode": 189,
"errorLabels": [
"RetryableWriteError"
]
} }
}, },
"operation": { "operation": {
...@@ -73,7 +76,10 @@ ...@@ -73,7 +76,10 @@
], ],
"writeConcernError": { "writeConcernError": {
"code": 91, "code": 91,
"errmsg": "Replication is being shut down" "errmsg": "Replication is being shut down",
"errorLabels": [
"RetryableWriteError"
]
} }
} }
}, },
...@@ -98,6 +104,49 @@ ...@@ -98,6 +104,49 @@
] ]
} }
} }
},
{
"description": "DeleteOne fails with RetryableWriteError label after two connection failures",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 2
},
"data": {
"failCommands": [
"delete"
],
"closeConnection": true
}
},
"operation": {
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
}
}
},
"outcome": {
"error": true,
"result": {
"errorLabelsContain": [
"RetryableWriteError"
]
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
} }
] ]
} }
{
"runOn": [
{
"minServerVersion": "4.3.1",
"topology": [
"replicaset",
"sharded"
]
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"tests": [
{
"description": "FindOneAndDelete succeeds with RetryableWriteError from server",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"findAndModify"
],
"errorCode": 112,
"errorLabels": [
"RetryableWriteError"
]
}
},
"operation": {
"name": "findOneAndDelete",
"arguments": {
"filter": {
"x": {
"$gte": 11
}
},
"sort": {
"x": 1
}
}
},
"outcome": {
"result": {
"_id": 1,
"x": 11
},
"collection": {
"data": [
{
"_id": 2,
"x": 22
}
]
}
}
},
{
"description": "FindOneAndDelete fails if server does not return RetryableWriteError",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"findAndModify"
],
"errorCode": 11600,
"errorLabels": []
}
},
"operation": {
"name": "findOneAndDelete",
"arguments": {
"filter": {
"x": {
"$gte": 11
}
},
"sort": {
"x": 1
}
}
},
"outcome": {
"error": true,
"result": {
"errorLabelsOmit": [
"RetryableWriteError"
]
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
}
]
}
...@@ -35,7 +35,10 @@ ...@@ -35,7 +35,10 @@
"failCommands": [ "failCommands": [
"findAndModify" "findAndModify"
], ],
"errorCode": 189 "errorCode": 189,
"errorLabels": [
"RetryableWriteError"
]
} }
}, },
"operation": { "operation": {
...@@ -79,7 +82,10 @@ ...@@ -79,7 +82,10 @@
], ],
"writeConcernError": { "writeConcernError": {
"code": 91, "code": 91,
"errmsg": "Replication is being shut down" "errmsg": "Replication is being shut down",
"errorLabels": [
"RetryableWriteError"
]
} }
} }
}, },
...@@ -110,6 +116,54 @@ ...@@ -110,6 +116,54 @@
] ]
} }
} }
},
{
"description": "FindOneAndDelete fails with a RetryableWriteError label after two connection failures",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 2
},
"data": {
"failCommands": [
"findAndModify"
],
"closeConnection": true
}
},
"operation": {
"name": "findOneAndDelete",
"arguments": {
"filter": {
"x": {
"$gte": 11
}
},
"sort": {
"x": 1
}
}
},
"outcome": {
"error": true,
"result": {
"errorLabelsContain": [
"RetryableWriteError"
]
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
} }
] ]
} }
{
"runOn": [
{
"minServerVersion": "4.3.1",
"topology": [
"replicaset",
"sharded"
]
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"tests": [
{
"description": "FindOneAndReplace succeeds with RetryableWriteError from server",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"findAndModify"
],
"errorCode": 112,
"errorLabels": [
"RetryableWriteError"
]
}
},
"operation": {
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 1
},
"replacement": {
"_id": 1,
"x": 111
},
"returnDocument": "Before"
}
},
"outcome": {
"result": {
"_id": 1,
"x": 11
},
"collection": {
"data": [
{
"_id": 1,
"x": 111
},
{
"_id": 2,
"x": 22
}
]
}
}
},
{
"description": "FindOneAndReplace fails if server does not return RetryableWriteError",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"findAndModify"
],
"errorCode": 11600,
"errorLabels": []
}
},
"operation": {
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 1
},
"replacement": {
"_id": 1,
"x": 111
},
"returnDocument": "Before"
}
},
"outcome": {
"error": true,
"result": {
"errorLabelsOmit": [
"RetryableWriteError"
]
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
}
]
}
...@@ -35,7 +35,10 @@ ...@@ -35,7 +35,10 @@
"failCommands": [ "failCommands": [
"findAndModify" "findAndModify"
], ],
"errorCode": 189 "errorCode": 189,
"errorLabels": [
"RetryableWriteError"
]
} }
}, },
"operation": { "operation": {
...@@ -83,7 +86,10 @@ ...@@ -83,7 +86,10 @@
], ],
"writeConcernError": { "writeConcernError": {
"code": 91, "code": 91,
"errmsg": "Replication is being shut down" "errmsg": "Replication is being shut down",
"errorLabels": [
"RetryableWriteError"
]
} }
} }
}, },
...@@ -118,6 +124,54 @@ ...@@ -118,6 +124,54 @@
] ]
} }
} }
},
{
"description": "FindOneAndReplace fails with a RetryableWriteError label after two connection failures",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 2
},
"data": {
"failCommands": [
"findAndModify"
],
"closeConnection": true
}
},
"operation": {
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 1
},
"replacement": {
"_id": 1,
"x": 111
},
"returnDocument": "Before"
}
},
"outcome": {
"error": true,
"result": {
"errorLabelsContain": [
"RetryableWriteError"
]
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
} }
] ]
} }
{
"runOn": [
{
"minServerVersion": "4.3.1",
"topology": [
"replicaset",
"sharded"
]
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"tests": [
{
"description": "FindOneAndUpdate succeeds with RetryableWriteError from server",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"findAndModify"
],
"errorCode": 112,
"errorLabels": [
"RetryableWriteError"
]
}
},
"operation": {
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
},
"returnDocument": "Before"
}
},
"outcome": {
"result": {
"_id": 1,
"x": 11
},
"collection": {
"data": [
{
"_id": 1,
"x": 12
},
{
"_id": 2,
"x": 22
}
]
}
}
},
{
"description": "FindOneAndUpdate fails if server does not return RetryableWriteError",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"findAndModify"
],
"errorCode": 11600,
"errorLabels": []
}
},
"operation": {
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
},
"returnDocument": "Before"
}
},
"outcome": {
"error": true,
"result": {
"errorLabelsOmit": [
"RetryableWriteError"
]
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
}
]
}
...@@ -35,7 +35,10 @@ ...@@ -35,7 +35,10 @@
"failCommands": [ "failCommands": [
"findAndModify" "findAndModify"
], ],
"errorCode": 189 "errorCode": 189,
"errorLabels": [
"RetryableWriteError"
]
} }
}, },
"operation": { "operation": {
...@@ -84,7 +87,10 @@ ...@@ -84,7 +87,10 @@
], ],
"writeConcernError": { "writeConcernError": {
"code": 91, "code": 91,
"errmsg": "Replication is being shut down" "errmsg": "Replication is being shut down",
"errorLabels": [
"RetryableWriteError"
]
} }
} }
}, },
...@@ -120,6 +126,55 @@ ...@@ -120,6 +126,55 @@
] ]
} }
} }
},
{
"description": "FindOneAndUpdate fails with a RetryableWriteError label after two connection failures",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 2
},
"data": {
"failCommands": [
"findAndModify"
],
"closeConnection": true
}
},
"operation": {
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
},
"returnDocument": "Before"
}
},
"outcome": {
"error": true,
"result": {
"errorLabelsContain": [
"RetryableWriteError"
]
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
} }
] ]
} }
{
"runOn": [
{
"minServerVersion": "4.3.1",
"topology": [
"replicaset",
"sharded"
]
}
],
"data": [
{
"_id": 1,
"x": 11
}
],
"tests": [
{
"description": "InsertMany succeeds with RetryableWriteError from server",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"insert"
],
"errorCode": 112,
"errorLabels": [
"RetryableWriteError"
]
}
},
"operation": {
"name": "insertMany",
"arguments": {
"documents": [
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"options": {
"ordered": true
}
}
},
"outcome": {
"result": {
"insertedIds": {
"0": 2,
"1": 3
}
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "InsertMany fails if server does not return RetryableWriteError",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"insert"
],
"errorCode": 11600,
"errorLabels": []
}
},
"operation": {
"name": "insertMany",
"arguments": {
"documents": [
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"options": {
"ordered": true
}
}
},
"outcome": {
"error": true,
"result": {
"errorLabelsOmit": [
"RetryableWriteError"
]
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
}
]
}
}
}
]
}
...@@ -31,7 +31,10 @@ ...@@ -31,7 +31,10 @@
"failCommands": [ "failCommands": [
"insert" "insert"
], ],
"errorCode": 189 "errorCode": 189,
"errorLabels": [
"RetryableWriteError"
]
} }
}, },
"operation": { "operation": {
...@@ -90,7 +93,10 @@ ...@@ -90,7 +93,10 @@
], ],
"writeConcernError": { "writeConcernError": {
"code": 91, "code": 91,
"errmsg": "Replication is being shut down" "errmsg": "Replication is being shut down",
"errorLabels": [
"RetryableWriteError"
]
} }
} }
}, },
...@@ -136,6 +142,55 @@ ...@@ -136,6 +142,55 @@
] ]
} }
} }
},
{
"description": "InsertMany fails with a RetryableWriteError label after two connection failures",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 2
},
"data": {
"failCommands": [
"insert"
],
"closeConnection": true
}
},
"operation": {
"name": "insertMany",
"arguments": {
"documents": [
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"options": {
"ordered": true
}
}
},
"outcome": {
"error": true,
"result": {
"errorLabelsContain": [
"RetryableWriteError"
]
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
}
]
}
}
} }
] ]
} }
{
"runOn": [
{
"minServerVersion": "4.3.1",
"topology": [
"replicaset",
"sharded"
]
}
],
"data": [],
"tests": [
{
"description": "InsertOne succeeds with RetryableWriteError from server",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"insert"
],
"errorCode": 112,
"errorLabels": [
"RetryableWriteError"
]
}
},
"operation": {
"name": "insertOne",
"arguments": {
"document": {
"_id": 1,
"x": 11
}
}
},
"outcome": {
"result": {
"insertedId": 1
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
}
]
}
}
},
{
"description": "InsertOne fails if server does not return RetryableWriteError",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"insert"
],
"errorCode": 11600,
"errorLabels": []
}
},
"operation": {
"name": "insertOne",
"arguments": {
"document": {
"_id": 1,
"x": 11
}
}
},
"outcome": {
"error": true,
"result": {
"errorLabelsOmit": [
"RetryableWriteError"
]
},
"collection": {
"data": []
}
}
}
]
}
...@@ -69,6 +69,53 @@ ...@@ -69,6 +69,53 @@
} }
} }
}, },
{
"description": "InsertOne fails after connection failure when retryWrites option is false",
"clientOptions": {
"retryWrites": false
},
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"insert"
],
"closeConnection": true
}
},
"operation": {
"name": "insertOne",
"arguments": {
"document": {
"_id": 3,
"x": 33
}
}
},
"outcome": {
"error": true,
"result": {
"errorLabelsOmit": [
"RetryableWriteError"
]
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
},
{ {
"description": "InsertOne succeeds after NotMaster", "description": "InsertOne succeeds after NotMaster",
"failPoint": { "failPoint": {
...@@ -81,6 +128,9 @@ ...@@ -81,6 +128,9 @@
"insert" "insert"
], ],
"errorCode": 10107, "errorCode": 10107,
"errorLabels": [
"RetryableWriteError"
],
"closeConnection": false "closeConnection": false
} }
}, },
...@@ -127,6 +177,9 @@ ...@@ -127,6 +177,9 @@
"insert" "insert"
], ],
"errorCode": 13436, "errorCode": 13436,
"errorLabels": [
"RetryableWriteError"
],
"closeConnection": false "closeConnection": false
} }
}, },
...@@ -173,6 +226,9 @@ ...@@ -173,6 +226,9 @@
"insert" "insert"
], ],
"errorCode": 13435, "errorCode": 13435,
"errorLabels": [
"RetryableWriteError"
],
"closeConnection": false "closeConnection": false
} }
}, },
...@@ -208,7 +264,7 @@ ...@@ -208,7 +264,7 @@
} }
}, },
{ {
"description": "InsertOne succeeds after InterruptedDueToStepDown", "description": "InsertOne succeeds after InterruptedDueToReplStateChange",
"failPoint": { "failPoint": {
"configureFailPoint": "failCommand", "configureFailPoint": "failCommand",
"mode": { "mode": {
...@@ -219,6 +275,9 @@ ...@@ -219,6 +275,9 @@
"insert" "insert"
], ],
"errorCode": 11602, "errorCode": 11602,
"errorLabels": [
"RetryableWriteError"
],
"closeConnection": false "closeConnection": false
} }
}, },
...@@ -265,6 +324,9 @@ ...@@ -265,6 +324,9 @@
"insert" "insert"
], ],
"errorCode": 11600, "errorCode": 11600,
"errorLabels": [
"RetryableWriteError"
],
"closeConnection": false "closeConnection": false
} }
}, },
...@@ -311,6 +373,9 @@ ...@@ -311,6 +373,9 @@
"insert" "insert"
], ],
"errorCode": 189, "errorCode": 189,
"errorLabels": [
"RetryableWriteError"
],
"closeConnection": false "closeConnection": false
} }
}, },
...@@ -357,6 +422,9 @@ ...@@ -357,6 +422,9 @@
"insert" "insert"
], ],
"errorCode": 91, "errorCode": 91,
"errorLabels": [
"RetryableWriteError"
],
"closeConnection": false "closeConnection": false
} }
}, },
...@@ -403,6 +471,9 @@ ...@@ -403,6 +471,9 @@
"insert" "insert"
], ],
"errorCode": 7, "errorCode": 7,
"errorLabels": [
"RetryableWriteError"
],
"closeConnection": false "closeConnection": false
} }
}, },
...@@ -449,6 +520,9 @@ ...@@ -449,6 +520,9 @@
"insert" "insert"
], ],
"errorCode": 6, "errorCode": 6,
"errorLabels": [
"RetryableWriteError"
],
"closeConnection": false "closeConnection": false
} }
}, },
...@@ -495,6 +569,9 @@ ...@@ -495,6 +569,9 @@
"insert" "insert"
], ],
"errorCode": 9001, "errorCode": 9001,
"errorLabels": [
"RetryableWriteError"
],
"closeConnection": false "closeConnection": false
} }
}, },
...@@ -541,6 +618,58 @@ ...@@ -541,6 +618,58 @@
"insert" "insert"
], ],
"errorCode": 89, "errorCode": 89,
"errorLabels": [
"RetryableWriteError"
],
"closeConnection": false
}
},
"operation": {
"name": "insertOne",
"arguments": {
"document": {
"_id": 3,
"x": 33
}
}
},
"outcome": {
"result": {
"insertedId": 3
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "InsertOne succeeds after ExceededTimeLimit",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"insert"
],
"errorCode": 262,
"errorLabels": [
"RetryableWriteError"
],
"closeConnection": false "closeConnection": false
} }
}, },
...@@ -601,6 +730,11 @@ ...@@ -601,6 +730,11 @@
}, },
"outcome": { "outcome": {
"error": true, "error": true,
"result": {
"errorLabelsOmit": [
"RetryableWriteError"
]
},
"collection": { "collection": {
"data": [ "data": [
{ {
...@@ -628,7 +762,10 @@ ...@@ -628,7 +762,10 @@
], ],
"writeConcernError": { "writeConcernError": {
"code": 11600, "code": 11600,
"errmsg": "Replication is being shut down" "errmsg": "Replication is being shut down",
"errorLabels": [
"RetryableWriteError"
]
} }
} }
}, },
...@@ -664,7 +801,7 @@ ...@@ -664,7 +801,7 @@
} }
}, },
{ {
"description": "InsertOne succeeds after WriteConcernError InterruptedDueToStepDown", "description": "InsertOne succeeds after WriteConcernError InterruptedDueToReplStateChange",
"failPoint": { "failPoint": {
"configureFailPoint": "failCommand", "configureFailPoint": "failCommand",
"mode": { "mode": {
...@@ -676,7 +813,10 @@ ...@@ -676,7 +813,10 @@
], ],
"writeConcernError": { "writeConcernError": {
"code": 11602, "code": 11602,
"errmsg": "Replication is being shut down" "errmsg": "Replication is being shut down",
"errorLabels": [
"RetryableWriteError"
]
} }
} }
}, },
...@@ -724,7 +864,10 @@ ...@@ -724,7 +864,10 @@
], ],
"writeConcernError": { "writeConcernError": {
"code": 189, "code": 189,
"errmsg": "Replication is being shut down" "errmsg": "Replication is being shut down",
"errorLabels": [
"RetryableWriteError"
]
} }
} }
}, },
...@@ -772,7 +915,10 @@ ...@@ -772,7 +915,10 @@
], ],
"writeConcernError": { "writeConcernError": {
"code": 91, "code": 91,
"errmsg": "Replication is being shut down" "errmsg": "Replication is being shut down",
"errorLabels": [
"RetryableWriteError"
]
} }
} }
}, },
...@@ -835,6 +981,11 @@ ...@@ -835,6 +981,11 @@
}, },
"outcome": { "outcome": {
"error": true, "error": true,
"result": {
"errorLabelsContain": [
"RetryableWriteError"
]
},
"collection": { "collection": {
"data": [ "data": [
{ {
...@@ -881,6 +1032,11 @@ ...@@ -881,6 +1032,11 @@
}, },
"outcome": { "outcome": {
"error": true, "error": true,
"result": {
"errorLabelsOmit": [
"RetryableWriteError"
]
},
"collection": { "collection": {
"data": [ "data": [
{ {
...@@ -931,6 +1087,11 @@ ...@@ -931,6 +1087,11 @@
}, },
"outcome": { "outcome": {
"error": true, "error": true,
"result": {
"errorLabelsOmit": [
"RetryableWriteError"
]
},
"collection": { "collection": {
"data": [ "data": [
{ {
...@@ -948,6 +1109,50 @@ ...@@ -948,6 +1109,50 @@
] ]
} }
} }
},
{
"description": "InsertOne fails with a RetryableWriteError label after two connection failures",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 2
},
"data": {
"failCommands": [
"insert"
],
"closeConnection": true
}
},
"operation": {
"name": "insertOne",
"arguments": {
"document": {
"_id": 3,
"x": 33
}
}
},
"outcome": {
"error": true,
"result": {
"errorLabelsContain": [
"RetryableWriteError"
]
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
} }
] ]
} }
{
"runOn": [
{
"minServerVersion": "4.3.1",
"topology": [
"replicaset",
"sharded"
]
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"tests": [
{
"description": "ReplaceOne succeeds with RetryableWriteError from server",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"update"
],
"errorCode": 112,
"errorLabels": [
"RetryableWriteError"
]
}
},
"operation": {
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 1
},
"replacement": {
"_id": 1,
"x": 111
}
}
},
"outcome": {
"result": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
},
"collection": {
"data": [
{
"_id": 1,
"x": 111
},
{
"_id": 2,
"x": 22
}
]
}
}
},
{
"description": "ReplaceOne fails if server does not return RetryableWriteError",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"update"
],
"errorCode": 11600,
"errorLabels": []
}
},
"operation": {
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 1
},
"replacement": {
"_id": 1,
"x": 111
}
}
},
"outcome": {
"error": true,
"result": {
"errorLabelsOmit": [
"RetryableWriteError"
]
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
}
]
}
...@@ -35,7 +35,10 @@ ...@@ -35,7 +35,10 @@
"failCommands": [ "failCommands": [
"update" "update"
], ],
"errorCode": 189 "errorCode": 189,
"errorLabels": [
"RetryableWriteError"
]
} }
}, },
"operation": { "operation": {
...@@ -83,7 +86,10 @@ ...@@ -83,7 +86,10 @@
], ],
"writeConcernError": { "writeConcernError": {
"code": 91, "code": 91,
"errmsg": "Replication is being shut down" "errmsg": "Replication is being shut down",
"errorLabels": [
"RetryableWriteError"
]
} }
} }
}, },
...@@ -118,6 +124,53 @@ ...@@ -118,6 +124,53 @@
] ]
} }
} }
},
{
"description": "ReplaceOne fails with a RetryableWriteError label after two connection failures",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 2
},
"data": {
"failCommands": [
"update"
],
"closeConnection": true
}
},
"operation": {
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 1
},
"replacement": {
"_id": 1,
"x": 111
}
}
},
"outcome": {
"error": true,
"result": {
"errorLabelsContain": [
"RetryableWriteError"
]
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
} }
] ]
} }
{
"runOn": [
{
"minServerVersion": "4.3.1",
"topology": [
"replicaset",
"sharded"
]
}
],
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"tests": [
{
"description": "UpdateOne succeeds with RetryableWriteError from server",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"update"
],
"errorCode": 112,
"errorLabels": [
"RetryableWriteError"
]
}
},
"operation": {
"name": "updateOne",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
}
}
},
"outcome": {
"result": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
},
"collection": {
"data": [
{
"_id": 1,
"x": 12
},
{
"_id": 2,
"x": 22
}
]
}
}
},
{
"description": "UpdateOne fails if server does not return RetryableWriteError",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"update"
],
"errorCode": 11600,
"errorLabels": []
}
},
"operation": {
"name": "updateOne",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
}
}
},
"outcome": {
"error": true,
"result": {
"errorLabelsOmit": [
"RetryableWriteError"
]
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
}
]
}
...@@ -35,7 +35,10 @@ ...@@ -35,7 +35,10 @@
"failCommands": [ "failCommands": [
"update" "update"
], ],
"errorCode": 189 "errorCode": 189,
"errorLabels": [
"RetryableWriteError"
]
} }
}, },
"operation": { "operation": {
...@@ -84,7 +87,10 @@ ...@@ -84,7 +87,10 @@
], ],
"writeConcernError": { "writeConcernError": {
"code": 91, "code": 91,
"errmsg": "Replication is being shut down" "errmsg": "Replication is being shut down",
"errorLabels": [
"RetryableWriteError"
]
} }
} }
}, },
...@@ -120,6 +126,54 @@ ...@@ -120,6 +126,54 @@
] ]
} }
} }
},
{
"description": "UpdateOne fails with a RetryableWriteError label after two connection failures",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 2
},
"data": {
"failCommands": [
"update"
],
"closeConnection": true
}
},
"operation": {
"name": "updateOne",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
}
}
},
"outcome": {
"error": true,
"result": {
"errorLabelsContain": [
"RetryableWriteError"
]
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
} }
] ]
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment