Allocation improvements in ProtocolVersion, StorageProxy and MerkleTree

Patch by Matt Byrd; reviewed by Dmitry Konstantinov and marcuse for CASSANDRA-21199
This commit is contained in:
Matt Byrd 2026-03-04 19:47:19 +00:00 committed by Marcus Eriksson
parent 24717dbb0c
commit 9017e18fa1
4 changed files with 12 additions and 8 deletions

View File

@ -1,4 +1,5 @@
6.0-alpha2
* Allocation improvements in ProtocolVersion, StorageProxy and MerkleTree (CASSANDRA-21199)
* Dont leave autocompaction disabled during bootstrap and replace (CASSANDRA-21236)
* Make nodetool abortbootstrap more robust (CASSANDRA-21235)
* Don't clear prepared statement cache on nodetool cms initialize (CASSANDRA-21234)

View File

@ -1441,8 +1441,11 @@ public class StorageProxy implements StorageProxyMBean
boolean attributeNonAccordLatency = true;
long nonAccordEndTime = -1;
if (mutations.stream().anyMatch(mutation -> Keyspace.open(mutation.getKeyspaceName()).getReplicationStrategy().hasTransientReplicas()))
throw new AssertionError("Logged batches are unsupported with transient replication");
for (IMutation mutation : mutations)
{
if (Keyspace.open(mutation.getKeyspaceName()).getReplicationStrategy().hasTransientReplicas())
throw new AssertionError("Logged batches are unsupported with transient replication");
}
try
{

View File

@ -24,6 +24,8 @@ import java.util.EnumSet;
import java.util.List;
import java.util.Optional;
import com.google.common.collect.ImmutableList;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.cassandra.cql3.FunctionContext;
@ -73,6 +75,7 @@ public enum ProtocolVersion implements Comparable<ProtocolVersion>, FunctionCont
/** All supported versions, published as an enumset */
public final static EnumSet<ProtocolVersion> SUPPORTED = EnumSet.copyOf(Arrays.asList(ArrayUtils.addAll(SUPPORTED_VERSIONS)));
private final static ImmutableList<String> SUPPORTED_VERSION_STRINGS = SUPPORTED.stream().map(ProtocolVersion::toString).collect(ImmutableList.toImmutableList());
/** Old unsupported versions, this is OK as long as we never add newer unsupported versions */
public final static EnumSet<ProtocolVersion> UNSUPPORTED = EnumSet.complementOf(SUPPORTED);
@ -84,12 +87,9 @@ public enum ProtocolVersion implements Comparable<ProtocolVersion>, FunctionCont
public final static ProtocolVersion CURRENT = V5;
public final static Optional<ProtocolVersion> BETA = Optional.of(V6);
public static List<String> supportedVersions()
public static ImmutableList<String> supportedVersions()
{
List<String> ret = new ArrayList<>(SUPPORTED.size());
for (ProtocolVersion version : SUPPORTED)
ret.add(version.toString());
return ret;
return SUPPORTED_VERSION_STRINGS;
}
public static List<ProtocolVersion> supportedVersionsStartingWith(ProtocolVersion smallestVersion)

View File

@ -1482,7 +1482,7 @@ public class MerkleTree
{
assert left.length == right.length;
byte[] out = Arrays.copyOf(right, right.length);
byte[] out = new byte[right.length];
for (int i = 0; i < left.length; i++)
out[i] = (byte)((left[i] & 0xFF) ^ (right[i] & 0xFF));
return out;