Fix epoch checking in eunit tests and enforcement by FLU (always permit list_files())
This commit is contained in:
parent
38c1a2ab5d
commit
da3a56dd74
2 changed files with 8 additions and 7 deletions
|
@ -342,12 +342,11 @@ do_pb_ll_request(PB_request, S) ->
|
||||||
Req = machi_pb_translate:from_pb_request(PB_request),
|
Req = machi_pb_translate:from_pb_request(PB_request),
|
||||||
{ReqID, Cmd, Result, S2} =
|
{ReqID, Cmd, Result, S2} =
|
||||||
case Req of
|
case Req of
|
||||||
{RqID, {low_proj, _}=CMD} ->
|
{RqID, {LowCmd, _}=CMD}
|
||||||
|
when LowCmd == low_proj;
|
||||||
|
LowCmd == low_wedge_status; LowCmd == low_list_files ->
|
||||||
%% Skip wedge check for projection commands!
|
%% Skip wedge check for projection commands!
|
||||||
{Rs, NewS} = do_pb_ll_request3(CMD, S),
|
%% Skip wedge check for these unprivileged commands
|
||||||
{RqID, CMD, Rs, NewS};
|
|
||||||
{RqID, {low_wedge_status, _}=CMD} ->
|
|
||||||
%% Skip wedge check for low_wedge_status!
|
|
||||||
{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, CMD} ->
|
{RqID, CMD} ->
|
||||||
|
@ -361,7 +360,7 @@ do_pb_ll_request2(EpochID, CMD, S) ->
|
||||||
{Wedged_p, CurrentEpochID} = ets:lookup_element(S#state.etstab, epoch, 2),
|
{Wedged_p, CurrentEpochID} = ets:lookup_element(S#state.etstab, epoch, 2),
|
||||||
if Wedged_p == true ->
|
if Wedged_p == true ->
|
||||||
{{error, wedged}, S};
|
{{error, wedged}, S};
|
||||||
not ((not is_tuple(EpochID)) orelse EpochID == ?DUMMY_PV1_EPOCH)
|
is_tuple(EpochID)
|
||||||
andalso
|
andalso
|
||||||
EpochID /= CurrentEpochID ->
|
EpochID /= CurrentEpochID ->
|
||||||
{Epoch, _} = EpochID,
|
{Epoch, _} = EpochID,
|
||||||
|
@ -946,6 +945,7 @@ encode_csum_file_entry_bin(Offset, Size, TaggedCSum) ->
|
||||||
%% `?CSUM_TAG_NONE'.
|
%% `?CSUM_TAG_NONE'.
|
||||||
|
|
||||||
-spec decode_csum_file_entry(binary()) ->
|
-spec decode_csum_file_entry(binary()) ->
|
||||||
|
error |
|
||||||
{machi_dt:file_offset(), machi_dt:chunk_size(), machi_dt:chunk_s()}.
|
{machi_dt:file_offset(), machi_dt:chunk_size(), machi_dt:chunk_s()}.
|
||||||
decode_csum_file_entry(<<_:8/unsigned-big, Offset:64/unsigned-big, Size:32/unsigned-big, TaggedCSum/binary>>) ->
|
decode_csum_file_entry(<<_:8/unsigned-big, Offset:64/unsigned-big, Size:32/unsigned-big, TaggedCSum/binary>>) ->
|
||||||
{Offset, Size, TaggedCSum};
|
{Offset, Size, TaggedCSum};
|
||||||
|
|
|
@ -147,7 +147,8 @@ partial_stop_restart2() ->
|
||||||
<<>>, 99999999, 1),
|
<<>>, 99999999, 1),
|
||||||
{error, wedged} = machi_flu1_client:checksum_list(
|
{error, wedged} = machi_flu1_client:checksum_list(
|
||||||
Addr_a, TcpPort_a, ?DUMMY_PV1_EPOCH, <<>>),
|
Addr_a, TcpPort_a, ?DUMMY_PV1_EPOCH, <<>>),
|
||||||
{error, wedged} = machi_flu1_client:list_files(
|
%% list_files() is permitted despite wedged status
|
||||||
|
{ok, _} = machi_flu1_client:list_files(
|
||||||
Addr_a, TcpPort_a, ?DUMMY_PV1_EPOCH),
|
Addr_a, TcpPort_a, ?DUMMY_PV1_EPOCH),
|
||||||
|
|
||||||
%% Iterate through humming consensus once
|
%% Iterate through humming consensus once
|
||||||
|
|
Loading…
Reference in a new issue