Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-40707

Secondary couldn't signal OplogWaiters to advance the lastCommittedOpTime in Chained replication mode

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.4.4, 3.4.19, 3.4.20
    • Component/s: Replication
    • Replication
    • ALL
    • Hide

      a sharding cluster ,three config is  chaining. a->b->c

      we can easily get majorityOpTime < opTime in rs.isMaster().lastWrite of c。

       

      Show
      a sharding cluster ,three config is  chaining. a->b->c we can easily get majorityOpTime < opTime in rs.isMaster().lastWrite of c。  

      A replSet has three members, aa/bb/cc. In this situation , aa->bb->cc , aa is primary and the sync source of bb , bb is the sync source of cc . aa advances the lastCommittedOpTime , and it signal OplogWaiters , so bb can advance his lastCommittedOpTime , but sometimes cc couldn't advance its lastCommittedOpTime.
       
      The key problem here is the _localOplogCollection always is NULL for secondary.

      @oplog.cpp 
      void signalOplogWaiters() { 
      if (_localOplogCollection) { 
      _localOplogCollection->notifyCappedWaitersIfNeeded(); 
      } 
      }

      the only way to set _localOplogCollection is in function getLocalOplogCollection,and called here.

      void logOp(OperationContext* txn, 
      const char* opstr, 
      const char* ns, 
      const BSONObj& obj, 
      const BSONObj* o2, 
      bool fromMigrate) 
        
      void logOps(OperationContext* txn, 
      const char* opstr, 
      const NamespaceString& nss, 
      std::vector<BSONObj>::const_iterator begin, 
      std::vector<BSONObj>::const_iterator end, 
      bool fromMigrate)

      but for secondary ,it returned early because of oplog Disabled. 

      So because _localOplogCollection = NULL , when secondary update _lastCommittedOpTime , it cann't signal OplogWaiters.

            Assignee:
            backlog-server-repl [DO NOT USE] Backlog - Replication Team
            Reporter:
            lpc FirstName lipengchong
            Votes:
            1 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved: