Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
7.0
* compute ProtocolVersion::supportedVersions once immutably to avoid object generation (CASSANDRA-21199)
* Avoid using ObjectUtils.getFirstNonNull in Schema (CASSANDRA-21394)
* Allow nodetool garbagecollect to take a user defined list of SSTables (CASSANDRA-16767)
* Add a guardrail for misprepared statements (CASSANDRA-21139)
Expand Down
7 changes: 5 additions & 2 deletions src/java/org/apache/cassandra/service/StorageProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -1441,8 +1441,11 @@ public static void mutateAtomically(List<Mutation> mutations,
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
{
Expand Down
10 changes: 5 additions & 5 deletions src/java/org/apache/cassandra/transport/ProtocolVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
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;
Expand Down Expand Up @@ -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);
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/java/org/apache/cassandra/utils/MerkleTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@ static byte[] xor(byte[] left, byte[] right)
{
assert left.length == right.length;

byte[] out = Arrays.copyOf(right, right.length);
byte[] out = new byte[right.length];
Comment thread
netudima marked this conversation as resolved.
for (int i = 0; i < left.length; i++)
out[i] = (byte)((left[i] & 0xFF) ^ (right[i] & 0xFF));
return out;
Expand Down