WIP: giant hairball 12
This commit is contained in:
parent
b25ab3b7ac
commit
7aff9fca70
4 changed files with 33 additions and 10 deletions
|
@ -424,8 +424,9 @@ message Mpb_LL_WedgeStatusReq {
|
||||||
}
|
}
|
||||||
|
|
||||||
message Mpb_LL_WedgeStatusResp {
|
message Mpb_LL_WedgeStatusResp {
|
||||||
required Mpb_EpochID epoch_id = 1;
|
required Mpb_GeneralStatusCode status = 1;
|
||||||
required uint32 wedged_flag = 2;
|
optional Mpb_EpochID epoch_id = 2;
|
||||||
|
optional uint32 wedged_flag = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Low level API: delete_migration()
|
// Low level API: delete_migration()
|
||||||
|
|
|
@ -327,6 +327,10 @@ do_pb_ll_request(PB_request, S) ->
|
||||||
%% Skip wedge check for projection commands!
|
%% Skip wedge check for projection commands!
|
||||||
{Rs, NewS} = do_pb_ll_request3(CMD, S),
|
{Rs, NewS} = do_pb_ll_request3(CMD, S),
|
||||||
{RqID, CMD, Rs, NewS};
|
{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} ->
|
{RqID, CMD} ->
|
||||||
EpochID = element(2, CMD), % by common convention
|
EpochID = element(2, CMD), % by common convention
|
||||||
{Rs, NewS} = do_pb_ll_request2(EpochID, CMD, S),
|
{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]}.
|
end || File <- Files]}.
|
||||||
|
|
||||||
do_pb_server_wedge_status(S) ->
|
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}.
|
{Wedged_p, CurrentEpochID}.
|
||||||
|
|
||||||
do_pb_server_delete_migration(File, #state{data_dir=DataDir}=_S) ->
|
do_pb_server_delete_migration(File, #state{data_dir=DataDir}=_S) ->
|
||||||
|
|
|
@ -638,7 +638,7 @@ io:format(user, "\nCCC Req ~p\n", [Req]),
|
||||||
catch
|
catch
|
||||||
throw:Error ->
|
throw:Error ->
|
||||||
put(bad_sock, Sock),
|
put(bad_sock, Sock),
|
||||||
Error;
|
filter_sock_error_result(Error);
|
||||||
error:{case_clause,_}=Noo ->
|
error:{case_clause,_}=Noo ->
|
||||||
put(bad_sock, Sock),
|
put(bad_sock, Sock),
|
||||||
{error, {badmatch, Noo, erlang:get_stacktrace()}};
|
{error, {badmatch, Noo, erlang:get_stacktrace()}};
|
||||||
|
@ -647,6 +647,11 @@ io:format(user, "\nCCC Req ~p\n", [Req]),
|
||||||
{error, {badmatch, BadMatch, erlang:get_stacktrace()}}
|
{error, {badmatch, BadMatch, erlang:get_stacktrace()}}
|
||||||
end.
|
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})->
|
w_connect(#p_srvr{proto_mod=?MODULE, address=Host, port=Port, props=Props})->
|
||||||
|
|
|
@ -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]))
|
make_ll_error_resp(ReqID, 66, io_lib:format("err ~p", [_Else]))
|
||||||
end;
|
end;
|
||||||
to_pb_response(ReqID, {low_wedge_status, _BogusEpochID}, Resp) ->
|
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_Wedged = conv_from_boolean(Wedged_p),
|
||||||
PB_EpochID = conv_from_epoch_id(EpochID),
|
PB_EpochID = conv_from_epoch_id(EpochID),
|
||||||
#mpb_ll_response{req_id=ReqID,
|
#mpb_ll_response{req_id=ReqID,
|
||||||
wedge_status=#mpb_ll_wedgestatusresp{epoch_id=PB_EpochID,
|
wedge_status=#mpb_ll_wedgestatusresp{
|
||||||
wedged_flag=PB_Wedged}};
|
status='OK',
|
||||||
|
epoch_id=PB_EpochID,
|
||||||
|
wedged_flag=PB_Wedged}}
|
||||||
|
end;
|
||||||
to_pb_response(ReqID, {low_delete_migration, _EID, _Fl}, Resp)->
|
to_pb_response(ReqID, {low_delete_migration, _EID, _Fl}, Resp)->
|
||||||
Status = conv_from_status(Resp),
|
Status = conv_from_status(Resp),
|
||||||
#mpb_ll_response{req_id=ReqID,
|
#mpb_ll_response{req_id=ReqID,
|
||||||
|
|
Loading…
Reference in a new issue