Skip to content
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

Merged
merged 7 commits into from
Oct 14, 2022

Conversation

stIncMale
Copy link
Member

TODO for @stIncMale: what's achieved by introducing NoWritesPerformed given that we already have RetryableWriteError?

JAVA-4701

@stIncMale stIncMale requested a review from jyemin October 8, 2022 00:33
@jyemin
Copy link
Collaborator

jyemin commented Oct 8, 2022

@stIncMale have a look at https://jira.mongodb.org/browse/SERVER-66116 for the original report that led to this.

Copy link
Collaborator

@jyemin jyemin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented

Comment on lines 848 to 858
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)
Copy link
Member Author

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.

Copy link
Collaborator

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.

@stIncMale
Copy link
Member Author

It turned out that the fail points from the new nests did not leak into the failing tests, which means that the changes to Fixture and FailPoint are not necessary. However, these changes do prevent leaking fail points in some cases, which is why I think they should be committed. If you think they should be moved to a different PR, please let me know.

@stIncMale stIncMale requested a review from jyemin October 12, 2022 14:25
Comment on lines 848 to 858
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)
Copy link
Collaborator

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.

@jyemin
Copy link
Collaborator

jyemin commented Oct 12, 2022

It turned out that the fail points from the new nests did not leak into the failing tests, which means that the changes to Fixture and FailPoint are not necessary. However, these changes do prevent leaking fail points in some cases, which is why I think they should be committed. If you think they should be moved to a different PR, please let me know.

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.

@stIncMale stIncMale requested a review from jyemin October 14, 2022 20:29
Copy link
Collaborator

@jyemin jyemin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@stIncMale stIncMale merged commit fbc5e4e into mongodb:master Oct 14, 2022
@stIncMale stIncMale deleted the JAVA-4701 branch October 14, 2022 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants