Permalink
Browse files

Ensure record upgrade.

Nodes running an earlier version of Riak will return an incompatible
record, which will need to be upgrade for the application to function.
  • Loading branch information...
cmeiklejohn committed May 31, 2012
1 parent e7e94f3 commit b5c988145f23265f1acbba9bff17612b3b3cc445
Showing with 11 additions and 3 deletions.
  1. +2 −2 include/riak_control.hrl
  2. +9 −1 src/riak_control_session.erl
View
@@ -41,14 +41,14 @@
{ node :: atom(),
status :: status(),
reachable :: boolean(),
- incompatible :: boolean(),
vnodes :: [vnode()],
handoffs :: [handoff()],
ring_pct :: float(),
pending_pct :: float(),
mem_total :: integer(),
mem_used :: integer(),
- mem_erlang :: integer()
+ mem_erlang :: integer(),
+ incompatible :: boolean()
}).
%% These two should always match, in terms of webmachine dispatcher
@@ -256,7 +256,15 @@ get_member_info (_Member={Node,Status},Ring) ->
ring_pct=PctRing,
pending_pct=PctPending
};
- Member_info ->
+ %% upgrade nodes using the previous version of the record, to add
+ %% the incompatible state.
+ Member_info when is_record(Member_info, member_info, 11) ->
+ NewMemberInfo = erlang:append_element(Member_info, false),
+ NewMemberInfo#member_info{ status=Status,
+ ring_pct=PctRing,
+ pending_pct=PctPending
+ };
+ Member_info = #member_info{} ->
%% there is a race condition here, when a node is stopped
%% gracefully (e.g. `riak stop`) the event will reach us
%% before the node is actually down and the rpc call will

0 comments on commit b5c9881

Please sign in to comment.