mirror of
https://github.com/valitydev/riak_test.git
synced 2024-11-06 00:25:22 +00:00
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:
parent
cb235be64d
commit
3818690d31
@ -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 =/= [] ->
|
||||
|
Loading…
Reference in New Issue
Block a user