Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2E539D70A for ; Fri, 9 Nov 2012 22:55:48 +0000 (UTC) Received: (qmail 38742 invoked by uid 500); 9 Nov 2012 22:55:47 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 38684 invoked by uid 500); 9 Nov 2012 22:55:47 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 38458 invoked by uid 99); 9 Nov 2012 22:55:47 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Nov 2012 22:55:47 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 172075372A; Fri, 9 Nov 2012 22:55:47 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jbellis@apache.org To: commits@cassandra.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [7/7] git commit: fix initializeNodeUnsafe Message-Id: <20121109225547.172075372A@tyr.zones.apache.org> Date: Fri, 9 Nov 2012 22:55:47 +0000 (UTC) fix initializeNodeUnsafe Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/792bd184 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/792bd184 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/792bd184 Branch: refs/heads/cassandra-1.2 Commit: 792bd184f57407d2853cd7233c2732eacc551761 Parents: f5e3ae6 Author: Jonathan Ellis Authored: Fri Nov 9 16:54:59 2012 -0600 Committer: Jonathan Ellis Committed: Fri Nov 9 16:54:59 2012 -0600 ---------------------------------------------------------------------- src/java/org/apache/cassandra/gms/Gossiper.java | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/792bd184/src/java/org/apache/cassandra/gms/Gossiper.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/gms/Gossiper.java b/src/java/org/apache/cassandra/gms/Gossiper.java index 5880210..1179815 100644 --- a/src/java/org/apache/cassandra/gms/Gossiper.java +++ b/src/java/org/apache/cassandra/gms/Gossiper.java @@ -389,7 +389,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean EndpointState epState = endpointStateMap.get(endpoint); epState.updateTimestamp(); // make sure we don't evict it too soon epState.getHeartBeatState().forceNewerGenerationUnsafe(); - epState.addApplicationState(ApplicationState.STATUS, StorageService.instance.valueFactory.removedNonlocal(hostId,computeExpireTime())); + epState.addApplicationState(ApplicationState.STATUS, StorageService.instance.valueFactory.removedNonlocal(hostId, computeExpireTime())); logger.info("Completing removal of " + endpoint); endpointStateMap.put(endpoint, epState); // ensure at least one gossip round occurs before returning @@ -1090,9 +1090,10 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean public void initializeNodeUnsafe(InetAddress addr, UUID uuid, int generationNbr) { HeartBeatState hbState = new HeartBeatState(generationNbr); - EndpointState localState = new EndpointState(hbState); - localState.markAlive(); - endpointStateMap.putIfAbsent(addr, localState); + EndpointState newState = new EndpointState(hbState); + newState.markAlive(); + EndpointState oldState = endpointStateMap.putIfAbsent(addr, newState); + EndpointState localState = oldState == null ? newState : oldState; // always add the version state localState.addApplicationState(ApplicationState.NET_VERSION, StorageService.instance.valueFactory.networkVersion());