Hao Zhong created CASSANDRA-13693:
-------------------------------------

             Summary: A potential problem in the 
Ec2MultiRegionSnitch_gossiperStarting method
                 Key: CASSANDRA-13693
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13693
             Project: Cassandra
          Issue Type: Bug
            Reporter: Hao Zhong


The code of Ec2MultiRegionSnitch_gossiperStarting is as follow:
{code}
    public void gossiperStarting()
    {
        super.gossiperStarting();
        
Gossiper.instance.addLocalApplicationState(ApplicationState.INTERNAL_IP, 
StorageService.instance.valueFactory.internalIP(localPrivateAddress));
        Gossiper.instance.register(new ReconnectableSnitchHelper(this, 
ec2region, true));
    }
{code}
I notice that CASSANDRA-5897 fixed a bug, whose buggy code is identical. The 
fixed code is 
{code}
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()
    }
{code}

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



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to