Skip to content

Commit

Permalink
MB-60871: use Columnar version as NS_SERVER_VERSION
Browse files Browse the repository at this point in the history
- eliminate fail-fast on 1.x versions on engage cluster compatibility
  check, since Columnar version is 1.x based e.g. 1.0.0-1234-columnar
- consider -columnar version as being enterprise edition

Change-Id: Ia209d69e98d6239a814b76f5c290aeb349e99be4
Reviewed-on: https://review.couchbase.org/c/ns_server/+/207970
Reviewed-by: Chris Hillery <ceej@couchbase.com>
Reviewed-by: Michael Blow <michael.blow@couchbase.com>
Tested-by: Build Bot <build@couchbase.com>
Well-Formed: Restriction Checker
Reviewed-by: Timofey Barmin <timofey.barmin@couchbase.com>
Well-Formed: Build Bot <build@couchbase.com>
  • Loading branch information
mblow committed May 6, 2024
1 parent 46fba90 commit 41836af
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ ELSE ("${PRODUCT_VERSION}" STREQUAL "")
SET(_product_version "${PRODUCT_VERSION}")
ENDIF ("${PRODUCT_VERSION}" STREQUAL "")

IF (BUILD_ENTERPRISE)
IF (BUILD_COLUMNAR)
SET (_ns_version "${COLUMNAR_PRODUCT_VERSION}-columnar")
ELSEIF (BUILD_ENTERPRISE)
SET (_ns_version "${_product_version}-enterprise")
ELSE (BUILD_ENTERPRISE)
ELSE ()
SET (_ns_version "${_product_version}-community")
ENDIF (BUILD_ENTERPRISE)
ENDIF ()

SET (NS_SERVER_VERSION "${_ns_version}" CACHE STRING
"Couchbase server version" FORCE)
Expand Down
29 changes: 16 additions & 13 deletions src/ns_cluster.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1243,14 +1243,8 @@ check_can_add_node(NodeKVList) ->

MyCompatVersion = cluster_compat_mode:effective_cluster_compat_version(),
case JoineeClusterCompatVersion =:= MyCompatVersion of
true -> case expect_json_property_binary(<<"version">>, NodeKVList) of
<<"1.",_/binary>> = Version ->
{error, incompatible_cluster_version,
ns_error_messages:too_old_version_error(JoineeNode,
Version)};
_ ->
ok
end;
true ->
ok;
false ->
{error, incompatible_cluster_version,
ns_error_messages:incompatible_cluster_version_error(
Expand Down Expand Up @@ -1351,11 +1345,20 @@ do_engage_cluster(NodeKVList) ->
do_engage_cluster_check_compatibility(NodeKVList) ->
Version = expect_json_property_binary(<<"version">>, NodeKVList),
Node = expect_json_property_atom(<<"otpNode">>, NodeKVList),

case Version of
<<"1.",_/binary>> ->
{error, incompatible_cluster_version,
ns_error_messages:too_old_version_error(Node, Version)};
%% Prior to 7.6.2, this used to reject on a version of 1.* as too old, but
%% since the initial version of Columnar is 1.0.0, update this validation
%% to only fail if a the clusterCompatibility property is absent, to allow
%% Columnar nodes to join.
case lists:keyfind(<<"clusterCompatibility">>, 1, NodeKVList) of
false ->
case Version of
<<"1.",_/binary>> ->
{error, incompatible_cluster_version,
ns_error_messages:too_old_version_error(Node, Version)};
_ ->
erlang:exit({unexpected_json, missing_property,
<<"clusterCompatibility">>})
end;
_ ->
do_engage_cluster_check_compat_version(Node, Version, NodeKVList)
end.
Expand Down
5 changes: 3 additions & 2 deletions src/ns_config_default.erl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ get_data_dir() ->
end.

detect_enterprise_version(NsServerVersion) ->
case re:run(NsServerVersion, <<"-enterprise$">>) of
case re:run(NsServerVersion, <<"-(columnar|enterprise)$">>) of
nomatch ->
false;
_ ->
Expand Down Expand Up @@ -565,5 +565,6 @@ test_all_upgrades() ->
%% path if I use ?assert... Sucker
detect_enterprise_version_test() ->
true = detect_enterprise_version(<<"1.8.0r-9-ga083a1e-enterprise">>),
true = not detect_enterprise_version(<<"1.8.0r-9-ga083a1e-comm">>).
true = not detect_enterprise_version(<<"1.8.0r-9-ga083a1e-comm">>),
true = detect_enterprise_version(<<"1.8.0r-9-ga083a1e-columnar">>).
-endif.

0 comments on commit 41836af

Please sign in to comment.