cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1126694 - in /cassandra/trunk: ./ contrib/ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/java/org/apache/cassandra/config/ src/java/org/apache/cassandra/db/ src/java/org/apache/cassandra/db/migration/ src/java/org/apache/cassa...
Date Mon, 23 May 2011 19:53:57 GMT
Author: jbellis
Date: Mon May 23 19:53:56 2011
New Revision: 1126694

URL: http://svn.apache.org/viewvc?rev=1126694&view=rev
Log:
merge from 0.8

Modified:
    cassandra/trunk/   (props changed)
    cassandra/trunk/CHANGES.txt
    cassandra/trunk/contrib/   (props changed)
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java 
 (props changed)
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java   (props
changed)
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
  (props changed)
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
  (props changed)
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
  (props changed)
    cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java
    cassandra/trunk/src/java/org/apache/cassandra/db/HintedHandOffManager.java
    cassandra/trunk/src/java/org/apache/cassandra/db/migration/DropKeyspace.java
    cassandra/trunk/src/java/org/apache/cassandra/db/migration/RenameKeyspace.java
    cassandra/trunk/src/java/org/apache/cassandra/gms/FailureDetector.java
    cassandra/trunk/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java
    cassandra/trunk/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java

Propchange: cassandra/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 23 19:53:56 2011
@@ -1,8 +1,8 @@
 /cassandra/branches/cassandra-0.6:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
-/cassandra/branches/cassandra-0.7:1026516-1126504,1126639
+/cassandra/branches/cassandra-0.7:1026516-1126686
 /cassandra/branches/cassandra-0.7.0:1053690-1055654
-/cassandra/branches/cassandra-0.8:1090934-1125013,1125019-1126660
-/cassandra/branches/cassandra-0.8.0:1125021-1126659
+/cassandra/branches/cassandra-0.8:1090934-1125013,1125019-1126691
+/cassandra/branches/cassandra-0.8.0:1125021-1126670
 /cassandra/branches/cassandra-0.8.1:1101014-1125018
 /cassandra/tags/cassandra-0.7.0-rc3:1051699-1053689
 /cassandra/tags/cassandra-0.8.0-rc1:1102511-1125020

Modified: cassandra/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/trunk/CHANGES.txt?rev=1126694&r1=1126693&r2=1126694&view=diff
==============================================================================
--- cassandra/trunk/CHANGES.txt (original)
+++ cassandra/trunk/CHANGES.txt Mon May 23 19:53:56 2011
@@ -20,6 +20,7 @@
  * Add sstable bulk loading utility (CASSANDRA-1278)
  * avoid replaying hints to dropped columnfamilies (CASSANDRA-2685)
  * add placeholders for missing rows in range query pseudo-RR (CASSANDRA-2680)
+ * remove no-op HHOM.renameHints (CASSANDRA-2693)
 
 
 0.8.0-final
@@ -30,8 +31,11 @@
  * fix UUIDType, IntegerType for direct buffers (CASSANDRA-2682, 2684)
  * switch to native Thrift for Hadoop map/reduce (CASSANDRA-2667)
  * fix StackOverflowError when building from eclipse (CASSANDRA-2687)
+ * only provide replication_factor to strategy_options "help" for
+   SimpleStrategy, OldNetworkTopologyStrategy (CASSANDRA-2678)
 
-0.8.0-rc1 
+
+0.8.0-rc1
  * faster flushes and compaction from fixing excessively pessimistic 
    rebuffering in BRAF (CASSANDRA-2581)
  * fix returning null column values in the python cql driver (CASSANDRA-2593)

Propchange: cassandra/trunk/contrib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 23 19:53:56 2011
@@ -1,8 +1,8 @@
 /cassandra/branches/cassandra-0.6/contrib:922689-1052356,1052358-1053452,1053454,1053456-1068009
-/cassandra/branches/cassandra-0.7/contrib:1026516-1126504,1126639
+/cassandra/branches/cassandra-0.7/contrib:1026516-1126686
 /cassandra/branches/cassandra-0.7.0/contrib:1053690-1055654
-/cassandra/branches/cassandra-0.8/contrib:1090934-1125013,1125019-1126660
-/cassandra/branches/cassandra-0.8.0/contrib:1125021-1126659
+/cassandra/branches/cassandra-0.8/contrib:1090934-1125013,1125019-1126691
+/cassandra/branches/cassandra-0.8.0/contrib:1125021-1126670
 /cassandra/branches/cassandra-0.8.1/contrib:1101014-1125018
 /cassandra/tags/cassandra-0.7.0-rc3/contrib:1051699-1053689
 /cassandra/tags/cassandra-0.8.0-rc1/contrib:1102511-1125020

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 23 19:53:56 2011
@@ -1,8 +1,8 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026516-1126504,1126639
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026516-1126686
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1090934-1125013,1125019-1126660
-/cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1125021-1126659
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1090934-1125013,1125019-1126691
+/cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1125021-1126670
 /cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1101014-1125018
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1051699-1053689
 /cassandra/tags/cassandra-0.8.0-rc1/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1102511-1125020

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 23 19:53:56 2011
@@ -1,8 +1,8 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026516-1126504,1126639
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026516-1126686
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1090934-1125013,1125019-1126660
-/cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1125021-1126659
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1090934-1125013,1125019-1126691
+/cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1125021-1126670
 /cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1101014-1125018
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1051699-1053689
 /cassandra/tags/cassandra-0.8.0-rc1/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1102511-1125020

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 23 19:53:56 2011
@@ -1,8 +1,8 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026516-1126504,1126639
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026516-1126686
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1090934-1125013,1125019-1126660
-/cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1125021-1126659
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1090934-1125013,1125019-1126691
+/cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1125021-1126670
 /cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1101014-1125018
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1051699-1053689
 /cassandra/tags/cassandra-0.8.0-rc1/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1102511-1125020

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 23 19:53:56 2011
@@ -1,8 +1,8 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026516-1126504,1126639
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026516-1126686
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1090934-1125013,1125019-1126660
-/cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1125021-1126659
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1090934-1125013,1125019-1126691
+/cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1125021-1126670
 /cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1101014-1125018
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1051699-1053689
 /cassandra/tags/cassandra-0.8.0-rc1/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1102511-1125020

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 23 19:53:56 2011
@@ -1,8 +1,8 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026516-1126504,1126639
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026516-1126686
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1090934-1125013,1125019-1126660
-/cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1125021-1126659
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1090934-1125013,1125019-1126691
+/cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1125021-1126670
 /cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1101014-1125018
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1051699-1053689
 /cassandra/tags/cassandra-0.8.0-rc1/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1102511-1125020

Modified: cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java?rev=1126694&r1=1126693&r2=1126694&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java Mon May 23 19:53:56
2011
@@ -51,19 +51,18 @@ public final class KSMetaData
 
     public static Map<String, String> forwardsCompatibleOptions(KsDef ks_def)
     {
-        Map<String, String> options;
-        if (ks_def.isSetReplication_factor())
-        {
-            options = new HashMap<String, String>(ks_def.strategy_options == null ?
Collections.<String, String>emptyMap() : ks_def.strategy_options);
-            options.put("replication_factor", String.valueOf(ks_def.replication_factor));
-        }
-        else
-        {
-            options = ks_def.strategy_options;
-        }
+        Map<String, String> options = new HashMap<String, String>(ks_def.strategy_options);
+        maybeAddReplicationFactor(options, ks_def.strategy_class, ks_def.isSetReplication_factor()
? ks_def.replication_factor : null);
         return options;
     }
 
+    // TODO remove this for 1.0
+    private static void maybeAddReplicationFactor(Map<String, String> options, String
cls, Integer rf)
+    {
+        if (rf != null && (cls.endsWith("SimpleStrategy") || cls.endsWith("OldNetworkTopologyStrategy")))
+            options.put("replication_factor", rf.toString());
+    }
+
     public int hashCode()
     {
         return name.hashCode();
@@ -139,8 +138,7 @@ public final class KSMetaData
                 strategyOptions.put(e.getKey().toString(), e.getValue().toString());
             }
         }
-        if (ks.replication_factor != null)
-            strategyOptions.put("replication_factor", ks.replication_factor.toString());
+        maybeAddReplicationFactor(strategyOptions, ks.strategy_class.toString(), ks.replication_factor);
 
         int cfsz = ks.cf_defs.size();
         CFMetaData[] cfMetaData = new CFMetaData[cfsz];

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/HintedHandOffManager.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/HintedHandOffManager.java?rev=1126694&r1=1126693&r2=1126694&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/HintedHandOffManager.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/HintedHandOffManager.java Mon May 23
19:53:56 2011
@@ -376,37 +376,6 @@ public class HintedHandOffManager implem
                                    rowsReplayed, endpoint));
     }
 
-    /** called when a keyspace is dropped or rename. newTable==null in the case of a drop.
*/
-    public static void renameHints(String oldTable, String newTable) throws IOException
-    {
-        DecoratedKey<?> oldTableKey = StorageService.getPartitioner().decorateKey(ByteBufferUtil.bytes(oldTable));
-        // we're basically going to fetch, drop and add the scf for the old and new table.
we need to do it piecemeal 
-        // though since there could be GB of data.
-        ColumnFamilyStore hintStore = Table.open(Table.SYSTEM_TABLE).getColumnFamilyStore(HINTS_CF);
-        ByteBuffer startCol = ByteBufferUtil.EMPTY_BYTE_BUFFER;
-        long now = System.currentTimeMillis();
-        while (true)
-        {
-            QueryFilter filter = QueryFilter.getSliceFilter(oldTableKey, new QueryPath(HINTS_CF),
startCol, ByteBufferUtil.EMPTY_BYTE_BUFFER, false, PAGE_SIZE);
-            ColumnFamily cf = ColumnFamilyStore.removeDeleted(hintStore.getColumnFamily(filter),
Integer.MAX_VALUE);
-            if (pagingFinished(cf, startCol))
-                break;
-            if (newTable != null)
-            {
-                RowMutation insert = new RowMutation(Table.SYSTEM_TABLE, ByteBufferUtil.bytes(newTable));
-                insert.add(cf);
-                insert.apply();
-            }
-            RowMutation drop = new RowMutation(Table.SYSTEM_TABLE, oldTableKey.key);
-            for (ByteBuffer key : cf.getColumnNames())
-            {
-                drop.delete(new QueryPath(HINTS_CF, key), now);
-                startCol = key;
-            }
-            drop.apply();
-        }
-    }
-
     /*
      * This method is used to deliver hints to a particular endpoint.
      * When we learn that some endpoint is back up we deliver the data

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/migration/DropKeyspace.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/migration/DropKeyspace.java?rev=1126694&r1=1126693&r2=1126694&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/migration/DropKeyspace.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/migration/DropKeyspace.java Mon May 23
19:53:56 2011
@@ -81,12 +81,6 @@ public class DropKeyspace extends Migrat
             assert table != null;
             // reset defs.
             DatabaseDescriptor.clearTableDefinition(ksm, newVersion);
-            
-            if (!clientMode)
-            {
-                // clear up any local hinted data for this keyspace.
-                HintedHandOffManager.renameHints(name, null);
-            }
         }
         finally
         {

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/migration/RenameKeyspace.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/migration/RenameKeyspace.java?rev=1126694&r1=1126693&r2=1126694&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/migration/RenameKeyspace.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/migration/RenameKeyspace.java Mon May
23 19:53:56 2011
@@ -109,7 +109,6 @@ public class RenameKeyspace extends Migr
         {
             Table.clear(oldKsm.name);
             Table.open(newName);
-            HintedHandOffManager.renameHints(oldName, newName);
         }
     }
     

Modified: cassandra/trunk/src/java/org/apache/cassandra/gms/FailureDetector.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/gms/FailureDetector.java?rev=1126694&r1=1126693&r2=1126694&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/gms/FailureDetector.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/gms/FailureDetector.java Mon May 23 19:53:56
2011
@@ -200,6 +200,12 @@ class ArrivalWindow
     private double tLast_ = 0L;
     private BoundedStatsDeque arrivalIntervals_;
 
+    // this is useless except to provide backwards compatibility in phi_convict_threshold,
+    // because everyone seems pretty accustomed to the default of 8, and users who have
+    // already tuned their phi_convict_threshold for their own environments won't need to
+    // change.
+    private final double PHI_FACTOR = 1.0 / Math.log(10.0);
+
     ArrivalWindow(int size)
     {
         arrivalIntervals_ = new BoundedStatsDeque(size);
@@ -249,26 +255,16 @@ class ArrivalWindow
     {
         arrivalIntervals_.clear();
     }
-    
-    double p(double t)
-    {
-        double mean = mean();
-        double exponent = (-1)*(t)/mean;
-        return Math.pow(Math.E, exponent);
-    }
-    
+
+    // see CASSANDRA-2597 for an explanation of the math at work here.
     double phi(long tnow)
-    {            
+    {
         int size = arrivalIntervals_.size();
-        double log = 0d;
-        if ( size > 0 )
-        {
-            double t = tnow - tLast_;                
-            double probability = p(t);       
-            log = (-1) * Math.log10( probability );                                 
-        }
-        return log;           
-    } 
+        double t = tnow - tLast_;
+        return (size > 0)
+               ? PHI_FACTOR * t / mean()
+               : 0.0;
+    }
     
     public String toString()
     {

Modified: cassandra/trunk/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java?rev=1126694&r1=1126693&r2=1126694&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java Mon May
23 19:53:56 2011
@@ -274,7 +274,6 @@ public class DynamicEndpointSnitch exten
 class AdaptiveLatencyTracker extends AbstractStatsDeque
 {
     private final LinkedBlockingDeque<Double> latencies;
-    private static final double SENTINEL_COMPARE = 0.0001; // arbitrary; as long as it is
the same across hosts it doesn't matter
 
     AdaptiveLatencyTracker(int size)
     {
@@ -312,22 +311,9 @@ class AdaptiveLatencyTracker extends Abs
         return latencies.size();
     }
 
-    double p(double t)
-    {
-        double mean = mean();
-        double exponent = (-1) * (t) / mean;
-        return 1 - Math.pow( Math.E, exponent);
-    }
-
     double score()
     {
-        double log = 0d;
-        if ( latencies.size() > 0 )
-        {
-            double probability = p(SENTINEL_COMPARE);
-            log = (-1) * Math.log10( probability );
-        }
-        return log;
+        return (size() > 0) ? mean() : 0.0;
     }
 
 }

Modified: cassandra/trunk/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java?rev=1126694&r1=1126693&r2=1126694&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java Mon
May 23 19:53:56 2011
@@ -63,8 +63,14 @@ public class NetworkTopologyStrategy ext
         Map<String, Integer> newDatacenters = new HashMap<String, Integer>();
         if (configOptions != null)
         {
-            for (Entry entry : configOptions.entrySet())
-                newDatacenters.put((String) entry.getKey(), Integer.valueOf((String) entry.getValue()));
+            for (Entry<String, String> entry : configOptions.entrySet())
+            {
+                String dc = entry.getKey();
+                if (dc.equalsIgnoreCase("replication_factor"))
+                    continue; // TODO remove this for 1.0
+                Integer replicas = Integer.valueOf(entry.getValue());
+                newDatacenters.put(dc, replicas);
+            }
         }
 
         datacenters = Collections.unmodifiableMap(newDatacenters);



Mime
View raw message