You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2010/01/27 22:18:33 UTC
svn commit: r903845 - in /incubator/cassandra/trunk: conf/storage-conf.xml
src/java/org/apache/cassandra/locator/AbstractEndpointSnitch.java
src/java/org/apache/cassandra/locator/EndPointSnitch.java
Author: jbellis
Date: Wed Jan 27 21:18:32 2010
New Revision: 903845
URL: http://svn.apache.org/viewvc?rev=903845&view=rev
Log:
update endpoint snitch comments. patch by jbellis
Modified:
incubator/cassandra/trunk/conf/storage-conf.xml
incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractEndpointSnitch.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/EndPointSnitch.java
Modified: incubator/cassandra/trunk/conf/storage-conf.xml
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/conf/storage-conf.xml?rev=903845&r1=903844&r2=903845&view=diff
==============================================================================
--- incubator/cassandra/trunk/conf/storage-conf.xml (original)
+++ incubator/cassandra/trunk/conf/storage-conf.xml Wed Jan 27 21:18:32 2010
@@ -158,9 +158,10 @@
<!--
~ EndPointSnitch: Setting this to the class that implements
- ~ IEndPointSnitch which will see if two endpoints are in the same data
- ~ center or on the same rack. Out of the box, Cassandra provides
- ~ org.apache.cassandra.locator.EndPointSnitch
+ ~ AbstractEndpointSnitch, which lets Cassandra know enough
+ ~ about your network topology to route requests efficiently.
+ ~ Out of the box, Cassandra provides org.apache.cassandra.locator.EndPointSnitch,
+ ~ and PropertyFileEndPointSnitch is available in contrib/.
-->
<EndPointSnitch>org.apache.cassandra.locator.EndPointSnitch</EndPointSnitch>
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractEndpointSnitch.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractEndpointSnitch.java?rev=903845&r1=903844&r2=903845&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractEndpointSnitch.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractEndpointSnitch.java Wed Jan 27 21:18:32 2010
@@ -25,10 +25,15 @@
import java.net.UnknownHostException;
import java.util.*;
+/**
+ * An endpoint snitch tells Cassandra information about network topology that it can use to route
+ * requests more efficiently (with "sortByProximity"). Of the abstract methods, isOnSameRack
+ * and isInSameDataCenter are always required; getLocation is only used by DatacenterShardStrategy.
+ */
public abstract class AbstractEndpointSnitch implements IEndPointSnitch
{
/**
- * Helps determine if 2 nodes are in the same rack in the data center.
+ * Determines if 2 nodes are in the same rack in the data center.
* @param host a specified endpoint
* @param host2 another specified endpoint
* @return true if on the same rack false otherwise
@@ -37,7 +42,7 @@
abstract public boolean isOnSameRack(InetAddress host, InetAddress host2) throws UnknownHostException;
/**
- * Helps determine if 2 nodes are in the same data center.
+ * Determines if 2 nodes are in the same data center.
* @param host a specified endpoint
* @param host2 another specified endpoint
* @return true if in the same data center false otherwise
@@ -46,7 +51,9 @@
abstract public boolean isInSameDataCenter(InetAddress host, InetAddress host2) throws UnknownHostException;
/**
- * Given endpoints this method will help us know the datacenter name where the node is located at.
+ * Determines the name of the datacenter this endpoint lives in.
+ * @param endpoint
+ * @return the name of the datacenter the endpoint lives in
*/
abstract public String getLocation(InetAddress endpoint) throws UnknownHostException;
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/EndPointSnitch.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/EndPointSnitch.java?rev=903845&r1=903844&r2=903845&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/EndPointSnitch.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/EndPointSnitch.java Wed Jan 27 21:18:32 2010
@@ -22,6 +22,10 @@
import java.net.UnknownHostException;
import java.util.*;
+/**
+ * A simple endpoint snitch implementation that assumes rack and dc information is encoded
+ * in the ip address.
+ */
public class EndPointSnitch extends AbstractEndpointSnitch
{
public boolean isOnSameRack(InetAddress host, InetAddress host2) throws UnknownHostException