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

            adamf Adam Fraser created issue -
            adamf Adam Fraser made changes -
            Field Original Value New Value
            Required Mobile Fields Mandatory:
             - CBL / SG Version:
               - SG Config:
             - Steps to Reproduce:
             - Actual Result:
             - Expected Result:
             - Logs :
                  SGW LOGS: sgcollect info
                  CBL LOGS:
                  Logcat LOGS: for Android tickets
             - Github link for the code:
             - Jenkins job failure link:
             - Pytest Command
             - What is the last build this test passed:
            adamf Adam Fraser made changes -
            Link This issue is cloned by CBG-1234 [ CBG-1234 ]
            adamf Adam Fraser made changes -
            Assignee The One [ the one ] Adam Fraser [ adamf ]
            adamf Adam Fraser made changes -
            Sprint CBG Sprint 64 [ 1367 ]
            adamf Adam Fraser made changes -
            Rank Ranked lower
            adamf Adam Fraser made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            Automated transition triggered when Adam Fraser created pull request #4903 in GitHub -
            Status In Progress [ 3 ] In Review [ 10107 ]

            Build sync_gateway-3.0.0-97 contains sync_gateway commit a9e22a1 with commit message:
            CBG-1231 Avoid DCP and cfg race on database start (#4903)

            build-team Couchbase Build Team added a comment - Build sync_gateway-3.0.0-97 contains sync_gateway commit a9e22a1 with commit message: CBG-1231 Avoid DCP and cfg race on database start (#4903)
            Automated transition triggered when Ben Brooks merged pull request #4903 in GitHub -
            Resolution Fixed [ 1 ]
            Status In Review [ 10107 ] Resolved [ 5 ]
            adamf Adam Fraser made changes -
            Status Resolved [ 5 ] Closed [ 6 ]

            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