-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Propagate the original error for write errors labeled NoWritesPerformed
#1013
Conversation
driver-sync/src/test/functional/com/mongodb/client/RetryableWritesProseTest.java
Outdated
Show resolved
Hide resolved
@stIncMale have a look at https://jira.mongodb.org/browse/SERVER-66116 for the original report that led to this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented
def operation = new MixedBulkWriteOperation(getNamespace(), | ||
[new InsertRequest(new BsonDocument('_id', new BsonInt32(7))), | ||
new InsertRequest(new BsonDocument('_id', new BsonInt32(1))) // duplicate key | ||
], false, ACKNOWLEDGED, true) | ||
[new DeleteRequest(new BsonDocument('_id', new BsonInt32(2))), // existing key | ||
new InsertRequest(new BsonDocument('_id', new BsonInt32(1))) // existing (duplicate) key | ||
], true, ACKNOWLEDGED, true) | ||
|
||
def failPoint = BsonDocument.parse('''{ | ||
"configureFailPoint": "failCommand", | ||
"mode": {"times": 2 }, | ||
"data": { "failCommands": ["insert"], | ||
"data": { "failCommands": ["delete"], | ||
"writeConcernError": {"code": 91, "errmsg": "Replication is being shut down"}}}''') | ||
configureFailPoint(failPoint) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a complete understanding of these test, but here is what I think I understand:
- it needs to fail the first attempt with a write concern error, and then it needs to see that the it is retried;
- to achieve the above, it fails the second attempt with a different error (tries to insert a duplicate key), and expects to observe it.
The latest server labels the second error as NoWritesPerformed
, because it fails to insert a duplicate key. As a result, the updated driver chooses the first error, thus not letting the test to observe the error from the second attempt, i.e., not letting the test to see that the command was retried. By deleting one of the existing keys, the test prevents the server from reporting NoWritesPerformed
, which leads to the test being able to observe the error from the second attempt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack, though I'm not sure we're testing the same thing anymore.
It turned out that the fail points from the new nests did not leak into the failing tests, which means that the changes to |
def operation = new MixedBulkWriteOperation(getNamespace(), | ||
[new InsertRequest(new BsonDocument('_id', new BsonInt32(7))), | ||
new InsertRequest(new BsonDocument('_id', new BsonInt32(1))) // duplicate key | ||
], false, ACKNOWLEDGED, true) | ||
[new DeleteRequest(new BsonDocument('_id', new BsonInt32(2))), // existing key | ||
new InsertRequest(new BsonDocument('_id', new BsonInt32(1))) // existing (duplicate) key | ||
], true, ACKNOWLEDGED, true) | ||
|
||
def failPoint = BsonDocument.parse('''{ | ||
"configureFailPoint": "failCommand", | ||
"mode": {"times": 2 }, | ||
"data": { "failCommands": ["insert"], | ||
"data": { "failCommands": ["delete"], | ||
"writeConcernError": {"code": 91, "errmsg": "Replication is being shut down"}}}''') | ||
configureFailPoint(failPoint) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack, though I'm not sure we're testing the same thing anymore.
driver-sync/src/test/functional/com/mongodb/client/RetryableWritesProseTest.java
Outdated
Show resolved
Hide resolved
driver-sync/src/test/functional/com/mongodb/client/RetryableWritesProseTest.java
Show resolved
Hide resolved
driver-sync/src/test/functional/com/mongodb/client/RetryableWritesProseTest.java
Outdated
Show resolved
Hide resolved
driver-sync/src/test/functional/com/mongodb/client/RetryableWritesProseTest.java
Outdated
Show resolved
Hide resolved
driver-sync/src/test/functional/com/mongodb/client/RetryableWritesProseTest.java
Outdated
Show resolved
Hide resolved
driver-sync/src/test/functional/com/mongodb/client/Fixture.java
Outdated
Show resolved
Hide resolved
I only noticed this comment after posting mine. I don't mind the change to Failpoint, but I don't see the need for the change to Fixture. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
TODO for @stIncMale: what's achieved by introducing
NoWritesPerformed
given that we already haveRetryableWriteError
?JAVA-4701