Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-803

Document insert must call getLastError after each sub-batch even with WriteConcern.UNACKNOWLEDGED

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.1.0
    • Affects Version/s: None
    • Component/s: Write Operations
    • None

      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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: