cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [4/6] git commit: merge from 1.2
Date Tue, 26 Nov 2013 20:13:17 GMT
merge from 1.2


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

Branch: refs/heads/trunk
Commit: 504f66dc148ab4277756f7d7ca34d760d6f4a179
Parents: 6c68b30 8145c83
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Tue Nov 26 14:13:02 2013 -0600
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Tue Nov 26 14:13:02 2013 -0600

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../locator/AbstractReplicationStrategy.java    | 58 +++++++++++++-------
 .../apache/cassandra/locator/TokenMetadata.java | 49 +++++++----------
 3 files changed, 60 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/504f66dc/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 34dc7a5,8d443f9..d52c508
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,8 -1,8 +1,9 @@@
 -1.2.13
 +2.0.4
 + * Fix divide-by-zero in PCI (CASSANDRA-6403)
 + * Fix setting last compacted key in the wrong level for LCS (CASSANDRA-6284)
 + * Add sub-ms precision formats to the timestamp parser (CASSANDRA-6395)
 +Merged from 1.2:
+  * Fix thundering herd on endpoint cache invalidation (CASSANDRA-6345)
 - * Optimize FD phi calculation (CASSANDRA-6386)
 - * Improve initial FD phi estimate when starting up (CASSANDRA-6385)
 - * Don't list CQL3 table in CLI describe even if named explicitely (CASSANDRA-5750)
   * cqlsh: quote single quotes in strings inside collections (CASSANDRA-6172)
  
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/504f66dc/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java
index f83c889,51c4119..69c133b
--- a/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java
+++ b/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java
@@@ -54,19 -56,27 +56,27 @@@ public abstract class AbstractReplicati
      public final Map<String, String> configOptions;
      private final TokenMetadata tokenMetadata;
  
+     // We want to make updating our replicas asynchronous vs the "master" TokenMetadata
instance,
+     // so that our ownership calculations never block Gossip from processing an ownership
change.
+     // But, we also can't afford to re-clone TM for each range after cache invalidation
(CASSANDRA-6345),
+     // so we keep our own copy here.
+     //
+     // Writes to tokenMetadataClone should be synchronized.
+     private volatile TokenMetadata tokenMetadataClone = null;
+     private volatile long clonedTokenMetadataVersion = 0;
+ 
      public IEndpointSnitch snitch;
  
 -    AbstractReplicationStrategy(String tableName, TokenMetadata tokenMetadata, IEndpointSnitch
snitch, Map<String, String> configOptions)
 +    AbstractReplicationStrategy(String keyspaceName, TokenMetadata tokenMetadata, IEndpointSnitch
snitch, Map<String, String> configOptions)
      {
 -        assert tableName != null;
 +        assert keyspaceName != null;
          assert snitch != null;
          assert tokenMetadata != null;
          this.tokenMetadata = tokenMetadata;
          this.snitch = snitch;
-         this.tokenMetadata.register(this);
          this.configOptions = configOptions == null ? Collections.<String, String>emptyMap()
: configOptions;
 -        this.tableName = tableName;
 -        // lazy-initialize table itself since we don't create them until after the replication
strategies
 +        this.keyspaceName = keyspaceName;
 +        // lazy-initialize keyspace itself since we don't create them until after the replication
strategies
      }
  
      private final Map<Token, ArrayList<InetAddress>> cachedEndpoints = new NonBlockingHashMap<Token,
ArrayList<InetAddress>>();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/504f66dc/src/java/org/apache/cassandra/locator/TokenMetadata.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/locator/TokenMetadata.java
index 7f794ea,818ca8f..b20be18
--- a/src/java/org/apache/cassandra/locator/TokenMetadata.java
+++ b/src/java/org/apache/cassandra/locator/TokenMetadata.java
@@@ -27,11 -26,7 +26,7 @@@ import java.util.concurrent.locks.ReadW
  import java.util.concurrent.locks.ReentrantReadWriteLock;
  
  import com.google.common.collect.*;
- 
- import org.apache.cassandra.utils.BiMultiValMap;
- import org.apache.cassandra.utils.Pair;
- import org.apache.cassandra.utils.SortedBiMultiValMap;
 -import org.apache.commons.lang.StringUtils;
 +import org.apache.commons.lang3.StringUtils;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  
@@@ -977,27 -976,9 +976,9 @@@ public class TokenMetadat
          return sb.toString();
      }
  
-     public void invalidateCaches()
-     {
-         for (AbstractReplicationStrategy subscriber : subscribers)
-         {
-             subscriber.invalidateCachedTokenEndpointValues();
-         }
-     }
- 
-     public void register(AbstractReplicationStrategy subscriber)
-     {
-         subscribers.add(subscriber);
-     }
- 
-     public void unregister(AbstractReplicationStrategy subscriber)
-     {
-         subscribers.remove(subscriber);
-     }
- 
-     public Collection<InetAddress> pendingEndpointsFor(Token token, String keyspaceName)
+     public Collection<InetAddress> pendingEndpointsFor(Token token, String table)
      {
 -        Map<Range<Token>, Collection<InetAddress>> ranges = getPendingRanges(table);
 +        Map<Range<Token>, Collection<InetAddress>> ranges = getPendingRanges(keyspaceName);
          if (ranges.isEmpty())
              return Collections.emptyList();
  


Mime
View raw message