Resolve race with plan/commit.

When the plan phase fails, because of a race between adding
nodes to the cluster, don't attempt to commit or it will fail.
This commit is contained in:
Christopher Meiklejohn 2014-07-28 15:27:42 -04:00
parent cb235be64d
commit 3818690d31

View File

@ -406,9 +406,9 @@ plan_and_commit(Node) ->
{error, ring_not_ready} ->
lager:info("plan: ring not ready"),
timer:sleep(100),
maybe_wait_for_changes(Node),
plan_and_commit(Node);
{ok, _, _} ->
lager:info("plan: done"),
do_commit(Node)
end.
@ -435,6 +435,8 @@ maybe_wait_for_changes(Node) ->
Ring = get_ring(Node),
Changes = riak_core_ring:pending_changes(Ring),
Joining = riak_core_ring:members(Ring, [joining]),
lager:info("maybe_wait_for_changes, changes: ~p joining: ~p",
[Changes, Joining]),
if Changes =:= [] ->
ok;
Joining =/= [] ->