[SERVER-60727] Remove mixed mode updates on local.system.replset Created: 15/Oct/21  Updated: 29/Oct/23  Resolved: 20/Nov/21

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

Type: Bug Priority: Major - P3
Reporter: Daniel Gottlieb (Inactive) Assignee: Lingzhi Deng
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-60037 Enable the ordered timestamp assertio... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Replication 2021-11-29
Participants:

 Description   

I believe there are at least two paths that introduce mixed mode writes onto `local.system.replset`. Given this collection holds the replica set configuration, it's not surprising that the current timestamping semantics are lax. It's not clear to me if (after initialization) MDB should always be timestamping writes to the collection or never timestamping them.

  • The first mixed-mode write is at initialization. I've been able to alleviate it with the following patch:

    diff --git a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
    index 45a54c4d35..e4914f7027 100644
    --- a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
    +++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
    @@ -457,11 +457,17 @@ Status ReplicationCoordinatorExternalStateImpl::initializeReplSetStorage(Operati
                                    // Permit writing to the oplog before we step up to primary.
                                    AllowNonLocalWritesBlock allowNonLocalWrites(opCtx);
                                    Lock::GlobalWrite globalWrite(opCtx);
    -                               WriteUnitOfWork wuow(opCtx);
    -                               Helpers::putSingleton(opCtx, configCollectionName, config);
    -                               const auto msgObj = BSON("msg" << kInitiatingSetMsg);
    -                               _service->getOpObserver()->onOpMessage(opCtx, msgObj);
    -                               wuow.commit();
    +                               {
    +                                   WriteUnitOfWork wuow(opCtx);
    +                                   Helpers::putSingleton(opCtx, configCollectionName, config);
    +                                   wuow.commit();
    +                               }
    +                               {
    +                                   WriteUnitOfWork wuow(opCtx);
    +                                   const auto msgObj = BSON("msg" << kInitiatingSetMsg);
    +                                   _service->getOpObserver()->onOpMessage(opCtx, msgObj);
    +                                   wuow.commit();
    +                               }
                                });
     
             // ReplSetTest assumes that immediately after the replSetInitiate command returns, it can
    

  • I believe the other problematic write I've seen is correlated with a forced reconfig. I haven't taken the time to gather the details for that scenario.


 Comments   
Comment by Githook User [ 20/Nov/21 ]

Author:

{'name': 'Lingzhi Deng', 'email': 'lingzhi.deng@mongodb.com', 'username': 'ldennis'}

Message: SERVER-60727: Remove mixed mode updates on local.system.replset
Branch: master
https://github.com/mongodb/mongo/commit/9e8078766c509b8a7096254ac888ae0a2ff5f49c

Comment by Connie Chen [ 29/Oct/21 ]

Passing this to replication, as Storage Execution doesn't have capacity to work on this right away.

Comment by Daniel Gottlieb (Inactive) [ 15/Oct/21 ]

I've assigned this to storage execution to provide better context for which writes go wrong. Then I imagine this ticket can go to repl, or storage can confer with repl on what the right change looks like. cc samy.lanka lingzhi.deng

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