Github user aweisberg commented on a diff in the pull request:

    https://github.com/apache/cassandra/pull/270#discussion_r218483495
  
    --- Diff: src/java/org/apache/cassandra/locator/ReplicaLayout.java ---
    @@ -275,7 +275,24 @@ public ForTokenWrite(EndpointsForToken natural, 
EndpointsForToken pending, Endpo
          */
         private static <E extends Endpoints<E>> E 
resolveWriteConflictsInNatural(E natural, E pending)
         {
    -        return natural.filter(r -> !r.isTransient() || 
!pending.contains(r.endpoint(), true));
    +        ReplicaCollection.Mutable<E> resolved = 
natural.newMutable(natural.size());
    +        for (Replica replica : natural)
    +        {
    +            // always prefer the full natural replica, if there is a 
conflict
    +            if (!replica.isFull())
    +            {
    +                Replica conflict = 
pending.byEndpoint().get(replica.endpoint());
    +                if (conflict != null)
    +                {
    +                    // If we have any pending transient->full movement, we 
need to move the full replica to our 'natural' bucket
    +                    // to avoid corrupting our count
    +                    if (conflict.isFull()) resolved.add(new 
Replica(replica.endpoint(), replica.range(), true));
    --- End diff --
    
    Why do you have to construct a new replica? You can't add conflict?
    
    Can conflict have a different range?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to