-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
ALL
-
While performing the applyOps command, duplicateKey exception are ignored during insertion but not on update operations.
This could result in a situation where oplog would not be idempotent with a unique index as update could fail where they should not. For example:
db.test.createIndex({a: 1}, {unique: true})
db.test.insert({a: 1})
db.test.update({a: 1}, {$set: {a: 2, b: 1}})
db.test.remove({a: 2})
db.test.insert({a: 2})
if you replay all oplog entries whereas the last insert has already been done ({a: 2} is present in the collection), mongod will fail with:
db.test.update({a: 1}, {$set: {a: 2}}) applyOps: E11000 duplicate key error collection: test.test index: a_1 dup key: { : 2.0 }
This is specially painful while you are performing point in time restore as mongorestore is stopping at the first error encountered.
Cheers,
Damien
- duplicates
-
TOOLS-176 Dump/Restore with --oplog not point-in-time
- Closed