Bug fixes found during testing runs

This commit is contained in:
Mark Allen 2015-10-08 15:46:40 -05:00
parent 1ecbb5cffe
commit aca3759e45

View file

@ -504,8 +504,8 @@ do_server_append_chunk2(_PKey, Prefix, Chunk, CSum_tag, Client_CSum,
%% TODO: Do anything with PKey? %% TODO: Do anything with PKey?
try try
TaggedCSum = check_or_make_tagged_checksum(CSum_tag, Client_CSum,Chunk), TaggedCSum = check_or_make_tagged_checksum(CSum_tag, Client_CSum,Chunk),
FluName ! {seq_append, self(), Prefix, Chunk, TaggedCSum, R = {seq_append, self(), Prefix, Chunk, TaggedCSum, ChunkExtra, EpochID},
ChunkExtra, EpochID}, FluName ! R,
receive receive
{assignment, Offset, File} -> {assignment, Offset, File} ->
Size = iolist_size(Chunk), Size = iolist_size(Chunk),
@ -540,7 +540,13 @@ do_server_read_chunk(File, Offset, Size, _Opts, #state{flu_name=FluName})->
case sanitize_file_string(File) of case sanitize_file_string(File) of
ok -> ok ->
{ok, Pid} = machi_flu_metadata_mgr:start_proxy_pid(FluName, {file, File}), {ok, Pid} = machi_flu_metadata_mgr:start_proxy_pid(FluName, {file, File}),
machi_file_proxy:read(Pid, Offset, Size); case machi_file_proxy:read(Pid, Offset, Size) of
%% XXX FIXME
%% For now we are omiting the checksum data because it blows up
%% protobufs.
{ok, Data, _Csum} -> {ok, Data};
Other -> Other
end;
_ -> _ ->
{error, bad_arg} {error, bad_arg}
end. end.
@ -643,11 +649,12 @@ append_server_dispatch(From, Prefix, Chunk, CSum, Extra, FluName) ->
handle_append(_Prefix, <<>>, _Csum, _Extra, _FluName) -> handle_append(_Prefix, <<>>, _Csum, _Extra, _FluName) ->
{error, bad_arg}; {error, bad_arg};
handle_append(Prefix, Chunk, Csum, Extra, FluName) -> handle_append(Prefix, Chunk, Csum, Extra, FluName) ->
case machi_flu_filename_mgr:find_or_make_filename_from_prefix({prefix, Prefix}) of Res = machi_flu_filename_mgr:find_or_make_filename_from_prefix(FluName, {prefix, Prefix}),
case Res of
{file, F} -> {file, F} ->
{ok, Pid} = machi_flu_metadata_mgr:start_proxy_pid(FluName, {file, F}), {ok, Pid} = machi_flu_metadata_mgr:start_proxy_pid(FluName, {file, F}),
{Tag, Csum} = machi_util:unmake_tagged_csum(Csum), {Tag, CS} = machi_util:unmake_tagged_csum(Csum),
Meta = [{client_csum_tag, Tag}, {client_csum, Csum}], Meta = [{client_csum_tag, Tag}, {client_csum, CS}],
machi_file_proxy:append(Pid, Meta, Extra, Chunk); machi_file_proxy:append(Pid, Meta, Extra, Chunk);
Error -> Error ->
Error Error
@ -663,7 +670,7 @@ sanitize_file_string(Str) ->
sanitize_prefix(Prefix) -> sanitize_prefix(Prefix) ->
%% We are using '^' as our component delimiter %% We are using '^' as our component delimiter
case re:run(Prefix, "^|/") of case re:run(Prefix, "/|\\^") of
nomatch -> nomatch ->
ok; ok;
_ -> _ ->
@ -681,7 +688,7 @@ sync_checksum_file(FluName, File) ->
case machi_flu_metadata_mgr:lookup_proxy_pid(FluName, {file, File}) of case machi_flu_metadata_mgr:lookup_proxy_pid(FluName, {file, File}) of
undefined -> undefined ->
ok; ok;
{ok, Pid} -> Pid ->
machi_file_proxy:sync(Pid, csum) machi_file_proxy:sync(Pid, csum)
end. end.