You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2019/05/01 18:25:26 UTC

[couchdb] branch master updated: Fix full ring assertion in fabric stream shard replacements

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 3c958a9  Fix full ring assertion in fabric stream shard replacements
3c958a9 is described below

commit 3c958a96488630506d3e847b38ba9bb744632655
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Wed May 1 02:29:55 2019 -0400

    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.
---
 src/fabric/src/fabric_streams.erl | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/fabric/src/fabric_streams.erl b/src/fabric/src/fabric_streams.erl
index d0a549d..59c8b8a 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,