[CSHARP-693] InsertBatch must call GLE after all sub-batches (except perhaps the last) even if WriteConcern is Unacknowledged Created: 01/Mar/13  Updated: 20/Mar/14  Resolved: 29/Apr/13

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.7.1, 1.8.1
Fix Version/s: 1.8, 1.8.2

Type: Bug Priority: Major - P3
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to DRIVERS-1888 Split legacy batch inserts into many ... Closed
Backwards Compatibility: Minor Change

 Description   

When InsertBatch is called with more documents than can fit in a single message to the server it breaks up the large batch into smaller sub-batches that do fit into a single message.

To maintain the semantics that a batch stops as soon as the first error is encountered (when ContinueOnError is false) InsertBatch must call GLE after all sub-batches (except perhaps the last) even if WriteConcern is Unacknowledged. Otherwise it wouldn't know that an error occurred and that it should stop sending any additional sub-batches.



 Comments   
Comment by auto [ 29/Apr/13 ]

Author:

{u'date': u'2013-04-29T17:59:59Z', u'name': u'rstam', u'email': u'robert@10gen.com'}

Message: CSHARP-693: Be more precise about how errors are handled when ContinueOnError is true.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/abd7b01d6bcd2252de6204b5094f86908e4c937f

Comment by Robert Stam [ 29/Apr/13 ]

Reopening the issue to make a minor change to how errors are handled. The desired behavior is:

1. WriteConcern enabled and ContinueOnError is false

Add the requested GLE after each sub-batch and throw an exception when the first error occurs. Otherwise return a list of the GLE results.

2. WriteConcern enabled and ContinueOnError is true

Add the requested GLE after each sub-batch but keep going even if an error is detected. After the final sub-batch, throw an exception if an error was detected after any sub-batch. Otherwise return the list of the GLE results.

3. WriteConcern disabled and ContinueOnError is false

Add a GLE (w=1) after each sub-batch except the last. If an error is detected after any sub-batch stop processing any further batches and return null.

4. WriteConcern disabled and ContinueOnError is true

Send all sub-batches without a GLE. Return null.

Comment by auto [ 07/Mar/13 ]

Author:

{u'date': u'2013-03-06T16:24:55Z', u'name': u'rstam', u'email': u'robert@10gen.com'}

Message: CSHARP-693: InsertBatch must call GLE after all sub-batches even if WriteConcern is Unacknowledged but ContinueOnError is false.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/2175557806866f0361ed59149fe9572988d05b73

Generated at Wed Feb 07 21:37:34 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.