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

Maintain long-lived bucket connections for persistent config

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 3.1.0
    • None
    • SyncGateway
    • Security Level: Public
    • CBG Sprint 107
    • 3

    Description

      Overview

      Sync Gateway's ServerContext contains a reference to a "BootstrapConnection" interface, which has 4 methods:

      • List available buckets
      • Get, Insert, and Update a database config within a given bucket

      The current persistent config implementation (CouchbaseCluster) opens a new SDK connection for each operation it does (list buckets, get config, etc.)
      This was to work around an issue where a single SDK connection cannot operate on different buckets, but is too expensive to open for each operation we do (~2 seconds)

      Proposed implementation

      At a high-level, we should make the implementation initialize connections for a) the cluster (to list buckets), and b) for each bucket we find/use.

      We need to handle the cases where:

      • buckets are dropped or added to the server whilst this code is still running
        • We can probably do this by making "GetConfigBuckets" add/remove connections to buckets based on the list returned
      • the connection is dropped, due to a network blip
        • It might be that on an error, we retry, or we just log about it, remove the now invalid connection reference, and let the code re-initialize it

      We don't need to consider using these bucket connections for other SG database operations, as those can use different authentication credentials than the bootstrap/config process.

      Acceptance criteria

      Functionality remains the same.
      As a side-effect, persistent config loads are quicker as they do not need to set up an entirely new SDK connection every time...

      Handles the above exceptional cases gracefully (bucket added/removed, connection drops) without needing to restart SG

      Attachments

        Issue Links

          Activity

            People

              adamf Adam Fraser
              ben.brooks Ben Brooks
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                PagerDuty