summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Vatamaniuc <vatamane@apache.org>2022-02-03 23:46:08 -0500
committerNick Vatamaniuc <nickva@users.noreply.github.com>2022-02-11 17:55:51 -0500
commit81fe821496259718c91bb9554dbbb7d6a8988712 (patch)
tree6c3252574bc2a90c007b50bab88d875ce1aa584d
parentf3d4c9f36c03c680ade9d0d8925394eed2d4ac08 (diff)
downloadcouchdb-81fe821496259718c91bb9554dbbb7d6a8988712.tar.gz
Return the opaque collator version from _node/*/_versions
We already return the collation algorithm version and the libicu library version, but since we're tracking the opaque collator versions in the view, it is beneficial to show that to the user as well. Thanks to Will Young for the idea [1] [1] https://lists.apache.org/thread/rqfwrt4kszz79l3wxxtg6zwygz6my8p2
-rw-r--r--src/chttpd/src/chttpd_node.erl13
-rw-r--r--src/couch/src/couch_util.erl9
2 files changed, 13 insertions, 9 deletions
diff --git a/src/chttpd/src/chttpd_node.erl b/src/chttpd/src/chttpd_node.erl
index 63a7fb1fc..cc3370a73 100644
--- a/src/chttpd/src/chttpd_node.erl
+++ b/src/chttpd/src/chttpd_node.erl
@@ -41,12 +41,14 @@ handle_node_req(#httpd{path_parts = [A, <<"_local">> | Rest]} = Req) ->
handle_node_req(#httpd{method = 'GET', path_parts = [_, _Node, <<"_versions">>]} = Req) ->
IcuVer = couch_ejson_compare:get_icu_version(),
UcaVer = couch_ejson_compare:get_uca_version(),
+ ColVer = couch_ejson_compare:get_collator_version(),
send_json(Req, 200, #{
erlang_version => ?l2b(?COUCHDB_ERLANG_VERSION),
collation_driver => #{
name => <<"libicu">>,
- library_version => version_tuple_to_str(IcuVer),
- collation_algorithm_version => version_tuple_to_str(UcaVer)
+ library_version => couch_util:version_to_binary(IcuVer),
+ collation_algorithm_version => couch_util:version_to_binary(UcaVer),
+ collator_version => couch_util:version_to_binary(ColVer)
},
javascript_engine => #{
name => <<"spidermonkey">>,
@@ -381,10 +383,3 @@ run_queues() ->
[DCQ | SQs] = lists:reverse(statistics(run_queue_lengths)),
{lists:sum(SQs), DCQ}
end.
-
-version_tuple_to_str(Version) when is_tuple(Version) ->
- List1 = tuple_to_list(Version),
- IsZero = fun(N) -> N == 0 end,
- List2 = lists:reverse(lists:dropwhile(IsZero, lists:reverse(List1))),
- List3 = [erlang:integer_to_list(N) || N <- List2],
- ?l2b(lists:join(".", List3)).
diff --git a/src/couch/src/couch_util.erl b/src/couch/src/couch_util.erl
index b7a6ad39a..f942b708c 100644
--- a/src/couch/src/couch_util.erl
+++ b/src/couch/src/couch_util.erl
@@ -42,6 +42,7 @@
-export([set_mqd_off_heap/1]).
-export([set_process_priority/2]).
-export([hmac/3]).
+-export([version_to_binary/1]).
-include_lib("couch/include/couch_db.hrl").
@@ -805,3 +806,11 @@ hmac(Alg, Key, Message) ->
% -ifdef(OTP_RELEASE)
-endif.
+
+version_to_binary(Ver) when is_tuple(Ver) ->
+ version_to_binary(tuple_to_list(Ver));
+version_to_binary(Ver) when is_list(Ver) ->
+ IsZero = fun(N) -> N == 0 end,
+ Ver1 = lists:reverse(lists:dropwhile(IsZero, lists:reverse(Ver))),
+ Ver2 = [erlang:integer_to_list(N) || N <- Ver1],
+ ?l2b(lists:join(".", Ver2)).