cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tylerho...@apache.org
Subject [2/2] git commit: Merge branch 'cassandra-1.2' into cassandra-2.0
Date Wed, 25 Jun 2014 15:40:49 GMT
Merge branch 'cassandra-1.2' into cassandra-2.0

Conflicts:
	src/java/org/apache/cassandra/config/DatabaseDescriptor.java
	src/java/org/apache/cassandra/service/StorageService.java


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2ab7b07a
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2ab7b07a
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2ab7b07a

Branch: refs/heads/cassandra-2.0
Commit: 2ab7b07accf43c6831339ad80646220d9c1821ae
Parents: c656ffe d84b692
Author: Tyler Hobbs <tyler@datastax.com>
Authored: Wed Jun 25 10:40:35 2014 -0500
Committer: Tyler Hobbs <tyler@datastax.com>
Committed: Wed Jun 25 10:40:35 2014 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/config/DatabaseDescriptor.java | 2 --
 src/java/org/apache/cassandra/service/StorageService.java    | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/2ab7b07a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2ab7b07a/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/StorageService.java
index 13dd3b7,1f3d1e1..77ad4f0
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@@ -627,64 -597,50 +627,66 @@@ public class StorageService extends Not
          }
      }
  
 -    private void joinTokenRing(int delay) throws ConfigurationException
 +    private boolean shouldBootstrap()
      {
 -        joined = true;
 +        return DatabaseDescriptor.isAutoBootstrap() && !SystemKeyspace.bootstrapComplete()
&& !DatabaseDescriptor.getSeeds().contains(FBUtilities.getBroadcastAddress());
 +    }
  
 -        Collection<Token> tokens = null;
 -        Map<ApplicationState, VersionedValue> appStates = new HashMap<ApplicationState,
VersionedValue>();
 -
 -        if (DatabaseDescriptor.getReplaceTokens().size() > 0 || DatabaseDescriptor.getReplaceNode()
!= null)
 -            throw new RuntimeException("Replace method removed; use cassandra.replace_address
instead");
 -        if (DatabaseDescriptor.isReplacing())
 -        {
 -            if (SystemTable.bootstrapComplete())
 -                throw new RuntimeException("Cannot replace address with a node that is already
bootstrapped");
 -            if (!DatabaseDescriptor.isAutoBootstrap())
 -                throw new RuntimeException("Trying to replace_address with auto_bootstrap
disabled will not work, check your configuration");
 -            tokens = prepareReplacementInfo();
 -            appStates.put(ApplicationState.STATUS, valueFactory.hibernate(true));
 -            appStates.put(ApplicationState.TOKENS, valueFactory.tokens(tokens));
 -        }
 -        // have to start the gossip service before we can see any info on other nodes. 
this is necessary
 -        // for bootstrap to get the load info it needs.
 -        // (we won't be part of the storage ring though until we add a counterId to our
state, below.)
 -        // Seed the host ID-to-endpoint map with our own ID.
 -        UUID localHostId = SystemTable.getLocalHostId();
 -        getTokenMetadata().updateHostId(localHostId, FBUtilities.getBroadcastAddress());
 -        appStates.put(ApplicationState.NET_VERSION, valueFactory.networkVersion());
 -        appStates.put(ApplicationState.HOST_ID, valueFactory.hostId(localHostId));
 -        appStates.put(ApplicationState.RPC_ADDRESS, valueFactory.rpcaddress(DatabaseDescriptor.getRpcAddress()));
 -        appStates.put(ApplicationState.RELEASE_VERSION, valueFactory.releaseVersion());
 -        logger.info("Starting up server gossip");
 -        Gossiper.instance.register(this);
 -        Gossiper.instance.start(SystemTable.incrementAndGetGeneration(), appStates); //
needed for node-ring gathering.
 -        // gossip snitch infos (local DC and rack)
 -        gossipSnitchInfo();
 -        // gossip Schema.emptyVersion forcing immediate check for schema updates (see MigrationManager#maybeScheduleSchemaPull)
 -        Schema.instance.updateVersionAndAnnounce(); // Ensure we know our own actual Schema
UUID in preparation for updates
 +    private void prepareToJoin() throws ConfigurationException
 +    {
 +        if (!joined)
 +        {
 +            Map<ApplicationState, VersionedValue> appStates = new HashMap<ApplicationState,
VersionedValue>();
 +
 +            if (DatabaseDescriptor.isReplacing() && !(Boolean.parseBoolean(System.getProperty("cassandra.join_ring",
"true"))))
 +                throw new ConfigurationException("Cannot set both join_ring=false and attempt
to replace a node");
 +            if (DatabaseDescriptor.getReplaceTokens().size() > 0 || DatabaseDescriptor.getReplaceNode()
!= null)
 +                throw new RuntimeException("Replace method removed; use cassandra.replace_address
instead");
 +            if (DatabaseDescriptor.isReplacing())
 +            {
++                if (SystemKeyspace.bootstrapComplete())
++                    throw new RuntimeException("Cannot replace address with a node that
is already bootstrapped");
 +                if (!DatabaseDescriptor.isAutoBootstrap())
 +                    throw new RuntimeException("Trying to replace_address with auto_bootstrap
disabled will not work, check your configuration");
 +                bootstrapTokens = prepareReplacementInfo();
 +                appStates.put(ApplicationState.STATUS, valueFactory.hibernate(true));
 +                appStates.put(ApplicationState.TOKENS, valueFactory.tokens(bootstrapTokens));
 +            }
 +            else if (shouldBootstrap())
 +            {
 +                checkForEndpointCollision();
 +            }
 +            // have to start the gossip service before we can see any info on other nodes.
 this is necessary
 +            // for bootstrap to get the load info it needs.
 +            // (we won't be part of the storage ring though until we add a counterId to
our state, below.)
 +            // Seed the host ID-to-endpoint map with our own ID.
 +            UUID localHostId = SystemKeyspace.getLocalHostId();
 +            getTokenMetadata().updateHostId(localHostId, FBUtilities.getBroadcastAddress());
 +            appStates.put(ApplicationState.NET_VERSION, valueFactory.networkVersion());
 +            appStates.put(ApplicationState.HOST_ID, valueFactory.hostId(localHostId));
 +            appStates.put(ApplicationState.RPC_ADDRESS, valueFactory.rpcaddress(DatabaseDescriptor.getRpcAddress()));
 +            appStates.put(ApplicationState.RELEASE_VERSION, valueFactory.releaseVersion());
 +            logger.info("Starting up server gossip");
 +            Gossiper.instance.register(this);
 +            Gossiper.instance.start(SystemKeyspace.incrementAndGetGeneration(), appStates);
// needed for node-ring gathering.
 +            // gossip snitch infos (local DC and rack)
 +            gossipSnitchInfo();
 +            // gossip Schema.emptyVersion forcing immediate check for schema updates (see
MigrationManager#maybeScheduleSchemaPull)
 +            Schema.instance.updateVersionAndAnnounce(); // Ensure we know our own actual
Schema UUID in preparation for updates
  
  
 -        if (!MessagingService.instance().isListening())
 -            MessagingService.instance().listen(FBUtilities.getLocalAddress());
 -        LoadBroadcaster.instance.startBroadcasting();
 +            if (!MessagingService.instance().isListening())
 +                MessagingService.instance().listen(FBUtilities.getLocalAddress());
 +            LoadBroadcaster.instance.startBroadcasting();
 +
 +            HintedHandOffManager.instance.start();
 +            BatchlogManager.instance.start();
 +        }
 +    }
  
 -        HintedHandOffManager.instance.start();
 -        BatchlogManager.instance.start();
 +    private void joinTokenRing(int delay) throws ConfigurationException
 +    {
 +        joined = true;
  
          // We bootstrap if we haven't successfully bootstrapped before, as long as we are
not a seed.
          // If we are a seed, or if the user manually sets auto_bootstrap to false,


Mime
View raw message