dcapwell commented on code in PR #46:
URL: https://github.com/apache/cassandra-accord/pull/46#discussion_r1201113145


##########
accord-core/src/main/java/accord/local/CommandStores.java:
##########
@@ -371,9 +376,12 @@ private synchronized TopologyUpdate updateTopology(Node 
node, Snapshot prev, Top
                 RangesForEpochHolder rangesHolder = new RangesForEpochHolder();
                 ShardHolder shardHolder = new 
ShardHolder(supplier.create(nextId++, rangesHolder), rangesHolder);
                 rangesHolder.current = new RangesForEpoch(epoch, add, 
shardHolder.store);
-                // the first epoch we assume is either empty, or correctly 
initialised by whatever system is migrating
-                if (epoch == 1) bootstrapUpdates.add(() -> 
shardHolder.store.initialise(epoch, add));
-                else bootstrapUpdates.add(shardHolder.store.bootstrapper(node, 
add, newLocalTopology.epoch()));
+
+                Ranges.Partition partition = add.partition(range -> 
shouldBootstrap(node, prev.local, newLocalTopology, range));

Review Comment:
   Ranges can have many Range, so this groups into 2 groups: those where the 
predicate are true, and those where they are false; the best example why is in 
C*
   
   In C* we have two cases:
   * key space is known, so getting new ranges; we need to bootstrap 
   * key space is not known (CREATE KEYSPACE), so bootstrap is not needed or 
desired



##########
accord-core/src/main/java/accord/primitives/Ranges.java:
##########
@@ -227,4 +230,27 @@ else if (count == result.length)
         return construct(cachedRanges.completeAndDiscard(result, count));
     }
 
+    public Partition partition(Predicate<Range> test)
+    {
+        List<Range> left = new ArrayList<>();
+        List<Range> right = new ArrayList<>();
+        for (Range range : this)
+            (test.test(range) ? left : right).add(range);

Review Comment:
   Have a better name?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to