Details
-
Bug
-
Resolution: Unresolved
-
Critical
-
2.1.1
-
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.
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; |
}
|
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