Fix usage of checksum_list by machi_chain_repair.erl

This commit is contained in:
Scott Lystig Fritchie 2015-07-01 15:04:22 +09:00
parent 0321e05b46
commit d710d90ea7

View file

@ -207,10 +207,15 @@ make_repair_directives(ConsistencyMode, RepairMode, File, Size, EpochID,
C0 = [begin C0 = [begin
%% erlang:garbage_collect(), %% erlang:garbage_collect(),
Proxy = orddict:fetch(FLU, ProxiesDict), Proxy = orddict:fetch(FLU, ProxiesDict),
OffSzCs = case machi_proxy_flu1_client:checksum_list( OffSzCs =
case machi_proxy_flu1_client:checksum_list(
Proxy, EpochID, File, ?LONG_TIMEOUT) of Proxy, EpochID, File, ?LONG_TIMEOUT) of
{ok, X} -> X; {ok, InfoBin} ->
{error, no_such_file} -> [] {Info, _} =
machi_flu1:split_checksum_list_blob_decode(InfoBin),
Info;
{error, no_such_file} ->
[]
end, end,
[{?MAX_OFFSET, 0, <<>>, FLU}] % our end-of-file marker [{?MAX_OFFSET, 0, <<>>, FLU}] % our end-of-file marker
++ ++
@ -313,7 +318,7 @@ execute_repair_directive({File, Cmds}, {ProxiesDict, EpochID, Verb, ETS}=Acc) ->
{in_bytes, t_in_bytes}, {out_files, t_out_files}, {in_bytes, t_in_bytes}, {out_files, t_out_files},
{out_chunks, t_out_chunks}, {out_bytes, t_out_bytes}], {out_chunks, t_out_chunks}, {out_bytes, t_out_bytes}],
[ets:insert(ETS, {L_K, 0}) || {L_K, _T_K} <- EtsKeys], [ets:insert(ETS, {L_K, 0}) || {L_K, _T_K} <- EtsKeys],
F = fun({copy, {Offset, Size, CSum, MySrc}, MyDsts}, Acc2) -> F = fun({copy, {Offset, Size, TaggedCSum, MySrc}, MyDsts}, Acc2) ->
SrcP = orddict:fetch(MySrc, ProxiesDict), SrcP = orddict:fetch(MySrc, ProxiesDict),
case ets:lookup_element(ETS, in_chunks, 2) rem 100 of case ets:lookup_element(ETS, in_chunks, 2) rem 100 of
0 -> ?VERB(".", []); 0 -> ?VERB(".", []);
@ -324,6 +329,7 @@ execute_repair_directive({File, Cmds}, {ProxiesDict, EpochID, Verb, ETS}=Acc) ->
SrcP, EpochID, File, Offset, Size, SrcP, EpochID, File, Offset, Size,
?SHORT_TIMEOUT), ?SHORT_TIMEOUT),
_T2 = os:timestamp(), _T2 = os:timestamp(),
<<_Tag:1/binary, CSum/binary>> = TaggedCSum,
case machi_util:checksum_chunk(Chunk) of case machi_util:checksum_chunk(Chunk) of
CSum_now when CSum_now == CSum -> CSum_now when CSum_now == CSum ->
[begin [begin