# Oplog window

Symptom: change stream consumers fail with "resume point may no longer be in the oplog" after being down for a while.

## Diagnose

Check the oplog window: the time between the oldest and newest oplog entries. In mongosh, `rs.printReplicationInfo()` shows configured size and time span. On Atlas, watch it via metrics and the failed resume errors.

## Confirm

Compare the window against your consumer downtime. If the consumer was down 3 days and the window is 2 days, the failure is expected. The window shrinks under heavy write load because the oplog is a fixed size.

## Fix

- Short term: re-seed the consumer (full sync or startAtOperationTime at now) and accept the gap.
- Long term: move to a tier with a larger oplog (oplog size scales with disk), reduce write amplification, and alert on consumer lag so downtime never exceeds the window.
- Persist resume tokens per batch so restarts resume from seconds ago, not hours.

## Verify

A simulated consumer outage shorter than the window resumes cleanly; the lag alert fires well before the window is at risk.