Return 0 instead of doing another rt:sysread

Previously, wait_until_read function would execute
another rt:systest_read call and return a count of
errors, when we already asserted above that the list
is empty.

If the wait_until function does not return true, or
times out, or hits the retry limit, the running test
ought to fail anyway without needing an additional
read to fail.

So doing another call is redundant and unnecessary;
we just return 0 as the value if rt:wait_until
completes successfully.
This commit is contained in:
Mark Allen 2015-12-01 13:00:09 -06:00
parent 8a6ba3fbf5
commit 3c8dce8962

View File

@ -195,14 +195,17 @@ wait_until_fullsync_stopped(SourceLeader) ->
end). end).
wait_for_reads(Node, Start, End, Bucket, R) -> wait_for_reads(Node, Start, End, Bucket, R) ->
rt:wait_until(Node, ok = rt:wait_until(Node,
fun(_) -> fun(_) ->
Reads = rt:systest_read(Node, Start, End, Bucket, R, <<>>, true), Reads = rt:systest_read(Node, Start, End, Bucket, R, <<>>, true),
Reads == [] Reads == []
end), end),
Reads = rt:systest_read(Node, Start, End, Bucket, R, <<>>, true), %% rt:systest_read/6 returns a list of errors encountered while performing
lager:info("Reads: ~p", [Reads]), %% the requested reads. Since we are asserting this list is empty above,
length(Reads). %% we already know that if we reached here, that the list of reads has
%% no errors. Therefore, we simply return 0 and do not execute another
%% systest_read call.
0.
get_fs_coord_status_item(Node, SinkName, ItemName) -> get_fs_coord_status_item(Node, SinkName, ItemName) ->
Status = rpc:call(Node, riak_repl_console, status, [quiet]), Status = rpc:call(Node, riak_repl_console, status, [quiet]),