Merge branch 'cassandra-1.2' into cassandra-2.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8a069587 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8a069587 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8a069587 Branch: refs/heads/trunk Commit: 8a069587d5f67d64d99e9d391e5f6a733616ab97 Parents: b6147c1 59bf44d Author: Brandon Williams <brandonwilli...@apache.org> Authored: Tue Oct 22 15:29:24 2013 -0500 Committer: Brandon Williams <brandonwilli...@apache.org> Committed: Tue Oct 22 15:29:24 2013 -0500 ---------------------------------------------------------------------- src/java/org/apache/cassandra/db/HintedHandOffManager.java | 8 ++++++-- src/java/org/apache/cassandra/service/MigrationManager.java | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a069587/src/java/org/apache/cassandra/db/HintedHandOffManager.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/db/HintedHandOffManager.java index 67a5c68,ede49e4..f1e751f --- a/src/java/org/apache/cassandra/db/HintedHandOffManager.java +++ b/src/java/org/apache/cassandra/db/HintedHandOffManager.java @@@ -249,22 -209,38 +249,24 @@@ public class HintedHandOffManager imple Gossiper gossiper = Gossiper.instance; int waited = 0; // first, wait for schema to be gossiped. - while (gossiper.getEndpointStateForEndpoint(endpoint).getApplicationState(ApplicationState.SCHEMA) == null) + while (gossiper.getEndpointStateForEndpoint(endpoint) != null && gossiper.getEndpointStateForEndpoint(endpoint).getApplicationState(ApplicationState.SCHEMA) == null) { - try - { - Thread.sleep(1000); - } - catch (InterruptedException e) - { - throw new AssertionError(e); - } + Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS); waited += 1000; if (waited > 2 * StorageService.RING_DELAY) throw new TimeoutException("Didin't receive gossiped schema from " + endpoint + " in " + 2 * StorageService.RING_DELAY + "ms"); } + if (gossiper.getEndpointStateForEndpoint(endpoint) == null) + throw new TimeoutException("Node " + endpoint + " vanished while waiting for agreement"); waited = 0; // then wait for the correct schema version. - // usually we use DD.getDefsVersion, which checks the local schema uuid as stored in the system table. + // usually we use DD.getDefsVersion, which checks the local schema uuid as stored in the system keyspace. // here we check the one in gossip instead; this serves as a canary to warn us if we introduce a bug that // causes the two to diverge (see CASSANDRA-2946) - while (!gossiper.getEndpointStateForEndpoint(endpoint).getApplicationState(ApplicationState.SCHEMA).value.equals( + while (gossiper.getEndpointStateForEndpoint(endpoint) != null && !gossiper.getEndpointStateForEndpoint(endpoint).getApplicationState(ApplicationState.SCHEMA).value.equals( gossiper.getEndpointStateForEndpoint(FBUtilities.getBroadcastAddress()).getApplicationState(ApplicationState.SCHEMA).value)) { - try - { - Thread.sleep(1000); - } - catch (InterruptedException e) - { - throw new AssertionError(e); - } + Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS); waited += 1000; if (waited > 2 * StorageService.RING_DELAY) throw new TimeoutException("Could not reach schema agreement with " + endpoint + " in " + 2 * StorageService.RING_DELAY + "ms"); http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a069587/src/java/org/apache/cassandra/service/MigrationManager.java ----------------------------------------------------------------------