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 2024/10/11 14:45:09 UTC

(cassandra) branch cep-15-accord updated (3aa22641ad -> bde3fae040)

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

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


 discard 3aa22641ad do not schedule additional durability attempts while some in flight; plus minor performance improvements
     new bde3fae040 do not schedule additional durability attempts while some in flight; plus minor performance improvements

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (3aa22641ad)
            \
             N -- N -- N   refs/heads/cep-15-accord (bde3fae040)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/cassandra/service/accord/CommandsForRangesLoader.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


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


(cassandra) 01/01: do not schedule additional durability attempts while some in flight; plus minor performance improvements

Posted by be...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit bde3fae040cf206e5f0958f1a23bedd274bcdf7e
Author: Benedict Elliott Smith <be...@apache.org>
AuthorDate: Fri Oct 11 15:35:32 2024 +0100

    do not schedule additional durability attempts while some in flight; plus minor performance improvements
---
 modules/accord                                                 |  2 +-
 src/java/org/apache/cassandra/db/DecoratedKey.java             |  2 +-
 src/java/org/apache/cassandra/dht/IPartitioner.java            | 10 ++++++++++
 src/java/org/apache/cassandra/dht/LocalPartitioner.java        |  5 +++++
 .../apache/cassandra/io/sstable/format/big/BigTableReader.java |  9 ++++++++-
 .../cassandra/service/accord/CommandsForRangesLoader.java      |  4 ++--
 6 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/modules/accord b/modules/accord
index eedd13ac4b..dd04c81214 160000
--- a/modules/accord
+++ b/modules/accord
@@ -1 +1 @@
-Subproject commit eedd13ac4b7b9f61d574badb4bfc47611a838739
+Subproject commit dd04c81214be9213cf503025bf6ed4cbf118be00
diff --git a/src/java/org/apache/cassandra/db/DecoratedKey.java b/src/java/org/apache/cassandra/db/DecoratedKey.java
index 03d6374112..7dd709f088 100644
--- a/src/java/org/apache/cassandra/db/DecoratedKey.java
+++ b/src/java/org/apache/cassandra/db/DecoratedKey.java
@@ -97,7 +97,7 @@ public abstract class DecoratedKey implements PartitionPosition, FilterKey
             return -position.compareTo(partitioner.decorateKey(key));
 
         DecoratedKey otherKey = (DecoratedKey) position;
-        int cmp = partitioner.getToken(key).compareTo(otherKey.getToken());
+        int cmp = partitioner.compareToken(key, otherKey.getToken());
         return cmp == 0 ? ByteBufferUtil.compareUnsigned(key, otherKey.getKey()) : cmp;
     }
 
diff --git a/src/java/org/apache/cassandra/dht/IPartitioner.java b/src/java/org/apache/cassandra/dht/IPartitioner.java
index ff470a865a..3e0ca5e4dd 100644
--- a/src/java/org/apache/cassandra/dht/IPartitioner.java
+++ b/src/java/org/apache/cassandra/dht/IPartitioner.java
@@ -82,6 +82,16 @@ public interface IPartitioner
      */
     public Token getToken(ByteBuffer key);
 
+    /**
+     * @return a Token that can be used to route a given key
+     * (This is NOT a method to create a Token from its string representation;
+     * for that, use TokenFactory.fromString.)
+     */
+    default int compareToken(ByteBuffer key, Token token)
+    {
+        return getToken(key).compareTo(token);
+    }
+
     /**
      * @return a randomly generated token
      */
diff --git a/src/java/org/apache/cassandra/dht/LocalPartitioner.java b/src/java/org/apache/cassandra/dht/LocalPartitioner.java
index 0a1ede356b..2f060c6b67 100644
--- a/src/java/org/apache/cassandra/dht/LocalPartitioner.java
+++ b/src/java/org/apache/cassandra/dht/LocalPartitioner.java
@@ -72,6 +72,11 @@ public class LocalPartitioner implements IPartitioner
         return new LocalToken(key);
     }
 
+    public int compareToken(ByteBuffer key, Token token)
+    {
+        return comparator.compare(key, ((LocalToken)token).token);
+    }
+
     public LocalToken getRandomToken()
     {
         throw new UnsupportedOperationException();
diff --git a/src/java/org/apache/cassandra/io/sstable/format/big/BigTableReader.java b/src/java/org/apache/cassandra/io/sstable/format/big/BigTableReader.java
index b6038237bd..9fcd68fbc3 100644
--- a/src/java/org/apache/cassandra/io/sstable/format/big/BigTableReader.java
+++ b/src/java/org/apache/cassandra/io/sstable/format/big/BigTableReader.java
@@ -325,6 +325,7 @@ public class BigTableReader extends SSTableReaderWithFilter implements IndexSumm
         // of the next interval).
         int i = 0;
         String path = null;
+        ByteBuffer indexKey = null;
         try (FileDataInput in = ifile.createReader(sampledPosition))
         {
             path = in.getPath();
@@ -332,7 +333,13 @@ public class BigTableReader extends SSTableReaderWithFilter implements IndexSumm
             {
                 i++;
 
-                ByteBuffer indexKey = ByteBufferUtil.readWithShortLength(in);
+                int length = in.readUnsignedShort();
+                if (indexKey == null || indexKey.capacity() < length)
+                    indexKey = ByteBuffer.allocate(length);
+
+                in.readFully(indexKey.array(), 0, length);
+                indexKey.position(0);
+                indexKey.limit(length);
 
                 boolean opSatisfied; // did we find an appropriate position for the op requested
                 boolean exactMatch; // is the current position an exact match for the key, suitable for caching
diff --git a/src/java/org/apache/cassandra/service/accord/CommandsForRangesLoader.java b/src/java/org/apache/cassandra/service/accord/CommandsForRangesLoader.java
index 992867a9e2..fa3ee4a846 100644
--- a/src/java/org/apache/cassandra/service/accord/CommandsForRangesLoader.java
+++ b/src/java/org/apache/cassandra/service/accord/CommandsForRangesLoader.java
@@ -249,7 +249,7 @@ public class CommandsForRangesLoader implements AccordStateCache.Listener<TxnId,
         if (cmd.partialTxn() == null)
             return null;
 
-        var keysOrRanges = cmd.participants().touches();
+        var keysOrRanges = cmd.participants().touches().toRanges();
         if (keysOrRanges.domain() != Domain.Range)
             throw new AssertionError(String.format("Txn keys are not range for %s", cmd.partialTxn()));
         Ranges ranges = (Ranges) keysOrRanges;
@@ -273,7 +273,7 @@ public class CommandsForRangesLoader implements AccordStateCache.Listener<TxnId,
         }
 
         var partialDeps = cmd.partialDeps();
-        boolean hasAsDep = findAsDep != null && partialDeps.rangeDeps.intersects(findAsDep, ranges);
+        boolean hasAsDep = findAsDep != null && partialDeps != null && partialDeps.rangeDeps.intersects(findAsDep, ranges);
         return new Summary(cmd.txnId(), cmd.executeAt(), saveStatus, ranges, findAsDep, hasAsDep);
     }
 


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