cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r941327 - in /cassandra/branches/cassandra-0.6: CHANGES.txt conf/storage-conf.xml src/java/org/apache/cassandra/config/DatabaseDescriptor.java src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java
Date Wed, 05 May 2010 14:50:48 GMT
Author: jbellis
Date: Wed May  5 14:50:48 2010
New Revision: 941327

URL: http://svn.apache.org/viewvc?rev=941327&view=rev
Log:
make hinted handoff option global to make it easier to merge to trunk.  patch by jbellis

Modified:
    cassandra/branches/cassandra-0.6/CHANGES.txt
    cassandra/branches/cassandra-0.6/conf/storage-conf.xml
    cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
    cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java

Modified: cassandra/branches/cassandra-0.6/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/CHANGES.txt?rev=941327&r1=941326&r2=941327&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.6/CHANGES.txt Wed May  5 14:50:48 2010
@@ -5,7 +5,7 @@
  * add latency histograms to CFSMBean (CASSANDRA-1024)
  * make resolving timestamp ties deterministic by using value bytes
    as a tiebreaker (CASSANDRA-1039)
- * Add per-keyspace option to turn off Hinted Handoff (CASSANDRA-894)
+ * Add option to turn off Hinted Handoff (CASSANDRA-894)
 
 
 0.6.1

Modified: cassandra/branches/cassandra-0.6/conf/storage-conf.xml
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/conf/storage-conf.xml?rev=941327&r1=941326&r2=941327&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/conf/storage-conf.xml (original)
+++ cassandra/branches/cassandra-0.6/conf/storage-conf.xml Wed May  5 14:50:48 2010
@@ -46,6 +46,11 @@
   <AutoBootstrap>false</AutoBootstrap>
 
   <!--
+   ~ See http://wiki.apache.org/cassandra/HintedHandoff
+  -->
+  <HintedHandoffEnabled>true</HintedHandoffEnabled>
+
+  <!--
    ~ Keyspaces and ColumnFamilies:
    ~ A ColumnFamily is the Cassandra concept closest to a relational
    ~ table.  Keyspaces are separate groups of ColumnFamilies.  Except in

Modified: cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/config/DatabaseDescriptor.java?rev=941327&r1=941326&r2=941327&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
(original)
+++ cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
Wed May  5 14:50:48 2010
@@ -132,7 +132,7 @@ public class DatabaseDescriptor
     private static boolean snapshotBeforeCompaction;
     private static boolean autoBootstrap = false;
 
-    private static Map<String,Boolean> hintedHandOffByKS = new HashMap<String,Boolean>();
+    private static boolean hintedHandoffEnabled = true;
 
     private static IAuthenticator authenticator = new AllowAllAuthenticator();
 
@@ -467,6 +467,20 @@ public class DatabaseDescriptor
             if ( value != null)
                 CommitLog.setSegmentSize(Integer.parseInt(value) * 1024 * 1024);
 
+            /* should Hinted Handoff be on? */
+            String hintedHandOffStr = xmlUtils.getNodeValue("/Storage/HintedHandoffEnabled");
+            if (hintedHandOffStr != null)
+            {
+                if (hintedHandOffStr.equalsIgnoreCase("true"))
+                    hintedHandoffEnabled = true;
+                else if (hintedHandOffStr.equalsIgnoreCase("false"))
+                    hintedHandoffEnabled = false;
+                else
+                    throw new ConfigurationException("Unrecognized value for HintedHandoff.
 Use 'true' or 'false'.");
+            }
+            if (logger.isDebugEnabled())
+                logger.debug("setting hintedHandoffEnabled to " + hintedHandoffEnabled);
+
             readTablesFromXml();
             if (tables.isEmpty())
                 throw new ConfigurationException("No keyspaces configured");
@@ -621,17 +635,6 @@ public class DatabaseDescriptor
                     throw new ConfigurationException("Invalid endpointsnitch class " + endPointSnitchClassName
+ " " + e.getMessage());
                 }
 
-                /* should Hinted Handoff be on? */
-                String hintedHandOffStr = xmlUtils.getNodeValue("/Storage/Keyspaces/Keyspace[@Name='"
+ ksName + "']/HintedHandoff");
-                if (hintedHandOffStr == null || hintedHandOffStr.equalsIgnoreCase("true"))
-                    hintedHandOffByKS.put(ksName, true);
-                else if (hintedHandOffStr.equalsIgnoreCase("false"))
-                    hintedHandOffByKS.put(ksName, false);
-                else
-                    throw new ConfigurationException("Unrecognized value for HintedHandoff.
 Use 'true' or 'false'.");
-                if (logger.isDebugEnabled())
-                    logger.debug("setting hintedHandOff to " + hintedHandOffByKS.get(ksName).toString()
+ " for " + ksName);
-
                 String xqlTable = "/Storage/Keyspaces/Keyspace[@Name='" + ksName + "']/";
                 NodeList columnFamilies = xmlUtils.getRequestedNodeList(xqlTable + "ColumnFamily");
 
@@ -1222,8 +1225,8 @@ public class DatabaseDescriptor
         return autoBootstrap;
     }
 
-    public static boolean isHintedHandOff(String table)
+    public static boolean hintedHandoffEnabled()
     {
-        return hintedHandOffByKS.get(table);
+        return hintedHandoffEnabled;
     }
 }

Modified: cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java?rev=941327&r1=941326&r2=941327&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java
(original)
+++ cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java
Wed May  5 14:50:48 2010
@@ -29,7 +29,6 @@ import com.google.common.collect.Multima
 import org.apache.cassandra.dht.Range;
 import org.apache.cassandra.dht.Token;
 import org.apache.cassandra.gms.FailureDetector;
-import org.apache.cassandra.gms.Gossiper;
 import org.apache.cassandra.service.WriteResponseHandler;
 import org.apache.cassandra.thrift.ConsistencyLevel;
 import org.apache.cassandra.utils.FBUtilities;
@@ -88,7 +87,7 @@ public abstract class AbstractReplicatio
         }
 
         // if everything was alive or we're not doing HH on this keyspace, stop with just
the live nodes
-        if (map.size() == targets.size() || !DatabaseDescriptor.isHintedHandOff(table))
+        if (map.size() == targets.size() || !DatabaseDescriptor.hintedHandoffEnabled())
             return map;
 
         // assign dead endpoints to be hinted to the closest live one, or to the local node



Mime
View raw message