Skip to content

GODRIVER-4025 fix: Preserve first writeConcernError in unordered bulk write#2484

Open
zigzagdev wants to merge 1 commit into
mongodb:masterfrom
zigzagdev:fix/bulkwrite-wce-overwrite
Open

GODRIVER-4025 fix: Preserve first writeConcernError in unordered bulk write#2484
zigzagdev wants to merge 1 commit into
mongodb:masterfrom
zigzagdev:fix/bulkwrite-wce-overwrite

Conversation

@zigzagdev

@zigzagdev zigzagdev commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

GODRIVER-4025

Summary

In an unordered BulkWrite that splits into multiple command batches, a writeConcernError reported by an earlier batch was discarded when a later batch succeeded without one.
As a result the operation could return nil (success) even though a durability guarantee was not met.

Background & Motivation

For unordered bulk writes the loop runs every batch and assigns bwErr.WriteConcernError on each iteration, so only the last batch's value survives.
When a later batch has no write concern error, it overwrites an earlier one with nil and the whole operation reports success — silently dropping a durability failure.
The first write concern error that is detected should be retained instead of being overwritten.

@zigzagdev zigzagdev requested a review from a team as a code owner July 11, 2026 10:46
@zigzagdev zigzagdev requested a review from matthewdale July 11, 2026 10:46
@dariakp dariakp removed the request for review from matthewdale July 13, 2026 18:58
@matthewdale matthewdale changed the title fix: Preserve first writeConcernError in unordered bulk write GODRIVER-4025 fix: Preserve first writeConcernError in unordered bulk write Jul 13, 2026
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.

1 participant