From 7ba962e9fbf67442d80144c2e8060efd4957ed70 Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Thu, 21 May 2015 15:12:46 +0900 Subject: [PATCH] Fix handling of {error, partial_read} --- README.basho_bench.md => doc/Using-Basho-Bench.md | 2 +- src/machi_cr_client.erl | 2 ++ test/machi_cr_client_test.erl | 9 ++++++--- 3 files changed, 9 insertions(+), 4 deletions(-) rename README.basho_bench.md => doc/Using-Basho-Bench.md (99%) diff --git a/README.basho_bench.md b/doc/Using-Basho-Bench.md similarity index 99% rename from README.basho_bench.md rename to doc/Using-Basho-Bench.md index 2cb8e77..63c1705 100644 --- a/README.basho_bench.md +++ b/doc/Using-Basho-Bench.md @@ -95,7 +95,7 @@ copy the output files to machine **Y** and generate the graphs there. ## Compiling the Machi source -First, clone the `basho_bench` source code, then compile it. You will +First, clone the Machi source code, then compile it. You will need Erlang/OTP version 17.x to compile. cd /some/nice/dev/place diff --git a/src/machi_cr_client.erl b/src/machi_cr_client.erl index 2ad68ad..b104b76 100644 --- a/src/machi_cr_client.erl +++ b/src/machi_cr_client.erl @@ -405,6 +405,8 @@ do_read_chunk2(File, Offset, Size, Depth, STime, {ok, BadChunk} -> exit({todo, bad_chunk_size, ?MODULE, ?LINE, File, Offset, Size, got, byte_size(BadChunk)}); + {error, partial_read}=Err -> + {reply, Err, S}; {error, Retry} when Retry == partition; Retry == bad_epoch; Retry == wedged -> do_read_chunk(File, Offset, Size, Depth, STime, S); diff --git a/test/machi_cr_client_test.erl b/test/machi_cr_client_test.erl index 3865b54..834da91 100644 --- a/test/machi_cr_client_test.erl +++ b/test/machi_cr_client_test.erl @@ -35,7 +35,7 @@ smoke_test() -> Prefix = <<"pre">>, Chunk1 = <<"yochunk">>, Host = "localhost", - PortBase = 4444, + PortBase = 64444, Os = [{ignore_stability_time, true}, {active_mode, false}], {ok,_}=machi_flu_psup:start_flu_package(a, PortBase+0, "./data.a", Os), {ok,_}=machi_flu_psup:start_flu_package(b, PortBase+1, "./data.b", Os), @@ -84,7 +84,6 @@ smoke_test() -> %% Whew ... ok, now start some damn tests. {ok, C1} = machi_cr_client:start_link([P || {_,P}<-orddict:to_list(D)]), machi_cr_client:append_chunk(C1, Prefix, Chunk1), - %% {machi_flu_psup:stop_flu_package(c), timer:sleep(50)}, {ok, {Off1,Size1,File1}} = machi_cr_client:append_chunk(C1, Prefix, Chunk1), {ok, Chunk1} = machi_cr_client:read_chunk(C1, File1, Off1, Size1), @@ -119,7 +118,11 @@ smoke_test() -> Host, PortBase+X, EpochID, File1, FooOff2, Size2)} || X <- [0,1,2] ], - %% Misc API smoke + %% Misc API smoke & minor regression checks + {error, not_written} = machi_cr_client:read_chunk(C1, <<"no">>, + 999999999, 1), + {error, partial_read} = machi_cr_client:read_chunk(C1, File1, + Off1, 88888888), %% Checksum lists are 3-tuples {ok, [{_,_,_}|_]} = machi_cr_client:checksum_list(C1, File1), {error, no_such_file} = machi_cr_client:checksum_list(C1, <<"!!!!">>),