eiri commented on a change in pull request #626: Also enable node decom using
string "true"
URL: https://github.com/apache/couchdb/pull/626#discussion_r125319609
##########
File path: src/mem3/src/mem3.erl
##########
@@ -249,7 +249,10 @@ range(<<"shards/", Start:8/binary, "-", End:8/binary,
"/", _/binary>>) ->
httpd_util:hexlist_to_integer(binary_to_list(End))].
allowed_nodes() ->
- [Node || Node <- mem3:nodes(), mem3:node_info(Node, <<"decom">>) =/= true].
+ lists:filter(fun(Node) ->
+ Decom = mem3:node_info(Node, <<"decom">>),
+ (Decom =/= true) and (Decom =/= <<"true">>)
Review comment:
Right. A bit of the details here: `and` is a boolean operator with both
parts always evaluated and strictly speaking it's not intended for control,
while `andalso` is syntax sugar control's short-circuit which compiler expands
to nested `case` clause, so it's natural it used more in conditionals.
Essentially it is the same as writing `Decom /= true, Decom /= <<"true">>` just
in more user-friendly manner.
Basically I agree with @nickva, it's a minor nit, but `andalso` is more
fitting here.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services