Author: jbellis Date: Mon Apr 19 20:11:10 2010 New Revision: 935726 URL: http://svn.apache.org/viewvc?rev=935726&view=rev Log: add SimpleSnitch and make it the default patch by Erick Tryzelaar; reviewed by jbellis for CASSANDRA-994
Added: cassandra/trunk/src/java/org/apache/cassandra/locator/SimpleSnitch.java Modified: cassandra/trunk/conf/cassandra.xml cassandra/trunk/test/conf/cassandra.xml Modified: cassandra/trunk/conf/cassandra.xml URL: http://svn.apache.org/viewvc/cassandra/trunk/conf/cassandra.xml?rev=935726&r1=935725&r2=935726&view=diff ============================================================================== --- cassandra/trunk/conf/cassandra.xml (original) +++ cassandra/trunk/conf/cassandra.xml Mon Apr 19 20:11:10 2010 @@ -53,7 +53,7 @@ ~ org.apache.cassandra.locator.RackInferringSnitch and ~ org.apache.cassandra.locator.PropertyFileSnitch. --> - <EndpointSnitch>org.apache.cassandra.locator.RackInferringSnitch</EndpointSnitch> + <EndpointSnitch>org.apache.cassandra.locator.SimpleSnitch</EndpointSnitch> <!-- ~ Keyspaces and ColumnFamilies: Added: cassandra/trunk/src/java/org/apache/cassandra/locator/SimpleSnitch.java URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/locator/SimpleSnitch.java?rev=935726&view=auto ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/locator/SimpleSnitch.java (added) +++ cassandra/trunk/src/java/org/apache/cassandra/locator/SimpleSnitch.java Mon Apr 19 20:11:10 2010 @@ -0,0 +1,40 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.cassandra.locator; + +import java.net.InetAddress; +import java.util.*; + +/** + * A simple endpoint snitch implementation does not sort addresses by + * proximity. + */ +public class SimpleSnitch implements IEndpointSnitch +{ + public List<InetAddress> getSortedListByProximity(final InetAddress address, Collection<InetAddress> addresses) + { + List<InetAddress> list = new ArrayList<InetAddress>(addresses); + return list; + } + + public List<InetAddress> sortByProximity(final InetAddress address, List<InetAddress> addresses) + { + return addresses; + } +} Modified: cassandra/trunk/test/conf/cassandra.xml URL: http://svn.apache.org/viewvc/cassandra/trunk/test/conf/cassandra.xml?rev=935726&r1=935725&r2=935726&view=diff ============================================================================== --- cassandra/trunk/test/conf/cassandra.xml (original) +++ cassandra/trunk/test/conf/cassandra.xml Mon Apr 19 20:11:10 2010 @@ -37,7 +37,7 @@ <DiskAccessMode>mmap</DiskAccessMode> <MemtableThroughputInMB>1</MemtableThroughputInMB> <MemtableOperationsInMillions>0.00002</MemtableOperationsInMillions> <!-- 20 --> - <EndpointSnitch>org.apache.cassandra.locator.RackInferringSnitch</EndpointSnitch> + <EndpointSnitch>org.apache.cassandra.locator.SimpleSnitch</EndpointSnitch> <Keyspaces> <Keyspace Name = "Keyspace1"> <ColumnFamily Name="Standard1" RowsCached="10%" KeysCached="0"/>