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

ifesdjeen pushed a commit to branch semi-integrated-burn-test-rebased
in repository https://gitbox.apache.org/repos/asf/cassandra-accord.git

commit 68ab3c0ce18dac733eef3a39f2ea11b5dde9c358
Author: Alex Petrov <[email protected]>
AuthorDate: Mon Nov 18 16:39:08 2024 +0100

    Fix timestamp ordering with relation to ordered bytes
---
 accord-core/src/main/java/accord/local/Node.java           | 4 +++-
 accord-core/src/main/java/accord/primitives/Timestamp.java | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/accord-core/src/main/java/accord/local/Node.java 
b/accord-core/src/main/java/accord/local/Node.java
index a213c112..38939974 100644
--- a/accord-core/src/main/java/accord/local/Node.java
+++ b/accord-core/src/main/java/accord/local/Node.java
@@ -671,7 +671,9 @@ public class Node implements ConfigurationService.Listener, 
NodeCommandStoreServ
      */
     public TxnId nextTxnId(Txn.Kind rw, Domain domain)
     {
-        return new TxnId(uniqueNow(), rw, domain);
+        TxnId txnId = new TxnId(uniqueNow(), rw, domain);
+        Invariants.checkState((txnId.lsb & (0xffff & ~TxnId.IDENTITY_FLAGS)) 
== 0);
+        return txnId;
     }
 
     public AsyncResult<Result> coordinate(Txn txn)
diff --git a/accord-core/src/main/java/accord/primitives/Timestamp.java 
b/accord-core/src/main/java/accord/primitives/Timestamp.java
index 0a9de552..f488ab8b 100644
--- a/accord-core/src/main/java/accord/primitives/Timestamp.java
+++ b/accord-core/src/main/java/accord/primitives/Timestamp.java
@@ -38,8 +38,8 @@ public class Timestamp implements Comparable<Timestamp>, 
EpochSupplier
      */
     private static final int MERGE_FLAGS = 0x8000;
     // TODO (testing): is this the correct set of identity bits?
-    private static final long IDENTITY_LSB = 0xFFFFFFFFFFFF001EL;
-    public static final int IDENTITY_FLAGS = 0x001E;
+    private static final long IDENTITY_LSB = 0xFFFFFFFF_FFFF001FL;
+    public static final int IDENTITY_FLAGS = 0x00000000_0000001F;
     public static final long MAX_EPOCH = (1L << 48) - 1;
     private static final long HLC_INCR = 1L << 16;
     static final long MAX_FLAGS = HLC_INCR - 1;


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

Reply via email to