ifesdjeen commented on code in PR #213:
URL: https://github.com/apache/cassandra-accord/pull/213#discussion_r2231085628


##########
accord-core/src/main/java/accord/local/CommandStore.java:
##########
@@ -548,6 +563,34 @@ final Supplier<EpochReady> bootstrapper(Node node, Ranges 
newRanges, long epoch)
         };
     }
 
+    public boolean safeToRespond(TxnId txnId, Unseekables<?> participants)
+    {
+        return !unsafeGetRedundantBefore().isUnsafeBefore(txnId, participants);
+    }
+
+    protected EpochReady rebootstrap(Node node, Ranges ranges, long epoch)
+    {
+        AsyncResult<EpochReady> metadata = submit(empty(), safeStore -> {
+            Bootstrap bootstrap = new Bootstrap(node, this, epoch, ranges, 
DataStore.RequestKind.Sync);
+            bootstraps.add(bootstrap);
+            // If rebootstrap can grab a later timestamp for subsequent 
attempts, but this timestamp is enough for us
+            // to establish what's safe to read
+            TxnId unsafeBefore = bootstrap.start(safeStore);
+            logger.debug("Rebootstrap timestamp on {}@{}: {}", id, node.id(), 
unsafeBefore);
+            unsafeUpsertRedundantBefore(RedundantBefore.create(ranges, 
unsafeBefore, SHARD_UNSAFE_BEFORE));
+            return new EpochReady(epoch, null, null,
+                                  bootstrap.data,
+                                  bootstrap.reads);
+        });
+
+        AsyncResult<Void> readyToCoordinate = readyToCoordinate(ranges, epoch);

Review Comment:
   Added a command store-wide `rebootstrapping` flag, which is used to check if 
we're  ready to coordinate, together with `safeToRead`



-- 
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: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to