Merge branch 'cassandra-3.X' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c09ba58e Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c09ba58e Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c09ba58e Branch: refs/heads/trunk Commit: c09ba58e56dcafcb06e6a722c6a137172eef2678 Parents: d8049ae 84b2e73 Author: Stefania Alborghetti <[email protected]> Authored: Mon Dec 12 10:37:03 2016 +0800 Committer: Stefania Alborghetti <[email protected]> Committed: Mon Dec 12 10:37:03 2016 +0800 ---------------------------------------------------------------------- CHANGES.txt | 2 ++ src/java/org/apache/cassandra/gms/Gossiper.java | 1 + .../cassandra/service/StorageService.java | 26 +++++++++++++++++++- 3 files changed, 28 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/c09ba58e/CHANGES.txt ---------------------------------------------------------------------- diff --cc CHANGES.txt index 567e536,5791c5a..2db2d9b --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -127,8 -118,10 +127,10 @@@ * Remove pre-startup check for open JMX port (CASSANDRA-12074) * Remove compaction Severity from DynamicEndpointSnitch (CASSANDRA-11738) * Restore resumable hints delivery (CASSANDRA-11960) - * Properly report LWT contention (CASSANDRA-12626) + * Properly record CAS contention (CASSANDRA-12626) Merged from 3.0: + * Set RPC_READY to false when draining or if a node is marked as shutdown (CASSANDRA-12781) + * CQL often queries static columns unnecessarily (CASSANDRA-12768) * Make sure sstables only get committed when it's safe to discard commit log records (CASSANDRA-12956) * Reject default_time_to_live option when creating or altering MVs (CASSANDRA-12868) * Nodetool should use a more sane max heap size (CASSANDRA-12739) http://git-wip-us.apache.org/repos/asf/cassandra/blob/c09ba58e/src/java/org/apache/cassandra/gms/Gossiper.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/c09ba58e/src/java/org/apache/cassandra/service/StorageService.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/service/StorageService.java index f3b71ec,e7b97f0..4cff409 --- a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@@ -2085,12 -2094,26 +2096,25 @@@ public class StorageService extends Not public boolean isRpcReady(InetAddress endpoint) { - return MessagingService.instance().getVersion(endpoint) < MessagingService.VERSION_22 || - Gossiper.instance.getEndpointStateForEndpoint(endpoint).isRpcReady(); + return Gossiper.instance.getEndpointStateForEndpoint(endpoint).isRpcReady(); } + /** + * Set the RPC status. Because when draining a node we need to set the RPC + * status to not ready, and drain is called by the shutdown hook, it may be that value is false + * and there is no local endpoint state. In this case it's OK to just do nothing. Therefore, + * we assert that the local endpoint state is not null only when value is true. + * + * @param value - true indicates that RPC is ready, false indicates the opposite. + */ public void setRpcReady(boolean value) { - Gossiper.instance.addLocalApplicationState(ApplicationState.RPC_READY, valueFactory.rpcReady(value)); + EndpointState state = Gossiper.instance.getEndpointStateForEndpoint(FBUtilities.getBroadcastAddress()); + // if value is false we're OK with a null state, if it is true we are not. + assert !value || state != null; + + if (state != null) + Gossiper.instance.addLocalApplicationState(ApplicationState.RPC_READY, valueFactory.rpcReady(value)); } private Collection<Token> getTokensFor(InetAddress endpoint)
