Uploaded image for project: 'Couchbase Gateway'
  1. Couchbase Gateway
  2. CBG-1234

[2.8.1 Backport] CBG-1231 - Prevent import cfg startup races



    • Bug
    • Resolution: Fixed
    • Major
    • 2.8.1
    • 2.8.0
    • SyncGateway
    • Security Level: Public
    • None
    • CBG Sprint 65
    • 1


      The import DCP feed (run by cbgt) manages its cfg with a CfgSg instance, which stores the cfg files as documents in the database's backing bucket.  CfgSg uses the caching DCP feed to subscribe to changes to those files.

      Starting the import DCP feed before the caching DCP feed can result in missed notifications about cfg changes, as the caching DCP feed starts from the high vbseq values. 

      In addition, the heartbeater may triggers changes to the import's cfg files when checking for stale heartbeats (which by default occurs for the first time 2s after the heartbeater is initialized).  If the cfg change triggered by stale heartbeat detection occurs before the caching DCP feed is started, cbgt won't be notified of the change to remove the stale node.

      Two changes should be made during databaseContext creation:

      • start the caching DCP feed prior to the import DCP feed
      • move heartbeater.StartCheckingHeartbeats to the end of dbContext initialization, to ensure all other components are initialized before doing any stale node cleanup.  Note that StartSendingHeartbeats still needs to be called prior to cfg initialization, at the start of NewDatabaseContext, so this will require splitting heartbeater.Start into two separate functions


        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.



              adamf Adam Fraser
              adamf Adam Fraser
              0 Vote for this issue
              1 Start watching this issue



                Gerrit Reviews

                  There are no open Gerrit changes