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

Prevent import cfg startup races

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.8.0
    • 3.0
    • SyncGateway
    • Security Level: Public
    • None
    • CBG Sprint 64
    • 3

    Description

      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

      Attachments

        Issue Links

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

          Activity

            There are no commits yet on this issue.

            People

              adamf Adam Fraser
              adamf Adam Fraser
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty