Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CouchbaseServerVersion should use cluster_compat_version #3833

Closed
bbrks opened this issue Nov 20, 2018 · 5 comments

Comments

@bbrks
Copy link
Member

commented Nov 20, 2018

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.

for _, serverMap := range stats {
versionString = serverMap["version"]
// We only check the version of the first server, hopefully same for whole cluster
break
}

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 here, or at /pools/default/buckets/{bucketName}:

screen shot 2018-11-20 at 13 07 45

@adamcfraser

This comment has been minimized.

Copy link
Contributor

commented Nov 20, 2018

@bbrks Do you know what CBS version added support for cluster_compat_version?

@bbrks

This comment has been minimized.

@adamcfraser

This comment has been minimized.

Copy link
Contributor

commented Nov 20, 2018

@bbrks Great - just wanted to make sure it was reliable back to 4.5 at least. This change makes sense.

@JFlath

This comment has been minimized.

Copy link
Collaborator

commented Nov 22, 2018

I think it's been exposed via the REST API since CBS 1.6.4

Technically, I think that's MBS 1.6.4. So old that we were still called Membase! :D

@bbrks

This comment has been minimized.

Copy link
Member Author

commented Nov 26, 2018

Closing as this ticket is being tracked in Jira: https://issues.couchbase.com/browse/CBG-159

@bbrks bbrks closed this Nov 26, 2018

@pasin pasin removed the backlog label Nov 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.