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

A potential problem in the Ec2MultiRegionSnitch_gossiperStarting method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Normal
    • Resolution: Unresolved
    • None
    • None
    • Normal

    Description

      The code of Ec2MultiRegionSnitch_gossiperStarting is as follow:

          public void gossiperStarting()
          {
              super.gossiperStarting();
              Gossiper.instance.addLocalApplicationState(ApplicationState.INTERNAL_IP, StorageService.instance.valueFactory.internalIP(localPrivateAddress));
              Gossiper.instance.register(new ReconnectableSnitchHelper(this, ec2region, true));
          }
      

      I notice that CASSANDRA-5897 fixed a bug, whose buggy code is identical. The fixed code is

      public void gossiperStarting()
          {
              super.gossiperStarting();
      
              Gossiper.instance.addLocalApplicationState(ApplicationState.INTERNAL_IP,
                      StorageService.instance.valueFactory.internalIP(FBUtilities.getLocalAddress().getHostAddress()));
      
              reloadGossiperState();
      
              gossipStarted = true;
          }
      
          private void reloadGossiperState()
          {
              if (Gossiper.instance != null)
              {
                  ReconnectableSnitchHelper pendingHelper = new ReconnectableSnitchHelper(this, myDC, preferLocal);
                  Gossiper.instance.register(pendingHelper);
                  
                  pendingHelper = snitchHelperReference.getAndSet(pendingHelper);
                  if (pendingHelper != null)
                      Gossiper.instance.unregister(pendingHelper);
              }
              // else this will eventually rerun at gossiperStarting()
          }
      

      If Ec2MultiRegionSnitch is supposed to auto-reload, the above fix shall be applied to its code.

      Attachments

        Activity

          People

            Unassigned Unassigned
            haozhong Hao Zhong
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: