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

applyOps reports success even when a nested applyOps fails.

    XMLWordPrintable

    Details

    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v3.6, v3.4, v3.2
    • Sprint:
      Repl 2018-01-15, Repl 2018-01-29, Repl 2018-02-12

      Description

      An applyOps inside of another applyOps always succeeds even where there's an error applying an operation:

      var oplog = {op:"i", ns: "test.test", o: {_id: 1}}
      db.dropDatabase()
      var res = db.adminCommand({applyOps: [oplog]})
      print('Invalid applyOps:' + tojson(res))
      // Command fails:
      // Invalid applyOps:{
      //     "applied" : 1,
      //     "code" : 26,
      //     "errmsg" : "Failed to apply insert due to missing collection: { op: \"i\", ns: \"test.test\", o: { _id: 1.0 } }",
      //     "results" : [
      //         false
      //     ],
      //     "ok" : 0
      // }
      res = db.adminCommand({applyOps: [{op: "c", ns: "admin.$cmd", o: {applyOps: [oplog]}}]})
      print('Nested invalid applyOps:' + tojson(res))
      // Command succeeds:
      // Nested invalid applyOps:{
      //     "applied" : 1,
      //     "results" : [
      //         true
      //     ],
      //     "ok" : 1
      // }
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: