-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
Affects Version/s: 2.6.6
-
Component/s: Replication
-
None
-
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
- 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
- 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
- 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
- related to
-
SERVER-15825 Add stats for updates (w/upsert) which insert, in server status
- Open