Skip to content

Commit

Permalink
Fix dialyzer warnings
Browse files Browse the repository at this point in the history
The one in riak_repl2_fssource is a legit bug in the code
  • Loading branch information
engelsanchez committed Dec 5, 2014
1 parent aea4b42 commit c9beaa4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
24 changes: 13 additions & 11 deletions src/riak_repl2_fscoordinator.erl
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,14 @@ handle_cast(start_fullsync, State) ->

handle_cast(stop_fullsync, State) ->
% exit all running, cancel all timers, and reset the state.
[erlang:cancel_timer(Tref) || #partition_info{whereis_tref = Tref} <- State#state.whereis_waiting],
[begin
unlink(Pid),
riak_repl2_fssource:stop_fullsync(Pid),
riak_repl2_fssource_sup:disable(node(Pid), Part)
end || #partition_info{index = Part, running_source = Pid} <- State#state.running_sources],
_ = [erlang:cancel_timer(Tref) || #partition_info{whereis_tref = Tref}
<- State#state.whereis_waiting],
_ = [begin
unlink(Pid),
riak_repl2_fssource:stop_fullsync(Pid),
riak_repl2_fssource_sup:disable(node(Pid), Part)
end || #partition_info{index = Part, running_source = Pid}
<- State#state.running_sources],
State2 = State#state{
largest_n = undefined,
owners = [],
Expand Down Expand Up @@ -591,7 +593,7 @@ handle_socket_msg({location, Partition, {Node, Ip, Port}}, #state{whereis_waitin
State;
{value, PartitionInfo, Waiting2} ->
Tref = PartitionInfo#partition_info.whereis_tref,
erlang:cancel_timer(Tref),
_ = erlang:cancel_timer(Tref),
% we don't know for sure it's no longer busy until we get a busy reply
NewBusies = sets:del_element(Node, State#state.busy_nodes),
State2 = State#state{whereis_waiting = Waiting2, busy_nodes = NewBusies},
Expand All @@ -608,7 +610,7 @@ handle_socket_msg({location_busy, Partition}, #state{whereis_waiting = Waiting}
lager:info("anya Partition ~p is too busy on cluster ~p at node ~p",
[Partition, State#state.other_cluster, PartitionInfo#partition_info.node]),
Tref = PartitionInfo#partition_info.whereis_tref,
erlang:cancel_timer(Tref),
_ = erlang:cancel_timer(Tref),
State2 = State#state{whereis_waiting = Waiting2},
Partition2 = PartitionInfo#partition_info{whereis_tref = undefined},
PQueue = State2#state.partition_queue,
Expand All @@ -624,7 +626,7 @@ handle_socket_msg({location_busy, Partition, Node}, #state{whereis_waiting = Wai
{value, PartitionInfo, Waiting2} ->
lager:info("Partition ~p is too busy on cluster ~p at node ~p", [Partition, State#state.other_cluster, Node]),
Tref = PartitionInfo#partition_info.whereis_tref,
erlang:cancel_timer(Tref),
_ = erlang:cancel_timer(Tref),

State2 = State#state{whereis_waiting = Waiting2},

Expand All @@ -645,7 +647,7 @@ handle_socket_msg({location_down, Partition}, #state{whereis_waiting=Waiting} =
lager:info("Partition ~p is unavailable on cluster ~p",
[Partition, State#state.other_cluster]),
Tref = PartitionInfo#partition_info.whereis_tref,
erlang:cancel_timer(Tref),
_ = erlang:cancel_timer(Tref),
Dropped = [Partition | State#state.dropped],
#state{retry_exits = RetryExits, error_exits = ErrorExits} = State,
State2 = State#state{whereis_waiting = Waiting2, dropped = Dropped,
Expand All @@ -659,7 +661,7 @@ handle_socket_msg({location_down, Partition, _Node}, #state{whereis_waiting=Wait
State;
{value, PartitionInfo, Waiting2} ->
Tref = PartitionInfo#partition_info.whereis_tref,
erlang:cancel_timer(Tref),
_ = erlang:cancel_timer(Tref),
RetryLimit = app_helper:get_env(riak_repl, max_reserve_retries, ?DEFAULT_RESERVE_RETRIES),
lager:info("Partition ~p is unavailable on cluster ~p", [Partition, State#state.other_cluster]),
State2 = State#state{whereis_waiting = Waiting2},
Expand Down
8 changes: 3 additions & 5 deletions src/riak_repl2_fssource.erl
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,12 @@ init([Partition, IP, Owner]) ->
case connect(IP, SupportedStrategy, Partition) of
{error, Reason} ->
{stop, Reason};
Result ->
Result
{ok, State}->
{ok, State#state{owner = Owner}}
end;
{error, Reason} ->
%% the vnode is probably busy. Try again later.
{stop, Reason};
{ok, State}->
{ok, State#state{owner = Owner}}
{stop, Reason}
end.

handle_call({connected, Socket, Transport, _Endpoint, Proto, Props},
Expand Down

6 comments on commit c9beaa4

@engelsanchez
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1
r=lordnull

@borshop
Copy link
Contributor

@borshop borshop commented on c9beaa4 Dec 6, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from engelsanchez
at c9beaa4

@borshop
Copy link
Contributor

@borshop borshop commented on c9beaa4 Dec 6, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging basho/riak_repl/feature/mw/forward-port-chatty-transient-aae-fs-failures = c9beaa4 into borshop-integration-636-feature/mw/forward-port-chatty-transient-aae-fs-failures

@borshop
Copy link
Contributor

@borshop borshop commented on c9beaa4 Dec 6, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basho/riak_repl/feature/mw/forward-port-chatty-transient-aae-fs-failures = c9beaa4 merged ok, testing candidate = 236f241

@borshop
Copy link
Contributor

@borshop borshop commented on c9beaa4 Dec 6, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@borshop
Copy link
Contributor

@borshop borshop commented on c9beaa4 Dec 8, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding develop to borshop-integration-636-feature/mw/forward-port-chatty-transient-aae-fs-failures = 236f241

Please sign in to comment.