[SERVER-33258] Replication must create necessary steady-state internal tables before coming out of initial sync Created: 11/Feb/18  Updated: 29/Oct/23  Resolved: 16/Feb/18

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 3.7.3

Type: Task Priority: Major - P3
Reporter: Daniel Gottlieb (Inactive) Assignee: Daniel Gottlieb (Inactive)
Resolution: Fixed Votes: 0
Labels: rollback-functional
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Repl 2018-02-26
Participants:

 Description   

KVStorageEngine implementations have their catalog persisted as "yet another" record store named the `_mdb_catalog`. For storage engines that support `recoverToStableTimestamp`, this table is not journaled, meaning it's only persisted when a stable checkpoint is taken, or from create collection oplog entries being replayed on replication recovery at startup.

Replication, naturally, does not replicate its internal collections which can lead to the following sequence:

  1. Exit initial sync at time T. T is also the stable timestamp.
  2. Node becomes a secondary.
  3. Create the `oplogTruncateAfterPoint` collection.
  4. Begin processing a patch, performing a write to the `oplogTruncateAfterPoint`.
  5. The node crashes. The `oplogTruncateAfterPoint` document is required to correctly recover.
  6. Node restarts.
  7. MongoDB sees a storage engine table without a corresponding MongoDB collection, the table gets removed.
  8. Replication recovery plays. Assumes there was no `oplogTruncateAfterPoint`, resulting in data corruption.

Explicitly creating `oplogTruncateAfterPoint` before coming out of initial sync is sufficient to guarantee that if a node starts up and decides it has completed initial sync, then the `oplogTruncateAfterPoint` collection will exist.



 Comments   
Comment by Githook User [ 16/Feb/18 ]

Author:

{'email': 'daniel.gottlieb@mongodb.com', 'name': 'Daniel Gottlieb', 'username': 'dgottlieb'}

Message: SERVER-33258: Guarantee replication tables are durable before use.
Branch: master
https://github.com/mongodb/mongo/commit/902b8552f11697308604823c19d6dbce661fc3d6

Generated at Thu Feb 08 04:32:50 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.