Stale data in secondry node $inc operation

I have scenario where one of secondary is unable to sync from primary
now suppose we have increment on below document
{_id:1 salary:500 }

the secondary still have {_id:1 salary:50 }

on which below inc applied
db.col.update({_id:1},{$inc:{salary:5}})

Query:
Will secondry wait for previous update or it will update to 55?

as in oplog.rs I am seeing below data

o: {
‘$v’: 2,
diff: { u: { salary: { ‘$inc’: 5 } } }
},

Not a mongo employee. Following is my own understanding.

Generally data replication is implemented as “total order broadcast”, so the events will be applied on secondary servers one by one and in exact the same order as sent. there shouldn’t be any “gap”. (otherwise the data is inconsistent ).

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.