diff --git a/CHANGES.txt b/CHANGES.txt index 8d003b4131..5bcf25667c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -97,6 +97,7 @@ * Add guardrail for ALTER TABLE ADD / DROP / REMOVE column operations (CASSANDRA-17495) * Rename DisableFlag class to EnableFlag on guardrails (CASSANDRA-17544) Merged from 4.1: + * Fix PAXOS2_COMMIT_AND_PREPARE_RSP serialisation AssertionError (CASSANDRA-18164) * Streaming progress virtual table lock contention can trigger TCP_USER_TIMEOUT and fail streaming (CASSANDRA-18110) * Fix perpetual load of denylist on read in cases where denylist can never be loaded (CASSANDRA-18116) Merged from 4.0: diff --git a/src/java/org/apache/cassandra/gms/Gossiper.java b/src/java/org/apache/cassandra/gms/Gossiper.java index d05ef94bea..a19954adec 100644 --- a/src/java/org/apache/cassandra/gms/Gossiper.java +++ b/src/java/org/apache/cassandra/gms/Gossiper.java @@ -1143,6 +1143,14 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean return endpointStateMap.get(ep); } + public EndpointState copyEndpointStateForEndpoint(InetAddressAndPort ep) + { + EndpointState epState = endpointStateMap.get(ep); + if (epState == null) + return null; + return new EndpointState(epState); + } + public ImmutableSet getEndpoints() { return ImmutableSet.copyOf(endpointStateMap.keySet()); diff --git a/src/java/org/apache/cassandra/service/paxos/Paxos.java b/src/java/org/apache/cassandra/service/paxos/Paxos.java index ee5b27e407..5bdb75c78f 100644 --- a/src/java/org/apache/cassandra/service/paxos/Paxos.java +++ b/src/java/org/apache/cassandra/service/paxos/Paxos.java @@ -1156,8 +1156,8 @@ public class Paxos return emptyMap(); Map endpoints = Maps.newHashMapWithExpectedSize(remoteElectorate.size() + localElectorate.size()); - remoteElectorate.forEach(host -> endpoints.put(host, Gossiper.instance.getEndpointStateForEndpoint(host))); - localElectorate.forEach(host -> endpoints.putIfAbsent(host, Gossiper.instance.getEndpointStateForEndpoint(host))); + remoteElectorate.forEach(host -> endpoints.put(host, Gossiper.instance.copyEndpointStateForEndpoint(host))); + localElectorate.forEach(host -> endpoints.putIfAbsent(host, Gossiper.instance.copyEndpointStateForEndpoint(host))); return endpoints; }