Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-83788

Insert-only bulkWrite sent from mongos to mongod should use errorsOnly:true

    • Type: Icon: Task Task
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Replication

      For insert-only bulkWrite commands, errorsOnly:false doesn't provide any additional information compared to errorsOnly:true (summary mode). Therefore, any insert-only bulkWrite should always use errorsOnly:true as responses are much cheaper to produce in summary mode. This should be possible because inserts either succeed with n: 1, or fail with an error. It isn't possible for an insert to produce n: 0 while not having an associated error.

      This is not true for updates / deletes because 1) they can no-op without an error and 2) touch more than one document when multi:true. Because of this we won't be able to figure out which update / delete contributed how much to the totals nModified and nDeleted. For example, for two updates [u1, u2] if we receive a single number nModified: 1 in summary mode, from this we cannot figure out whether u1 or u2 produced the modification.

      The point of this work is to make the insert-only code path more performant. If somehow there is a way to make this work for updates and deletes as well, then that is great: we can completely get rid of errorsOnly:false.

      Ideally, the driver itself will send errorsOnly:true when it sees that it is sending an insert-only bulkWrite.

            Assignee:
            backlog-server-repl [DO NOT USE] Backlog - Replication Team
            Reporter:
            vishnu.kaushik@mongodb.com Vishnu Kaushik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: