Merge branch 'cassandra-1.2' into cassandra-2.0

Conflicts:
        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/39bdb2be
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/39bdb2be
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/39bdb2be

Branch: refs/heads/trunk
Commit: 39bdb2be978b490c9b64068a67e812c07b63dca2
Parents: b44683c 6c4333e
Author: Brandon Williams <brandonwilli...@apache.org>
Authored: Wed Jan 29 17:35:22 2014 -0600
Committer: Brandon Williams <brandonwilli...@apache.org>
Committed: Wed Jan 29 17:35:22 2014 -0600

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 src/java/org/apache/cassandra/gms/Gossiper.java |  2 +-
 .../cassandra/service/StorageService.java       | 39 +++++++++++++++++---
 3 files changed, 35 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/39bdb2be/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 94eaa79,d88bb26..a059d84
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -28,29 -19,10 +28,30 @@@ Merged from 1.2
   * Add properties to adjust FD initial value and max interval (CASSANDRA-4375)
   * Fix preparing with batch and delete from collection (CASSANDRA-6607)
   * Fix ABSC reverse iterator's remove() method (CASSANDRA-6629)
+  * Handle host ID conflicts properly (CASSANDRA-6615)
  
  
 -1.2.13
 +2.0.4
 + * Allow removing snapshots of no-longer-existing CFs (CASSANDRA-6418)
 + * add StorageService.stopDaemon() (CASSANDRA-4268)
 + * add IRE for invalid CF supplied to get_count (CASSANDRA-5701)
 + * add client encryption support to sstableloader (CASSANDRA-6378)
 + * Fix accept() loop for SSL sockets post-shutdown (CASSANDRA-6468)
 + * Fix size-tiered compaction in LCS L0 (CASSANDRA-6496)
 + * Fix assertion failure in filterColdSSTables (CASSANDRA-6483)
 + * Fix row tombstones in larger-than-memory compactions (CASSANDRA-6008)
 + * Fix cleanup ClassCastException (CASSANDRA-6462)
 + * Reduce gossip memory use by interning VersionedValue strings 
(CASSANDRA-6410)
 + * Allow specifying datacenters to participate in a repair (CASSANDRA-6218)
 + * Fix divide-by-zero in PCI (CASSANDRA-6403)
 + * Fix setting last compacted key in the wrong level for LCS (CASSANDRA-6284)
 + * Add millisecond precision formats to the timestamp parser (CASSANDRA-6395)
 + * Expose a total memtable size metric for a CF (CASSANDRA-6391)
 + * cqlsh: handle symlinks properly (CASSANDRA-6425)
 + * Fix potential infinite loop when paging query with IN (CASSANDRA-6464)
 + * Fix assertion error in AbstractQueryPager.discardFirst (CASSANDRA-6447)
 + * Fix streaming older SSTable yields unnecessary tombstones (CASSANDRA-6527)
 +Merged from 1.2:
   * Improved error message on bad properties in DDL queries (CASSANDRA-6453)
   * Randomize batchlog candidates selection (CASSANDRA-6481)
   * Fix thundering herd on endpoint cache invalidation (CASSANDRA-6345, 6485)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/39bdb2be/src/java/org/apache/cassandra/gms/Gossiper.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/39bdb2be/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/StorageService.java
index 0870362,c93ea5b..9eb4e92
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@@ -1452,6 -1453,12 +1452,12 @@@ public class StorageService extends Not
  
          tokens = getTokensFor(endpoint, pieces[1]);
  
+         Set<Token> tokensToUpdateInMetadata = new HashSet<Token>();
 -        Set<Token> tokensToUpdateInSystemTable = new HashSet<Token>();
++        Set<Token> tokensToUpdateInSystemKeyspace = new HashSet<Token>();
+         Set<Token> localTokensToRemove = new HashSet<Token>();
+         Set<InetAddress> endpointsToRemove = new HashSet<InetAddress>();
+ 
+ 
          if (logger.isDebugEnabled())
              logger.debug("Node " + endpoint + " state normal, token " + 
tokens);
  
@@@ -1465,14 -1473,35 +1472,34 @@@
              if (DatabaseDescriptor.isReplacing() && 
Gossiper.instance.getEndpointStateForEndpoint(DatabaseDescriptor.getReplaceAddress())
 != null && 
(hostId.equals(Gossiper.instance.getHostId(DatabaseDescriptor.getReplaceAddress()))))
                  logger.warn("Not updating token metadata for {} because I am 
replacing it", endpoint);
              else
-                 tokenMetadata.updateHostId(hostId, endpoint);
+             {
+                 if (existing != null && !existing.equals(endpoint))
+                 {
+                     if (existing.equals(FBUtilities.getBroadcastAddress()))
+                     {
+                         logger.warn("Not updating host ID {} for {} because 
it's mine", hostId, endpoint);
+                         tokenMetadata.removeEndpoint(endpoint);
+                         endpointsToRemove.add(endpoint);
+                     }
+                     else if 
(Gossiper.instance.compareEndpointStartup(endpoint, existing) > 0)
+                     {
+                         logger.warn("Host ID collision for {} between {} and 
{}; {} is the new owner", hostId, existing, endpoint, endpoint);
+                         tokenMetadata.removeEndpoint(existing);
+                         endpointsToRemove.add(existing);
+                         tokenMetadata.updateHostId(hostId, endpoint);
+                     }
+                     else
+                     {
+                         logger.warn("Host ID Collision for {} between {} and 
{}; ignored {}", hostId, existing, endpoint, endpoint);
+                         tokenMetadata.removeEndpoint(endpoint);
+                         endpointsToRemove.add(endpoint);
+                     }
+                 }
+                 else
+                     tokenMetadata.updateHostId(hostId, endpoint);
+             }
 -
          }
  
-         Set<Token> tokensToUpdateInMetadata = new HashSet<Token>();
-         Set<Token> tokensToUpdateInSystemKeyspace = new HashSet<Token>();
-         Set<Token> localTokensToRemove = new HashSet<Token>();
-         Set<InetAddress> endpointsToRemove = new HashSet<InetAddress>();
- 
          for (final Token token : tokens)
          {
              // we don't want to update if this node is responsible for the 
token and it has a later startup time than endpoint.

Reply via email to