cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ifesdjeen <...@git.apache.org>
Subject [GitHub] cassandra pull request #257: Allow transient range owner to serve as repair ...
Date Thu, 06 Sep 2018 20:59:44 GMT
Github user ifesdjeen commented on a diff in the pull request:

    https://github.com/apache/cassandra/pull/257#discussion_r215776645
  
    --- Diff: src/java/org/apache/cassandra/repair/RepairJob.java ---
    @@ -165,107 +166,116 @@ private boolean isTransient(InetAddressAndPort ep)
             return session.commonRange.transEndpoints.contains(ep);
         }
     
    -    private AsyncFunction<List<TreeResponse>, List<SyncStat>> standardSyncing()
    +    private ListenableFuture<List<SyncStat>> standardSyncing(List<TreeResponse>
trees)
         {
    -        return trees ->
    -        {
    -            InetAddressAndPort local = FBUtilities.getLocalAddressAndPort();
    +        InetAddressAndPort local = FBUtilities.getLocalAddressAndPort();
     
    -            List<AbstractSyncTask> syncTasks = new ArrayList<>();
    -            // We need to difference all trees one against another
    -            for (int i = 0; i < trees.size() - 1; ++i)
    +        List<AbstractSyncTask> syncTasks = new ArrayList<>();
    +        // We need to difference all trees one against another
    +        for (int i = 0; i < trees.size() - 1; ++i)
    +        {
    +            TreeResponse r1 = trees.get(i);
    +            for (int j = i + 1; j < trees.size(); ++j)
                 {
    -                TreeResponse r1 = trees.get(i);
    -                for (int j = i + 1; j < trees.size(); ++j)
    +                TreeResponse r2 = trees.get(j);
    +
    +                // Avoid streming between two tansient replicas
    +                if (isTransient(r1.endpoint) && isTransient(r2.endpoint))
    +                    continue;
    +
    +                AbstractSyncTask task;
    +                if (r1.endpoint.equals(local) || r2.endpoint.equals(local))
                     {
    -                    TreeResponse r2 = trees.get(j);
    +                    TreeResponse self = r1.endpoint.equals(local) ? r1 : r2;
    +                    TreeResponse remote = r2.endpoint.equals(local) ? r1 : r2;
     
    -                    if (isTransient(r1.endpoint) && isTransient(r2.endpoint))
    +                    // pull only if local is full
    +                    boolean requestRanges = !isTransient(self.endpoint);
    +                    // push only if remote is full; additionally check for pull repair
    +                    boolean transfterRanges = !isTransient(remote.endpoint) &&
!session.pullRepair;
    --- End diff --
    
    Thanks for noticing! 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Mime
View raw message