Skip to content

GODRIVER-1028 return correct error indexes for bulkWrite #483

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

Merged
merged 4 commits into from
Aug 31, 2020

Conversation

iwysiu
Copy link
Contributor

@iwysiu iwysiu commented Aug 14, 2020

No description provided.

Copy link
Contributor

@divjotarora divjotarora left a comment

Choose a reason for hiding this comment

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

My understanding of this change is that we store the original index of each model when creating batches and we use that information later on when creating error structs. Doing it this way also eliminates the need to keep the base index of the batch so we don't need to do something like index += baseIndex. Is that all correct?

Also, do we have a similar test case for ordered bulk writes?

@kevinAlbs kevinAlbs self-requested a review August 27, 2020 23:33
Copy link
Contributor

@kevinAlbs kevinAlbs left a comment

Choose a reason for hiding this comment

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

Suggestion for another test but otherwise looks good!

assert.Equal(mt, len(res.UpsertedIDs), 2, "expected 2 UpsertedIDs, got %v", len(res.UpsertedIDs))
assert.Equal(mt, res.UpsertedIDs[1].(string), id1, "expected UpsertedIDs[1] to be %v, got %v", id1, res.UpsertedIDs[1])
assert.Equal(mt, res.UpsertedIDs[3].(string), id3, "expected UpsertedIDs[3] to be %v, got %v", id3, res.UpsertedIDs[3])
})
Copy link
Contributor

Choose a reason for hiding this comment

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

I was also going to ask whether there are tests of individual commands being split into multiple batches. Though that was addressed in GODRIVER-1363 and appears to be tested in c814cfb#diff-1572fa8947f9463542abdc5cb3a11528R204.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that will be handled in GODRIVER-1715

Copy link
Contributor

@kevinAlbs kevinAlbs left a comment

Choose a reason for hiding this comment

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

LGTM!

@iwysiu iwysiu merged commit c1d5607 into mongodb:master Aug 31, 2020
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.

3 participants