Skip to main content

What is replication rollback and when does it occur?

Senior MongoDB
Quick Answer Replication rollback occurs when a primary fails, a new primary is elected, and the old primary rejoins with writes that were never replicated to the majority. Those writes are rolled back (written to a rollback folder for manual recovery). To prevent rollback: use write concern majority. With w:1 writes, any unacknowledged write not yet replicated to the new primary is lost.

Answer

Rollback happens when a primary steps down before its oplog entries replicate. The node removes unreplicated writes on restart to match the majority view.
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