You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by dc...@apache.org on 2025/03/14 22:47:55 UTC

(cassandra-accord) 01/01: Fixed bug where copying routing key used old logic

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

dcapwell pushed a commit to branch feature/enable-token-conflict-tests-begin-transaction
in repository https://gitbox.apache.org/repos/asf/cassandra-accord.git

commit 620f7b6fc3f8567cc172d14c4afcafcf9deba398
Author: David Capwell <dc...@apache.org>
AuthorDate: Fri Mar 14 15:44:54 2025 -0700

    Fixed bug where copying routing key used old logic
---
 .../src/main/java/accord/primitives/AbstractKeys.java     | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/accord-core/src/main/java/accord/primitives/AbstractKeys.java b/accord-core/src/main/java/accord/primitives/AbstractKeys.java
index 637072ec..ce0276f8 100644
--- a/accord-core/src/main/java/accord/primitives/AbstractKeys.java
+++ b/accord-core/src/main/java/accord/primitives/AbstractKeys.java
@@ -304,17 +304,10 @@ public abstract class AbstractKeys<K extends RoutableKey> implements Iterable<K>
 
     protected <T> T toRoutingKeysArray(RoutingKey withKey, boolean permitInsert, ToRoutingKeysFactory<T> toRoutingKeysFactory)
     {
-        RoutingKey[] copy;
-        if (keys.getClass() == RoutingKey[].class)
-        {
-            copy = (RoutingKey[])keys;
-        }
-        else
-        {
-            copy = new RoutingKey[keys.length];
-            for (int i = 0; i < keys.length; i++)
-                copy[i] = keys[i].toUnseekable();
-        }
+        RoutingKey[] copy = new RoutingKey[keys.length];
+        int resultCount = copyToRoutingKeys(keys, 0, copy, 0, keys.length);
+        if (resultCount < copy.length)
+            copy = Arrays.copyOf(copy, resultCount);
 
         int insertPos = Arrays.binarySearch(copy, withKey);
         if (insertPos >= 0)


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