Merge branch 'cassandra-4.1' into trunk

* cassandra-4.1:
  EndpointState is mutable, so we must copy it before trying to serialize
This commit is contained in:
Mick Semb Wever 2023-01-20 11:26:02 +01:00
commit 45e00ea92f
No known key found for this signature in database
GPG Key ID: E91335D77E3E87CB
3 changed files with 11 additions and 2 deletions

View File

@ -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:

View File

@ -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<InetAddressAndPort> getEndpoints()
{
return ImmutableSet.copyOf(endpointStateMap.keySet());

View File

@ -1156,8 +1156,8 @@ public class Paxos
return emptyMap();
Map<InetAddressAndPort, EndpointState> 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;
}