Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-3048

HasErrorCode() should parse MultipleErrorsOccurred’s `errInfo`.

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Detailed steps to reproduce the problem?

      1. Create a 2-shard cluster.
      2. Create a collection with 1 chunk on either cluster.
      3. Create failpoints on both clusters for the “update” command. Give either failpoint a different error code (e.g., 1 and 2).
      4. On the mongos, run updateMany({},
        Unknown macro: { $set}

        ). The command will receive a MultipleErrorsOccurred value (code=65).

      5. In Go, HasErrorCode(2) on that error should return true if any of the component errors has error code 2.

      The error structure is:

      {
        index: 0,
        code: 65,
        errInfo: {
          causedBy: [
            {
              index: 0,
              code: 1,
              errmsg: "Failing command via 'failCommand' failpoint"
            },
            {
              index: 0,
              code: 2,
              errmsg: "Failing command via 'failCommand' failpoint"
            }
          ]
        },
        [Symbol(errorLabels)]: Set(0) {}
      }
      

      Example failpoint creation (note the `failInternalCommands` flag):

      db.adminCommand({ configureFailPoint: "failCommand", mode: "alwaysOn", data: { errorCode:2, failCommands: ["update", 'find'], failInternalCommands:true} })
      

      Definition of done: what must be done to consider the task complete?

      HasErrorCode() should handle MultipleErrorsOccurred as it currently handles `WriteError`s.

      The exact Go version used, with patch level:

      1.20.11

      The exact version of the Go driver used:

      1.12.1

      Describe how MongoDB is set up. Local vs Hosted, version, topology, load balanced, etc.

      2-shard cluster; each shard has a single node.

      The operating system and version (e.g. Windows 7, OSX 10.8, ...)

      macOS

      Security Vulnerabilities

      n/a

            Assignee:
            Unassigned Unassigned
            Reporter:
            felipe.gasper@mongodb.com Felipe Gasper
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: