Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-12935

Use saved tokens when setting local tokens on StorageService.joinRing()

    XMLWordPrintableJSON

    Details

    • Severity:
      Low
    • Since Version:

      Description

      The introduction of StorageService.finishJoiningRing() on CASSANDRA-8523:

      @@ -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();
      +    }
      +
      

      slightly changed the way tokens are set on StorageService.joinRing() when cassandra.write_survey=true from setTokens(SystemKeyspace.getSavedTokens())
      to setTokens(bootstrapTokens).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pauloricardomg Paulo Motta (Deprecated)
                Reporter:
                pauloricardomg Paulo Motta (Deprecated)
                Authors:
                Paulo Motta (Deprecated)
                Reviewers:
                Carl Yeksigian
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: