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

Make accounting for upserts consistent with oplog entries on Primaries

    • Replication

      There are three scenarios for an upsert. On the Primary all three will be reported as an update, but the actual oplog entry will not necessarily reflect this. When those oplog entries are replicated to Secondaries, the correct counters will be increased, but this makes the counts inconsistent with those on the Primary.

      The three scenarios are as follows

      1. The document with a given key does not exist. Insert occurs on the Primary and an "i" record written to oplog. This is still recorded in serverStatus().opcounters as an update, and in db.serverStatus().metrics.document as an update
      2. The document with a given key exists and the new document is different from the old one. The old document is replaced with the new one on the Primary and a "u' record written to oplog. Correctly recorded as an update in serverStatus().opcounters and db.serverStatus().metrics.document
      3. The document with a given key exists and the new document is identical to the old one. No changes on the Primary and no record goes to oplog. This is still recorded as an updated in serverStatus().opcounters, but correctly not recorded in db.serverStatus().metrics.document

            backlog-server-repl [DO NOT USE] Backlog - Replication Team
            andre.defrere@mongodb.com Andre de Frere
            0 Vote for this issue
            8 Start watching this issue