Oplog behavior on delayed secondary

Hi Guys,

Can any one let me know, how the oplog behaves in delayed secondory?
According to the lecture on the oplog if the secondary was unavailable for longer time we will need to manually bring the secondary up to date.

Do we need to increase the oplog on delayed secondary so that it can store more?

Kind Regards,
Roslan

2 Likes

It’s the size of the PRIMARY oplog that need to be increased. It is a bounded collections and if the delayed node does not apply the oldest entry before it is replaced by the latest operation on the primary, this entry is lost.

5 Likes

Thanks for the clarification Steeve.

Hi roslan,

First of all, very good question! :slight_smile: Really appreciate you having want to understand in such deep detail.

Now, your question,

It behaves as was exaplained in lecture, when a secondary comes back up after some delay, it will sync up with the oplog from primary. And oplog is not so big like it will not have write operations, it will have the text like, it performed a write operation and then write operations are performed as soon after that.
Example: I performed write operation:

  db.coll.insert({"key":"value"})

The oplog entry will be like “it performed a write”.

The oplog size depends on your system and requirements, like you don’t need large oplog size if you have more read operations than write.

And you can always reconfigure the oplog size.

And as @steevej-1495 explained, Primary oplog size should be increased if you want to make sure that no write operation should be lost.

Hope it helps!

Keep learning, Kanika

3 Likes

Thank you Kanika :slight_smile:

Hi
Excuse me, I can’t understand when primery oplog be full, the new write command lost or the last command in primery oplog is lost or the earliest command in oplog lost

You can consider it a circular log file… It starts at 0 and fills up to 100. Then it has reached 0 again, so it starts writing at 0 again, moving towards 100. So the oldest messages are lost when the oplog fills up.

Like the image below, but not with seperate files :slight_smile:

2 Likes

Thank you very much Tess_Sluijter

Hi everyone:

Thank you for this discussion post, it has been really interesting.
I appreciate if you can help me clarifying the following doubt:
If the write operation is lost, how the secondary node can have its data upped to date from the PRIMARY? Or it couldn’t be possible once that has occured?

Thank you so much in advance.