-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
None
-
Affects Version/s: 2.3.2
-
Component/s: Replication
-
None
-
ALL
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
Consider the sets of operations below:
db.user.ensureIndex({ x: 1 }, { unique: true });
db,user.insert({ x: 1, y: 1 });
db.user.insert({ x: 3, y: 2 });
db.user.update({ y: 1 }, { $inc: { x: 1 }, $set: { z: 1 }});
db.user.update({ y: 1 }, { $inc: { x: -1 }});
db.user.update({ y: 2 }, { $inc: { x: -1 }});
If you let the secondary apply all ops, but only record the oplog upto line#3, the secondary will fassert if you restart it. A variant using array also has the same problem:
db.user.ensureIndex({ 'a.x': 1 }, { unique: true }); db.user.insert({ a: [ { x: 1, y: 1 }, { x: 3, y: 2 } ]}); db.user.update({ 'a.y': 1 }, { $inc: { 'a.$.x': 1 }, $set: { 'a.$.z': 1 }}); db.user.update({ 'a.y': 1 }, { $inc: { 'a.$.x': -1 }}); db.user.update({ 'a.y': 2 }, { $inc: { 'a.$.x': -1 }});
Note: tested on commit 3dfc22e239d7455608a2ad2bc1197eac78550a23