couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vatam...@apache.org
Subject [couchdb] 01/01: Fix full ring assertion in fabric stream shard replacements
Date Wed, 01 May 2019 14:03:57 GMT
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch fix-replacements-ring-assertion-logic
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 8e57fd78e28935fa0ea59cc11953b4ab906a9517
Author: Nick Vatamaniuc <vatamane@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,


Mime
View raw message