You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by be...@apache.org on 2025/05/16 11:49:21 UTC

(cassandra-accord) branch trunk updated: Initialise CommandStores.nextId on restart

This is an automated email from the ASF dual-hosted git repository.

benedict pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-accord.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 56102d8e Initialise CommandStores.nextId on restart
56102d8e is described below

commit 56102d8e100a1665450fa726dabcf1cb2f4b4e36
Author: Benedict Elliott Smith <be...@apache.org>
AuthorDate: Thu May 15 12:36:34 2025 +0100

    Initialise CommandStores.nextId on restart
    
    patch by Benedict; reviewed by David Capwell for CASSANDRA-20652
---
 accord-core/src/main/java/accord/local/CommandStores.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/accord-core/src/main/java/accord/local/CommandStores.java b/accord-core/src/main/java/accord/local/CommandStores.java
index 4ce5e59a..bddf9d5e 100644
--- a/accord-core/src/main/java/accord/local/CommandStores.java
+++ b/accord-core/src/main/java/accord/local/CommandStores.java
@@ -827,14 +827,17 @@ public abstract class CommandStores
         Invariants.require(current.global.epoch() == 0);
         ShardHolder[] shards = new ShardHolder[update.commandStores.size()];
         int i = 0;
+        int maxId = -1;
         for (Map.Entry<Integer, RangesForEpoch> e : update.commandStores.entrySet())
         {
             Invariants.require(e.getValue() != null);
             EpochUpdateHolder holder = new EpochUpdateHolder();
             holder.add(1, e.getValue(), e.getValue().all());
             shards[i++] = new ShardHolder(supplier.create(e.getKey(), holder), e.getValue());
+            maxId = Math.max(maxId, e.getKey());
         }
 
+        nextId = maxId + 1;
         loadSnapshot(new Snapshot(shards, update.local, update.global));
     }
 


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