Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C83C4200BC6 for ; Sun, 20 Nov 2016 23:27:01 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id C6C23160B18; Sun, 20 Nov 2016 22:27:01 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1D1DB160AFE for ; Sun, 20 Nov 2016 23:27:00 +0100 (CET) Received: (qmail 83508 invoked by uid 500); 20 Nov 2016 22:27:00 -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 83487 invoked by uid 99); 20 Nov 2016 22:27:00 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 Nov 2016 22:27:00 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 23A072C0073 for ; Sun, 20 Nov 2016 22:27:00 +0000 (UTC) Date: Sun, 20 Nov 2016 22:26:59 +0000 (UTC) From: "Paulo Motta (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CASSANDRA-12935) Use saved tokens when setting local tokens on StorageService.joinRing() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sun, 20 Nov 2016 22:27:02 -0000 [ https://issues.apache.org/jira/browse/CASSANDRA-12935?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15681940#comment-15681940 ] Paulo Motta commented on CASSANDRA-12935: ----------------------------------------- My analysis of the code indicates that {{bootstrapTokens}} is always equals to {{SystemKeyspace.getSavedTokens()}} when {{cassandra.write_survey=true}}, so this shouldn't change anything, but this patch reverts it to the old behavior of setting {{SystemKeyspace.getSavedTokens()}} on {{StorageService.joinRing()}} in case there are further changes to {{bootstrapTokens}} which can affect {{StorageService.joinRing()}} behavior. In addition to this minor fix, I also added an assertion to {{StorageService.setTokens}} to make sure tokens being set are never {{null}} or empty. Trivial patch and CI results available below: ||2.2||3.0||3.X||trunk|| |[branch|https://github.com/apache/cassandra/compare/cassandra-2.2...pauloricardomg:2.2-12935]|[branch|https://github.com/apache/cassandra/compare/cassandra-3.0...pauloricardomg:3.0-12935]|[branch|https://github.com/apache/cassandra/compare/cassandra-3.X...pauloricardomg:3.X-12935]|[branch|https://github.com/apache/cassandra/compare/trunk...pauloricardomg:trunk-12935]| |[testall|http://cassci.datastax.com/view/Dev/view/paulomotta/job/pauloricardomg-2.2-12935-testall/lastCompletedBuild/testReport/]|[testall|http://cassci.datastax.com/view/Dev/view/paulomotta/job/pauloricardomg-3.0-12935-testall/lastCompletedBuild/testReport/]|[testall|http://cassci.datastax.com/view/Dev/view/paulomotta/job/pauloricardomg-3.X-12935-testall/lastCompletedBuild/testReport/]|[testall|http://cassci.datastax.com/view/Dev/view/paulomotta/job/pauloricardomg-trunk-12935-testall/lastCompletedBuild/testReport/]| |[dtest|http://cassci.datastax.com/view/Dev/view/paulomotta/job/pauloricardomg-2.2-12935-dtest/lastCompletedBuild/testReport/]|[dtest|http://cassci.datastax.com/view/Dev/view/paulomotta/job/pauloricardomg-3.0-12935-dtest/lastCompletedBuild/testReport/]|[dtest|http://cassci.datastax.com/view/Dev/view/paulomotta/job/pauloricardomg-3.X-12935-dtest/lastCompletedBuild/testReport/]|[dtest|http://cassci.datastax.com/view/Dev/view/paulomotta/job/pauloricardomg-trunk-12935-dtest/lastCompletedBuild/testReport/]| > Use saved tokens when setting local tokens on StorageService.joinRing() > ----------------------------------------------------------------------- > > Key: CASSANDRA-12935 > URL: https://issues.apache.org/jira/browse/CASSANDRA-12935 > Project: Cassandra > Issue Type: Bug > Components: Coordination > Reporter: Paulo Motta > Assignee: Paulo Motta > Priority: Minor > > The introduction of {{StorageService.finishJoiningRing()}} on CASSANDRA-8523: > {code:java} > @@ -885,17 +896,14 @@ public class StorageService extends NotificationBroadcasterSupport implements IE > { > if (dataAvailable) > { > - // start participating in the ring. > - SystemKeyspace.setBootstrapState(SystemKeyspace.BootstrapState.COMPLETED); > - setTokens(bootstrapTokens); > + finishJoiningRing(); > + > // remove the existing info about the replaced node. > if (!current.isEmpty()) > { > for (InetAddress existing : current) > Gossiper.instance.replacedEndpoint(existing); > } > - assert tokenMetadata.sortedTokens().size() > 0; > - doAuthSetup(); > } > else > { > @@ -908,6 +916,11 @@ public class StorageService extends NotificationBroadcasterSupport implements IE > else if (isSurveyMode) > { > - setTokens(SystemKeyspace.getSavedTokens()); > - SystemKeyspace.setBootstrapState(SystemKeyspace.BootstrapState.COMPLETED); > isSurveyMode = false; > logger.info("Leaving write survey mode and joining ring at operator request"); > - assert tokenMetadata.sortedTokens().size() > 0; > - > - doAuthSetup(); > + finishJoiningRing(); > } > } > > + private void finishJoiningRing() > + { > + // start participating in the ring. > + SystemKeyspace.setBootstrapState(SystemKeyspace.BootstrapState.COMPLETED); > + setTokens(bootstrapTokens); > + > + assert tokenMetadata.sortedTokens().size() > 0; > + doAuthSetup(); > + } > + > {code} > slightly changed the way tokens are set on {{StorageService.joinRing()}} when {{cassandra.write_survey=true}} from {{setTokens(SystemKeyspace.getSavedTokens())}} > to {{setTokens(bootstrapTokens)}}. -- This message was sent by Atlassian JIRA (v6.3.4#6332)