You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by db...@apache.org on 2014/05/20 03:23:57 UTC
[1/4] git commit: only query once for local host id on join
Repository: cassandra
Updated Branches:
refs/heads/trunk c2cfefc50 -> d1f1b8e1a
only query once for local host id on join
patch by dbrosius reviewed by jbellis for cassandra-7257
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/de1f7ee1
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/de1f7ee1
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/de1f7ee1
Branch: refs/heads/trunk
Commit: de1f7ee1eebc0ed9a092940874ac5868b16ef930
Parents: 8abe9f6
Author: Dave Brosius <db...@mebigfatguy.com>
Authored: Mon May 19 21:12:44 2014 -0400
Committer: Dave Brosius <db...@mebigfatguy.com>
Committed: Mon May 19 21:12:44 2014 -0400
----------------------------------------------------------------------
src/java/org/apache/cassandra/service/StorageService.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/de1f7ee1/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java
index 7cecec9..9a6e67a 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -618,9 +618,10 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
// 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.
- getTokenMetadata().updateHostId(SystemTable.getLocalHostId(), FBUtilities.getBroadcastAddress());
+ UUID localHostId = SystemTable.getLocalHostId();
+ getTokenMetadata().updateHostId(localHostId, FBUtilities.getBroadcastAddress());
appStates.put(ApplicationState.NET_VERSION, valueFactory.networkVersion());
- appStates.put(ApplicationState.HOST_ID, valueFactory.hostId(SystemTable.getLocalHostId()));
+ 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");
[4/4] git commit: Merge branch 'cassandra-2.1' into trunk
Posted by db...@apache.org.
Merge branch 'cassandra-2.1' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d1f1b8e1
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d1f1b8e1
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d1f1b8e1
Branch: refs/heads/trunk
Commit: d1f1b8e1aad26fa2ed135a6e2285342e847b0b35
Parents: c2cfefc c0e94ae
Author: Dave Brosius <db...@mebigfatguy.com>
Authored: Mon May 19 21:22:59 2014 -0400
Committer: Dave Brosius <db...@mebigfatguy.com>
Committed: Mon May 19 21:22:59 2014 -0400
----------------------------------------------------------------------
src/java/org/apache/cassandra/service/StorageService.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d1f1b8e1/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
[2/4] git commit: Merge branch 'cassandra-1.2' into cassandra-2.0
Posted by db...@apache.org.
Merge branch 'cassandra-1.2' into cassandra-2.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/4f4b5dd1
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/4f4b5dd1
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/4f4b5dd1
Branch: refs/heads/trunk
Commit: 4f4b5dd1ec32b986aaad9ffec5b7313624b418fa
Parents: b9802ff de1f7ee
Author: Dave Brosius <db...@mebigfatguy.com>
Authored: Mon May 19 21:19:41 2014 -0400
Committer: Dave Brosius <db...@mebigfatguy.com>
Committed: Mon May 19 21:19:41 2014 -0400
----------------------------------------------------------------------
src/java/org/apache/cassandra/service/StorageService.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/4f4b5dd1/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/StorageService.java
index fbc1a72,9a6e67a..567bb19
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@@ -629,63 -597,48 +629,64 @@@ 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 (!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 (!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.
- getTokenMetadata().updateHostId(SystemKeyspace.getLocalHostId(), FBUtilities.getBroadcastAddress());
++ UUID localHostId = SystemKeyspace.getLocalHostId();
++ getTokenMetadata().updateHostId(localHostId, FBUtilities.getBroadcastAddress());
+ appStates.put(ApplicationState.NET_VERSION, valueFactory.networkVersion());
- appStates.put(ApplicationState.HOST_ID, valueFactory.hostId(SystemKeyspace.getLocalHostId()));
++ 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();
- HintedHandOffManager.instance.start();
- BatchlogManager.instance.start();
+ if (!MessagingService.instance().isListening())
+ MessagingService.instance().listen(FBUtilities.getLocalAddress());
+ LoadBroadcaster.instance.startBroadcasting();
+
+ 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,
[3/4] git commit: Merge branch 'cassandra-2.0' into cassandra-2.1
Posted by db...@apache.org.
Merge branch 'cassandra-2.0' into cassandra-2.1
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c0e94ae6
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c0e94ae6
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c0e94ae6
Branch: refs/heads/trunk
Commit: c0e94ae601f51bda2bbf0fa3f5ea67ce1746502f
Parents: 0f706c5 4f4b5dd
Author: Dave Brosius <db...@mebigfatguy.com>
Authored: Mon May 19 21:22:10 2014 -0400
Committer: Dave Brosius <db...@mebigfatguy.com>
Committed: Mon May 19 21:22:10 2014 -0400
----------------------------------------------------------------------
src/java/org/apache/cassandra/service/StorageService.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/c0e94ae6/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/StorageService.java
index 59df759,567bb19..e29530a
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@@ -676,10 -660,11 +676,11 @@@ public class StorageService extends Not
// 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.
- getTokenMetadata().updateHostId(SystemKeyspace.getLocalHostId(), FBUtilities.getBroadcastAddress());
+ UUID localHostId = SystemKeyspace.getLocalHostId();
+ getTokenMetadata().updateHostId(localHostId, FBUtilities.getBroadcastAddress());
appStates.put(ApplicationState.NET_VERSION, valueFactory.networkVersion());
- appStates.put(ApplicationState.HOST_ID, valueFactory.hostId(SystemKeyspace.getLocalHostId()));
+ appStates.put(ApplicationState.HOST_ID, valueFactory.hostId(localHostId));
- appStates.put(ApplicationState.RPC_ADDRESS, valueFactory.rpcaddress(DatabaseDescriptor.getRpcAddress()));
+ appStates.put(ApplicationState.RPC_ADDRESS, valueFactory.rpcaddress(DatabaseDescriptor.getBroadcastRpcAddress()));
appStates.put(ApplicationState.RELEASE_VERSION, valueFactory.releaseVersion());
logger.info("Starting up server gossip");
Gossiper.instance.register(this);