You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by if...@apache.org on 2024/10/23 14:23:11 UTC

(cassandra-accord) branch test-fixes-2 created (now 9cbff65e)

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

ifesdjeen pushed a change to branch test-fixes-2
in repository https://gitbox.apache.org/repos/asf/cassandra-accord.git


      at 9cbff65e Avoid splitting un-splittable ranges

This branch includes the following new commits:

     new 9cbff65e Avoid splitting un-splittable ranges

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.



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


(cassandra-accord) 01/01: Avoid splitting un-splittable ranges

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

ifesdjeen pushed a commit to branch test-fixes-2
in repository https://gitbox.apache.org/repos/asf/cassandra-accord.git

commit 9cbff65ec4a7ba1cc5a6c27220b8103474ae3d35
Author: Alex Petrov <ol...@gmail.com>
AuthorDate: Wed Oct 23 14:30:49 2024 +0200

    Avoid splitting un-splittable ranges
---
 accord-core/src/main/java/accord/local/ShardDistributor.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/accord-core/src/main/java/accord/local/ShardDistributor.java b/accord-core/src/main/java/accord/local/ShardDistributor.java
index d2dd9da5..43a7ef99 100644
--- a/accord-core/src/main/java/accord/local/ShardDistributor.java
+++ b/accord-core/src/main/java/accord/local/ShardDistributor.java
@@ -47,6 +47,7 @@ public interface ShardDistributor
     {
         public interface Splitter<T>
         {
+            default boolean splittable(Range range, int numSplits) { return true; }
             T sizeOf(Range range);
             Range subRange(Range range, T start, T end);
 
@@ -76,6 +77,8 @@ public interface ShardDistributor
             Invariants.checkArgument(from <= to);
             Invariants.checkArgument(to <= numSplits);
             Splitter<T> splitter = this.splitter.apply(Ranges.single(range));
+            if (!splitter.splittable(range, numSplits))
+                return range;
             T size = splitter.sizeOf(range);
             T splitSize = splitter.divide(size, numSplits);
             T remainder = splitter.subtract(size, splitter.multiply(splitSize, numSplits));


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