Skip to content

Commit

Permalink
Keep original block server behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
kuenishi committed Jul 13, 2015
1 parent 24fbdc1 commit 51374e9
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/riak_cs_block_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,21 @@ do_get_block(ReplyPid, Bucket, Key, ClusterID, UseProxyGet, ProxyActive,
do_get_block(ReplyPid, Bucket, Key, ClusterID, UseProxyGet, ProxyActive,
UUID, BlockNumber, RcPid, MaxRetries, []).

do_get_block(ReplyPid, _Bucket, _Key, _ClusterID, _UseProxyGet, _ProxyActive,
UUID, BlockNumber, _RcPid, _MaxRetries, {LastReason, ErrorReasons})
when is_list(ErrorReasons) andalso is_atom(LastReason) ->
%% Not worth retrying, 'failure' comes as LastReason
Sorry = {error, ErrorReasons},
_ = lager:error("do_get_block/11 failed. Errors: ~p", [ErrorReasons]),
ok = riak_cs_get_fsm:chunk(ReplyPid, {UUID, BlockNumber}, Sorry);

do_get_block(ReplyPid, _Bucket, _Key, _ClusterID, _UseProxyGet, _ProxyActive,
UUID, BlockNumber, _RcPid, MaxRetries, ErrorReasons)
when is_list(ErrorReasons) andalso length(ErrorReasons) > MaxRetries ->
Sorry = {error, ErrorReasons},
_ = lager:error("do_get_block/11 failed. Errors: ~p", [ErrorReasons]),
ok = riak_cs_get_fsm:chunk(ReplyPid, {UUID, BlockNumber}, Sorry);

do_get_block(ReplyPid, Bucket, Key, ClusterID, UseProxyGet, ProxyActive,
UUID, BlockNumber, RcPid, MaxRetries, ErrorReasons) ->
ok = sleep_retries(length(ErrorReasons)),
Expand Down Expand Up @@ -294,7 +303,7 @@ try_local_get(RcPid, FullBucket, FullKey, GetOptions1, GetOptions2,
ProxyActive, ClusterID);
{error, Other} ->
_ = lager:error("do_get_block: other error 1: ~p\n", [Other]),
RetryFun([{local_one, Other}|ErrorReasons])
RetryFun({failure, [{local_one, Other}|ErrorReasons]})
end.

handle_local_notfound(RcPid, FullBucket, FullKey, GetOptions2,
Expand All @@ -317,16 +326,17 @@ handle_local_notfound(RcPid, FullBucket, FullKey, GetOptions2,
{ok, _} = Success ->
ProceedFun(Success);
{error, Reason} ->
RetryFun([{remote_quorum, Reason}|ErrorReasons])
RetryFun([{remote_quorum, Reason}, {local_quorum, notfound}|ErrorReasons])
end;

{error, notfound} when UseProxyGet ->
RetryFun([{local_quorum, notfound}|ErrorReasons]);
{error, notfound} ->
RetryFun([{local_quorum, notfound}|ErrorReasons]);

{error, notfound} ->
RetryFun({failure, [{local_quorum, notfound}|ErrorReasons]});
{error, Other} ->
_ = lager:error("do_get_block: other error 2: ~p\n", [Other]),
RetryFun([{local_quorum, Other}|ErrorReasons])
RetryFun({failure, [{local_quorum, Other}|ErrorReasons]})
end.

get_block_local(RcPid, FullBucket, FullKey, GetOptions, Timeout) ->
Expand Down

6 comments on commit 51374e9

@shino
Copy link
Contributor

@shino shino commented on 51374e9 Jul 13, 2015

Choose a reason for hiding this comment

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

+1

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

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

saw approval from shino
at 51374e9

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

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

merging basho/riak_cs/feature/logging-block-server-errors = 51374e9 into borshop-integration-1177-feature/logging-block-server-errors

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

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

basho/riak_cs/feature/logging-block-server-errors = 51374e9 merged ok, testing candidate = 24eba52

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

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

@borshop
Copy link
Contributor

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-1177-feature/logging-block-server-errors = 24eba52

Please sign in to comment.