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

Add a generic way to return a writeConcernErrors field from TypedCommands

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Server Programmability
    • SP Prioritized List
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Today, TypedCommands don't play super nicely with WriteConcernErrors, and it is actually not possible to create a response with a "writeConcernErrors" field from a TypedCommand's execution body unless the command's reply struct explicitly includes writeConcernErrors in its definition. In order to return a writeConcernError from a TypedCommand's run() execution, an engineer either has to add "writeConcernErrors" as a field to the reply type for the command, or choose to uassert on the write concern error (which means WriteConcernTimeout/whatever write concern error was thrown is returned as a top-level error, rather than in the writeConcernErrors field which is typically what we'd expect). This also means that it is impossible for a TypedCommand to return both a command level error and a write concern error, if both occurred (which we must do - see SPM-4070). This is mainly a problem for mongos, because most commands on mongod wait for write concern in the service entry point, after the command's run() execution has finished. However, for any mongod commands that wait for write concern explicitly somewhere in their execution, this would also be a problem. "writeConcernErrors" seems like it should be a generic reply field, or something similar.

            Assignee:
            Unassigned Unassigned
            Reporter:
            janna.golden@mongodb.com Janna Golden
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated: