Skip to main content

How does MongoDB internally manage oplog truncation and what risks exist if oplog is too small?

Expert MongoDB
Quick Answer The oplog is a capped collection - when it fills up, oldest entries are truncated. If a secondary falls behind more than the oplog window (oplog can hold N hours of operations), the secondary can't catch up via replication and needs a full resync (initial sync). Risk: a resync during heavy load is very slow. Size oplog to cover your longest expected maintenance window.

Answer

MongoDB truncates old oplog entries automatically. If the oplog is too small, secondaries cannot catch up, causing rollback or forcing an initial sync that increases downtime risk.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice