[JAVA-803] Document insert must call getLastError after each sub-batch even with WriteConcern.UNACKNOWLEDGED Created: 12/Apr/13  Updated: 25/Nov/15  Resolved: 25/Nov/15

Status: Closed
Project: Java Driver
Component/s: Write Operations
Affects Version/s: None
Fix Version/s: 3.1.0

Type: Improvement Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by DRIVERS-1888 Split legacy batch inserts into many ... Closed

 Description   

To maintain the semantic that the batch stops as soon as there is a single error...if a user tries to insert 10k documents but only 2k documents fit with the maximum message size, the driver does five 2k inserts. In that case, after each 2k insert, it should call getLastError, and if there was an error, fail. This is whether or not the user wants GLEs called. This is the only way to guarantee the semantics."

So, even if WriteConcern.UNACKNOWLEDGED, you still must call getLastError after each batch, except for the last batch.

This is only if WriteConcern.continueOnError is false. If it's true, the existing algorithm is ok.



 Comments   
Comment by Jeffrey Yemin [ 25/Nov/15 ]

This was fixed as part of JAVA-1887.

Comment by Jeffrey Yemin [ 27/Mar/14 ]

Since OP_INSERT is going to be deprecated in favor of the insert command, this improvement is no longer so imperative.

Generated at Thu Feb 08 08:53:06 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.