liveBook · Manning

Oplog window

As explained in MongoDB 8.0 in Action, Third Edition

The oplog window is the time span covered by the oldest and newest retained entries in an oplog.

The oplog window is the time span between the oldest and newest retained entries in a replica set's oplog. It indicates how long a secondary can remain behind before older replication operations disappear. section 9.1.3

Check and interpret the window with these mongosh commands:

  • Run db.getReplicationInfo() for script-friendly JSON containing timeDiff, timeDiffHours, tFirst, tLast, and now. section 9.1.3
  • Use rs.printReplicationInfo() for a manual mongosh check when JSON parsing is unnecessary. section 9.1.3
  • Compare the window with secondary lag: a secondary must copy entries before they fall outside the retained time span. section 9.1.3

Reading a seven-day window

The sample output reports timeDiffHours: 176.43, with the first entry on March 20 and the last on March 27. The oplog is using 4074.63 MB of its configured 4096 MB, so the displayed window describes the current retained history rather than a fixed guarantee.

How MongoDB 8.0 in Action, Third Edition covers it

How deep it goes
Defines the duration and shows command output, but does not detail oplog resizing procedures.
Examples
Uses db.getReplicationInfo() output showing a 176.43-hour interval across March 20–27.
What you can do after
Diagnose retained replication coverage with db.getReplicationInfo() and compare it with secondary lag.
How it connects
Connects oplog retention with replica sets, secondary nodes, and replication lag.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of MongoDB 8.0 in Action, Third Edition. The section links point to the parts of the book it draws on.