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

CouchbaseServerVersion should use clusterCompatibility version

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Critical
    • 2.6.0
    • 2.1.1
    • SyncGateway
    • Security Level: Public
    • None
    • CBG Sprint 13, CBG Sprint 15, CBG Sprint 16, CBG Sprint 17, CBG Sprint 18
    • 3

    Description

      CouchbaseServerVersion() naively picks the first server version it encounters, however in a mid-upgrade scenario, nodes in the cluster have different versions, and the cluster as a whole is only upgraded when all nodes are running on the same later version.

      https://github.com/couchbase/sync_gateway/blob/3e536e5f7e66ab893ff47a02673182c628292786/base/bucket_gocb.go#L2253-L2257

      cluster_compat_version is a encoded cluster-wide version number which reflects the Couchbase version of the entire cluster. This version is already used by other services determine feature compatibility, and seems cheaper to decode the major/minor versions from it than parsing the string formatted version.

      function encodeCompatVersion(major, minor) {
         if (major < 2) {
           return 1;
         }
         return major * 0x10000 + minor;
      }
      

      http://src.couchbase.org/source/xref/6.0.0/ns_server/priv/public/ui/app-new/admin/mn-admin-service.js#encodeCompatVersion

      We can get this out of the REST API at /pools/default or at /pools/default/buckets/:bucketName: (see attachment)

      Prior art: goxdcr uses it for feature detection seen here:
      https://github.com/couchbase/goxdcr/blob/e57c61b95f7a436b105a7592e978fe7a66d1f49e/utils/utils.go#L1318-L1336

      https://github.com/couchbase/goxdcr/blob/e57c61b95f7a436b105a7592e978fe7a66d1f49e/base/simple_utils.go#L432-L450

      Attachments

        Issue Links

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

          Activity

            People

              jacques.rascagneres Jacques Rascagneres
              ben.brooks Ben Brooks
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty