summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Vatamaniuc <vatamane@apache.org>2019-05-01 02:29:55 -0400
committerNick Vatamaniuc <nickva@users.noreply.github.com>2019-05-01 14:25:21 -0400
commit3c958a96488630506d3e847b38ba9bb744632655 (patch)
tree6d71f02e66b13e0c6502e94b5cf553cf21d16595
parent762d7a81416d07ab2f9a7f7091376376075578c0 (diff)
downloadcouchdb-3c958a96488630506d3e847b38ba9bb744632655.tar.gz
Fix full ring assertion in fabric stream shard replacements
In fabric streams logic, after replacements are processed, the full ring assertion was made for the waiting and replaced workers. But, in cases when some of the workers already returned results, the assertion would fail, since those ranges would be missing. The fix is to consider not just waiting and replaced workers, but also the results that were already processed.
-rw-r--r--src/fabric/src/fabric_streams.erl9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/fabric/src/fabric_streams.erl b/src/fabric/src/fabric_streams.erl
index d0a549d6e..59c8b8a6b 100644
--- a/src/fabric/src/fabric_streams.erl
+++ b/src/fabric/src/fabric_streams.erl
@@ -106,8 +106,13 @@ handle_stream_start({rexi_EXIT, Reason}, Worker, St) ->
fabric_dict:store(NewWorker, waiting, NewWorkers)
end, Workers, WorkerReplacements),
% Assert that our replaced worker provides us
- % the oppurtunity to make progress.
- true = fabric_ring:is_progress_possible(FinalWorkers),
+ % the oppurtunity to make progress. Need to make sure
+ % to include already processed responses, since we are
+ % checking the full range and some workers have already
+ % responded and were removed from the workers list
+ ReadyWorkers = [{W, R} || {_, W, R} <- Ready],
+ AllWorkers = FinalWorkers ++ ReadyWorkers,
+ true = fabric_ring:is_progress_possible(AllWorkers),
NewRefs = fabric_dict:fetch_keys(FinalWorkers),
{new_refs, NewRefs, St#stream_acc{
workers=FinalWorkers,