diff --git a/src/ra.erl b/src/ra.erl index a6817635..14dc9477 100644 --- a/src/ra.erl +++ b/src/ra.erl @@ -59,8 +59,6 @@ %% membership changes add_member/2, add_member/3, - maybe_add_member/2, - maybe_add_member/3, remove_member/2, remove_member/3, leave_and_terminate/3, @@ -572,23 +570,20 @@ add_member(ServerLoc, ServerId) -> %% @see add_member/2 %% @end -spec add_member(ra_server_id() | [ra_server_id()], - ra_server_id(), timeout()) -> + ra_server_id() | {maybe, ra_server_id()}, + timeout()) -> ra_cmd_ret() | {error, already_member} | {error, cluster_change_not_permitted}. +add_member(ServerLoc, {maybe, ServerId}, Timeout) -> + ra_server_proc:command(ServerLoc, + {'$ra_maybe_join', ServerId, after_log_append}, + Timeout); add_member(ServerLoc, ServerId, Timeout) -> ra_server_proc:command(ServerLoc, {'$ra_join', ServerId, after_log_append}, Timeout). -maybe_add_member(ServerLoc, ServerId) -> - maybe_add_member(ServerLoc, ServerId, ?DEFAULT_TIMEOUT). -maybe_add_member(ServerLoc, ServerId, Timeout) -> - ra_server_proc:command(ServerLoc, - {'$ra_maybe_join', ServerId, after_log_append}, - Timeout). - - %% @doc Removes a server from the cluster's membership configuration. %% This function returns after appending a cluster membership change %% command to the log. diff --git a/test/ra_voter_SUITE.erl b/test/ra_voter_SUITE.erl index 1c5ae2d2..363612f6 100644 --- a/test/ra_voter_SUITE.erl +++ b/test/ra_voter_SUITE.erl @@ -102,7 +102,7 @@ start_and_join({ClusterName, _} = ServerRef, {_, _} = New) -> ok. start_and_maybe_join({ClusterName, _} = ServerRef, {_, _} = New) -> - {ok, _, _} = ra:maybe_add_member(ServerRef, New), + {ok, _, _} = ra:add_member(ServerRef, {maybe, New}), ok = ra:start_server(default, ClusterName, New, add_machine(), [ServerRef]), ok.