WIP: giant hairball 12

This commit is contained in:
Scott Lystig Fritchie 2015-06-29 16:42:05 +09:00
parent b25ab3b7ac
commit 7aff9fca70
4 changed files with 33 additions and 10 deletions

View file

@ -424,8 +424,9 @@ message Mpb_LL_WedgeStatusReq {
}
message Mpb_LL_WedgeStatusResp {
required Mpb_EpochID epoch_id = 1;
required uint32 wedged_flag = 2;
required Mpb_GeneralStatusCode status = 1;
optional Mpb_EpochID epoch_id = 2;
optional uint32 wedged_flag = 3;
}
// Low level API: delete_migration()

View file

@ -327,6 +327,10 @@ do_pb_ll_request(PB_request, S) ->
%% Skip wedge check for projection commands!
{Rs, NewS} = do_pb_ll_request3(CMD, S),
{RqID, CMD, Rs, NewS};
{RqID, {low_wedge_status, _}=CMD} ->
%% Skip wedge check for low_wedge_status!
{Rs, NewS} = do_pb_ll_request3(CMD, S),
{RqID, CMD, Rs, NewS};
{RqID, CMD} ->
EpochID = element(2, CMD), % by common convention
{Rs, NewS} = do_pb_ll_request2(EpochID, CMD, S),
@ -642,7 +646,12 @@ do_pb_server_list_files(#state{data_dir=DataDir}=_S) ->
end || File <- Files]}.
do_pb_server_wedge_status(S) ->
{Wedged_p, CurrentEpochID} = ets:lookup_element(S#state.etstab, epoch, 2),
{Wedged_p, CurrentEpochID0} = ets:lookup_element(S#state.etstab, epoch, 2),
CurrentEpochID = if CurrentEpochID0 == undefined ->
?DUMMY_PV1_EPOCH;
true ->
CurrentEpochID0
end,
{Wedged_p, CurrentEpochID}.
do_pb_server_delete_migration(File, #state{data_dir=DataDir}=_S) ->

View file

@ -638,7 +638,7 @@ io:format(user, "\nCCC Req ~p\n", [Req]),
catch
throw:Error ->
put(bad_sock, Sock),
Error;
filter_sock_error_result(Error);
error:{case_clause,_}=Noo ->
put(bad_sock, Sock),
{error, {badmatch, Noo, erlang:get_stacktrace()}};
@ -647,6 +647,11 @@ io:format(user, "\nCCC Req ~p\n", [Req]),
{error, {badmatch, BadMatch, erlang:get_stacktrace()}}
end.
filter_sock_error_result({error, closed}) ->
{error, partition};
filter_sock_error_result(Error) ->
Error.
%%%%%%%%%%%%%%%%%%%%%%%%%%%
w_connect(#p_srvr{proto_mod=?MODULE, address=Host, port=Port, props=Props})->

View file

@ -480,12 +480,20 @@ to_pb_response(ReqID, {low_list_files, _EpochID}, Resp) ->
make_ll_error_resp(ReqID, 66, io_lib:format("err ~p", [_Else]))
end;
to_pb_response(ReqID, {low_wedge_status, _BogusEpochID}, Resp) ->
{Wedged_p, EpochID} = Resp,
case Resp of
{error, _}=Error ->
Status = conv_from_status(Error),
#mpb_ll_response{req_id=ReqID,
wedge_status=#mpb_ll_wedgestatusresp{status=Error}};
{Wedged_p, EpochID} ->
PB_Wedged = conv_from_boolean(Wedged_p),
PB_EpochID = conv_from_epoch_id(EpochID),
#mpb_ll_response{req_id=ReqID,
wedge_status=#mpb_ll_wedgestatusresp{epoch_id=PB_EpochID,
wedged_flag=PB_Wedged}};
wedge_status=#mpb_ll_wedgestatusresp{
status='OK',
epoch_id=PB_EpochID,
wedged_flag=PB_Wedged}}
end;
to_pb_response(ReqID, {low_delete_migration, _EID, _Fl}, Resp)->
Status = conv_from_status(Resp),
#mpb_ll_response{req_id=ReqID,