Skip to content

Commit

Permalink
Merge pull request #186 from basho/gh186-capability-bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jtuple committed Jun 11, 2012
2 parents 998ec1b + 41c9eb2 commit cf3fa0d
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/riak_core_capability.erl
Expand Up @@ -161,8 +161,23 @@ all() ->
%% @doc Add the local node's supported capabilities to the given
%% ring. Currently used during the `riak-admin join' process
update_ring(Ring) ->
[{_, Supported}] = ets:lookup(?ETS, '$supported'),
add_supported_to_ring(node(), Supported, Ring).
%% If a join occurs immediately after a node has started, it is
%% possible that the ETS table does not yet exist, or that the
%% '$supported' key has not yet been written. Therefore, we catch
%% any errors and return an unmodified ring.
Supported = try
[{_, Sup}] = ets:lookup(?ETS, '$supported'),
Sup
catch
_:_ ->
error
end,
case Supported of
error ->
{false, Ring};
_ ->
add_supported_to_ring(node(), Supported, Ring)
end.

%% @doc Internal callback used by `riak_core_ring_handler' to notify the
%% capability manager of a new ring
Expand Down

0 comments on commit cf3fa0d

Please sign in to comment.