Author: jbellis Date: Sun Aug 15 16:16:58 2010 New Revision: 985701 URL: http://svn.apache.org/viewvc?rev=985701&view=rev Log: rename RackAwareStrategy to OldNetworkTopologyStrategy, RackUnawareStrategy to SimpleStrategy, DatacenterShardStrategy to NetworkTopologyStrategy, AbstractRackAwareSnitch to AbstractNetworkTopologySnitch patch by jbellis; reviewed by brandonwilliams for CASSANDRA-1392
Added: cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractNetworkTopologySnitch.java - copied, changed from r985536, cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractRackAwareSnitch.java cassandra/trunk/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java - copied, changed from r985536, cassandra/trunk/src/java/org/apache/cassandra/locator/DatacenterShardStrategy.java cassandra/trunk/src/java/org/apache/cassandra/locator/OldNetworkTopologyStrategy.java - copied, changed from r985536, cassandra/trunk/src/java/org/apache/cassandra/locator/RackAwareStrategy.java cassandra/trunk/src/java/org/apache/cassandra/locator/SimpleStrategy.java - copied, changed from r985536, cassandra/trunk/src/java/org/apache/cassandra/locator/RackUnawareStrategy.java cassandra/trunk/test/unit/org/apache/cassandra/locator/NetworkTopologyStrategyTest.java - copied, changed from r985536, cassandra/trunk/test/unit/org/apache/cassandra/locator/DatacenterShardStrategyTest.java cassandra/trunk/test/unit/org/apache/cassandra/locator/OldNetworkTopologyStrategyTest.java - copied, changed from r985536, cassandra/trunk/test/unit/org/apache/cassandra/locator/RackAwareStrategyTest.java cassandra/trunk/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java - copied, changed from r985536, cassandra/trunk/test/unit/org/apache/cassandra/locator/RackUnawareStrategyTest.java Removed: cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractRackAwareSnitch.java cassandra/trunk/src/java/org/apache/cassandra/locator/DatacenterShardStrategy.java cassandra/trunk/src/java/org/apache/cassandra/locator/RackAwareStrategy.java cassandra/trunk/src/java/org/apache/cassandra/locator/RackUnawareStrategy.java cassandra/trunk/test/unit/org/apache/cassandra/locator/DatacenterShardStrategyTest.java cassandra/trunk/test/unit/org/apache/cassandra/locator/RackAwareStrategyTest.java cassandra/trunk/test/unit/org/apache/cassandra/locator/RackUnawareStrategyTest.java Modified: cassandra/trunk/CHANGES.txt cassandra/trunk/NEWS.txt cassandra/trunk/conf/README.txt cassandra/trunk/conf/cassandra.yaml cassandra/trunk/contrib/word_count/src/WordCountSetup.java cassandra/trunk/interface/cassandra.thrift cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ConsistencyLevel.java cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java cassandra/trunk/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java cassandra/trunk/src/java/org/apache/cassandra/locator/RackInferringSnitch.java cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterQuorumResponseHandler.java cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterSyncWriteResponseHandler.java cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterWriteResponseHandler.java cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java cassandra/trunk/test/conf/cassandra.yaml cassandra/trunk/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java cassandra/trunk/test/unit/org/apache/cassandra/hadoop/ColumnFamilyOutputFormatTest.java cassandra/trunk/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java cassandra/trunk/test/unit/org/apache/cassandra/service/MoveTest.java Modified: cassandra/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/cassandra/trunk/CHANGES.txt?rev=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/CHANGES.txt (original) +++ cassandra/trunk/CHANGES.txt Sun Aug 15 16:16:58 2010 @@ -7,6 +7,9 @@ dev * dropping a keyspace with no column families generated an error (CASSANDRA-1378) * optimize [Time|Lexical]UUIDType comparison further (CASSANDRA-1368) + * rename RackAwareStrategy to OldNetworkTopologyStrategy, RackUnawareStrategy + to SimpleStrategy, DatacenterShardStrategy to NetworkTopologyStrategy, + AbstractRackAwareSnitch to AbstractNetworkTopologySnitch (CASSANDRA-1392) 0.7-beta1 Modified: cassandra/trunk/NEWS.txt URL: http://svn.apache.org/viewvc/cassandra/trunk/NEWS.txt?rev=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/NEWS.txt (original) +++ cassandra/trunk/NEWS.txt Sun Aug 15 16:16:58 2010 @@ -10,9 +10,9 @@ Features - A new ByteOrderedPartitioner supports bytes keys with arbitrary content, and orders keys by their byte value. - Truncate thrift method allows clearing an entire ColumnFamily at once - - DatacenterShardStrategy is ready for use, enabling - ConsitencyLevel.DCQUORUM and DCQUORUMSYNC. See comments in - `cassandra.yaml.` + - NetworkTopologyStrategy (formerly DatacenterShardStrategy) is ready for + use, enabling ConsitencyLevel.DCQUORUM and DCQUORUMSYNC. See comments + in `cassandra.yaml.` - row size limit increased from 2GB to 2 billion columns - Hadoop OutputFormat support - Streaming data for repair or node movement no longer requires @@ -47,7 +47,7 @@ Configuraton has been added. - RowWarningThresholdInMB replaced with in_memory_compaction_limit_in_mb - GCGraceSeconds is now per-ColumnFamily instead of global - - Configuration of DatacenterShardStrategy is now a part of the keyspace + - Configuration of NetworkTopologyStrategy is now a part of the keyspace definition using the strategy_options attribute. The datacenter.properties file is no longer used. Modified: cassandra/trunk/conf/README.txt URL: http://svn.apache.org/viewvc/cassandra/trunk/conf/README.txt?rev=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/conf/README.txt (original) +++ cassandra/trunk/conf/README.txt Sun Aug 15 16:16:58 2010 @@ -11,4 +11,3 @@ Optional configuration files access.properties: used for authorization passwd.properties: used for authentication cassandra-rack.properties: used by PropertyFileSnitch -datacenters.properties: used by DatacenterShardStrategy Modified: cassandra/trunk/conf/cassandra.yaml URL: http://svn.apache.org/viewvc/cassandra/trunk/conf/cassandra.yaml?rev=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/conf/cassandra.yaml (original) +++ cassandra/trunk/conf/cassandra.yaml Sun Aug 15 16:16:58 2010 @@ -189,32 +189,34 @@ request_scheduler_id: keyspace # are distributed among nodes. Contains both the class as well as # configuration information. Must extend AbstractReplicationStrategy. # Out of the box, Cassandra provides -# * org.apache.cassandra.locator.RackUnawareStrategy -# * org.apache.cassandra.locator.RackAwareStrategy -# * org.apache.cassandra.locator.DatacenterShardStrategy +# * org.apache.cassandra.locator.SimpleStrategy +# * org.apache.cassandra.locator.NetworkTopologyStrategy +# * org.apache.cassandra.locator.OldNetworkTopologyStrategy # -# RackUnawareStrategy is the simplest; it simply places the first +# SimpleStrategy merely places the first # replica at the node whose token is closest to the key (as determined # by the Partitioner), and additional replicas on subsequent nodes # along the ring in increasing Token order. # -# RackAwareStrategy is special cased for replication_factor of 3. It -# places one replica in each of two datacenters, and the third on a -# different rack in in the first. -# -# DatacenterShardStrategy is a generalization of RackAwareStrategy. -# For each datacenter, you can specify how many replicas you want +# With NetworkTopologyStrategy, +# for each datacenter, you can specify how many replicas you want # on a per-keyspace basis. Replicas are placed on different racks # within each DC, if possible. This strategy also requires rack aware # snitch, such as RackInferringSnitch or PropertyFileSnitch. # An example: # - name: Keyspace1 -# replica_placement_strategy: org.apache.cassandra.locator.DatacenterShardStrategy +# replica_placement_strategy: org.apache.cassandra.locator.NetworkTopologyStrategy # strategy_options: # DC1 : 3 # DC2 : 2 # DC3 : 1 # +# OldNetworkToplogyStrategy [formerly RackAwareStrategy] +# places one replica in each of two datacenters, and the third on a +# different rack in in the first. Additional datacenters are not +# guaranteed to get a replica. Additional replicas after three are placed +# in ring order after the third without regard to rack or datacenter. +# # - replication_factor: Number of replicas of each row # - column_families: column families associated with this keyspace # @@ -255,7 +257,7 @@ request_scheduler_id: keyspace # http://wiki.apache.org/cassandra/FAQ#no_keyspaces for an explanation. keyspaces: - name: Keyspace1 - replica_placement_strategy: org.apache.cassandra.locator.RackUnawareStrategy + replica_placement_strategy: org.apache.cassandra.locator.SimpleStrategy replication_factor: 1 column_families: - name: Standard1 Modified: cassandra/trunk/contrib/word_count/src/WordCountSetup.java URL: http://svn.apache.org/viewvc/cassandra/trunk/contrib/word_count/src/WordCountSetup.java?rev=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/contrib/word_count/src/WordCountSetup.java (original) +++ cassandra/trunk/contrib/word_count/src/WordCountSetup.java Sun Aug 15 16:16:58 2010 @@ -100,7 +100,7 @@ public class WordCountSetup CfDef cfDef = new CfDef(WordCount.KEYSPACE, WordCount.COLUMN_FAMILY); cfDefList.add(cfDef); - client.system_add_keyspace(new KsDef(WordCount.KEYSPACE, "org.apache.cassandra.locator.RackUnawareStrategy", 1, cfDefList)); + client.system_add_keyspace(new KsDef(WordCount.KEYSPACE, "org.apache.cassandra.locator.SimpleStrategy", 1, cfDefList)); } private static Cassandra.Iface createConnection() throws TTransportException Modified: cassandra/trunk/interface/cassandra.thrift URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/cassandra.thrift?rev=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/interface/cassandra.thrift (original) +++ cassandra/trunk/interface/cassandra.thrift Sun Aug 15 16:16:58 2010 @@ -153,8 +153,8 @@ exception AuthorizationException { * ANY Ensure that the write has been written once somewhere, including possibly being hinted in a non-target node. * ONE Ensure that the write has been written to at least 1 node's commit log and memory table * QUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes - * DCQUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes, within the local datacenter (requires DatacenterShardStrategy) - * DCQUORUMSYNC Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes in each datacenter (requires DatacenterShardStrategy) + * DCQUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes, within the local datacenter (requires NetworkTopologyStrategy) + * DCQUORUMSYNC Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes in each datacenter (requires NetworkTopologyStrategy) * ALL Ensure that the write is written to <code><ReplicationFactor></code> nodes before responding to the client. * * Read: Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ConsistencyLevel.java URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ConsistencyLevel.java?rev=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ConsistencyLevel.java (original) +++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ConsistencyLevel.java Sun Aug 15 16:16:58 2010 @@ -45,8 +45,8 @@ import org.apache.thrift.TEnum; * ANY Ensure that the write has been written once somewhere, including possibly being hinted in a non-target node. * ONE Ensure that the write has been written to at least 1 node's commit log and memory table * QUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes - * DCQUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes, within the local datacenter (requires DatacenterShardStrategy) - * DCQUORUMSYNC Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes in each datacenter (requires DatacenterShardStrategy) + * DCQUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes, within the local datacenter (requires NetworkTopologyStrategy) + * DCQUORUMSYNC Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes in each datacenter (requires NetworkTopologyStrategy) * ALL Ensure that the write is written to <code><ReplicationFactor></code> nodes before responding to the client. * * Read: Modified: cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java?rev=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java Sun Aug 15 16:16:58 2010 @@ -231,13 +231,13 @@ public class CliClient css_.out.println(" replicated. Valid entries are integers greater than 0."); css_.out.println(" placement_strategy: the fully qualified class used to place replicas in"); css_.out.println(" this keyspace. Valid values are"); - css_.out.println(" org.apache.cassandra.locator.RackUnawareStrategy,"); - css_.out.println(" org.apache.cassandra.locator.DatacenterShardStrategy,"); - css_.out.println(" and org.apache.cassandra.locator.RackAwareStrategy"); + css_.out.println(" org.apache.cassandra.locator.SimpleStrategy,"); + css_.out.println(" org.apache.cassandra.locator.NetworkTopologyStrategy,"); + css_.out.println(" and org.apache.cassandra.locator.OldNetworkTopologyStrategy"); css_.out.println(""); css_.out.println("example:"); css_.out.println("create keyspace foo with replication_factor = 3 and "); - css_.out.println(" placement_strategy = 'org.apache.cassandra.locator.RackUnawareStrategy'"); + css_.out.println(" placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'"); break; case CliParser.NODE_ADD_COLUMN_FAMILY: @@ -716,7 +716,7 @@ public class CliClient assert(newKSSpec.getChildCount() % 2 == 1); //defaults - String replicaPlacementStrategy = "org.apache.cassandra.locator.RackUnawareStrategy"; + String replicaPlacementStrategy = "org.apache.cassandra.locator.SimpleStrategy"; int replicationFactor = 2; /* Modified: cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java?rev=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java Sun Aug 15 16:16:58 2010 @@ -524,10 +524,12 @@ public class DatabaseDescriptor { throw new ConfigurationException("Missing replica_placement_strategy directive for " + keyspace.name); } + String strategyClassName = keyspace.replica_placement_strategy.replace("RackUnawareStrategy", "SimpleStrategy") + .replace("RackAwareStrategy", "OldNetworkTopologyStrategy"); Class<? extends AbstractReplicationStrategy> strategyClass = null; try { - strategyClass = (Class<? extends AbstractReplicationStrategy>) Class.forName(keyspace.replica_placement_strategy); + strategyClass = (Class<? extends AbstractReplicationStrategy>) Class.forName(strategyClassName); } catch (ClassNotFoundException e) { 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=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java Sun Aug 15 16:16:58 2010 @@ -19,17 +19,16 @@ package org.apache.cassandra.config; import org.apache.cassandra.locator.AbstractReplicationStrategy; -import org.apache.cassandra.locator.RackUnawareStrategy; +import org.apache.cassandra.locator.SimpleStrategy; import org.apache.cassandra.io.SerDeUtils; -import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; -import java.util.List; import java.util.Map; import org.apache.avro.util.Utf8; + import org.apache.commons.lang.ObjectUtils; public final class KSMetaData @@ -43,7 +42,7 @@ public final class KSMetaData public KSMetaData(String name, Class<? extends AbstractReplicationStrategy> strategyClass, Map<String, String> strategyOptions, int replicationFactor, CFMetaData... cfDefs) { this.name = name; - this.strategyClass = strategyClass == null ? RackUnawareStrategy.class : strategyClass; + this.strategyClass = strategyClass == null ? SimpleStrategy.class : strategyClass; this.strategyOptions = strategyOptions; this.replicationFactor = replicationFactor; Map<String, CFMetaData> cfmap = new HashMap<String, CFMetaData>(); Copied: cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractNetworkTopologySnitch.java (from r985536, cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractRackAwareSnitch.java) URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractNetworkTopologySnitch.java?p2=cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractNetworkTopologySnitch.java&p1=cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractRackAwareSnitch.java&r1=985536&r2=985701&rev=985701&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractRackAwareSnitch.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractNetworkTopologySnitch.java Sun Aug 15 16:16:58 2010 @@ -29,7 +29,7 @@ import java.util.*; * An endpoint snitch tells Cassandra information about network topology that it can use to route * requests more efficiently. */ -public abstract class AbstractRackAwareSnitch extends AbstractEndpointSnitch +public abstract class AbstractNetworkTopologySnitch extends AbstractEndpointSnitch { /** * Return the rack for which an endpoint resides in Copied: cassandra/trunk/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java (from r985536, cassandra/trunk/src/java/org/apache/cassandra/locator/DatacenterShardStrategy.java) URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java?p2=cassandra/trunk/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java&p1=cassandra/trunk/src/java/org/apache/cassandra/locator/DatacenterShardStrategy.java&r1=985536&r2=985701&rev=985701&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/locator/DatacenterShardStrategy.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java Sun Aug 15 16:16:58 2010 @@ -21,12 +21,10 @@ package org.apache.cassandra.locator; -import java.io.*; import java.net.InetAddress; import java.util.*; import java.util.Map.Entry; -import org.apache.cassandra.config.DatabaseDescriptor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,16 +47,16 @@ import org.apache.cassandra.thrift.Consi * This class also caches the Endpoints and invalidates the cache if there is a * change in the number of tokens. */ -public class DatacenterShardStrategy extends AbstractReplicationStrategy +public class NetworkTopologyStrategy extends AbstractReplicationStrategy { - private AbstractRackAwareSnitch snitch; + private AbstractNetworkTopologySnitch snitch; private Map<String, Integer> datacenters; - private static final Logger logger = LoggerFactory.getLogger(DatacenterShardStrategy.class); + private static final Logger logger = LoggerFactory.getLogger(NetworkTopologyStrategy.class); - public DatacenterShardStrategy(String table, TokenMetadata tokenMetadata, IEndpointSnitch snitch, Map<String, String> configOptions) throws ConfigurationException + public NetworkTopologyStrategy(String table, TokenMetadata tokenMetadata, IEndpointSnitch snitch, Map<String, String> configOptions) throws ConfigurationException { super(table, tokenMetadata, snitch, configOptions); - this.snitch = (AbstractRackAwareSnitch)snitch; + this.snitch = (AbstractNetworkTopologySnitch)snitch; Map<String, Integer> newDatacenters = new HashMap<String, Integer>(); for (Entry entry : configOptions.entrySet()) Copied: cassandra/trunk/src/java/org/apache/cassandra/locator/OldNetworkTopologyStrategy.java (from r985536, cassandra/trunk/src/java/org/apache/cassandra/locator/RackAwareStrategy.java) URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/locator/OldNetworkTopologyStrategy.java?p2=cassandra/trunk/src/java/org/apache/cassandra/locator/OldNetworkTopologyStrategy.java&p1=cassandra/trunk/src/java/org/apache/cassandra/locator/RackAwareStrategy.java&r1=985536&r2=985701&rev=985701&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/locator/RackAwareStrategy.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/locator/OldNetworkTopologyStrategy.java Sun Aug 15 16:16:58 2010 @@ -22,7 +22,6 @@ package org.apache.cassandra.locator; import java.net.InetAddress; import java.util.*; -import org.apache.cassandra.config.DatabaseDescriptor; import org.apache.cassandra.dht.Token; /** @@ -32,9 +31,9 @@ import org.apache.cassandra.dht.Token; * the third replica in a different rack in the first datacenter, and * any remaining replicas on the first unused nodes on the ring. */ -public class RackAwareStrategy extends AbstractReplicationStrategy +public class OldNetworkTopologyStrategy extends AbstractReplicationStrategy { - public RackAwareStrategy(String table, TokenMetadata tokenMetadata, IEndpointSnitch snitch, Map<String, String> configOptions) + public OldNetworkTopologyStrategy(String table, TokenMetadata tokenMetadata, IEndpointSnitch snitch, Map<String, String> configOptions) { super(table, tokenMetadata, snitch, configOptions); } @@ -56,7 +55,7 @@ public class RackAwareStrategy extends A boolean bOtherRack = false; while (endpoints.size() < replicas && iter.hasNext()) { - AbstractRackAwareSnitch snitch = (AbstractRackAwareSnitch) this.snitch; + AbstractNetworkTopologySnitch snitch = (AbstractNetworkTopologySnitch) this.snitch; // First try to find one in a different data center Token t = iter.next(); Modified: cassandra/trunk/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java?rev=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java Sun Aug 15 16:16:58 2010 @@ -37,7 +37,7 @@ import org.apache.cassandra.utils.Wrappe * <p/> * Based on a properties file configuration. */ -public class PropertyFileSnitch extends AbstractRackAwareSnitch +public class PropertyFileSnitch extends AbstractNetworkTopologySnitch { /** * A list of properties with keys being host:port and values being datacenter:rack Modified: cassandra/trunk/src/java/org/apache/cassandra/locator/RackInferringSnitch.java URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/locator/RackInferringSnitch.java?rev=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/locator/RackInferringSnitch.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/locator/RackInferringSnitch.java Sun Aug 15 16:16:58 2010 @@ -24,7 +24,7 @@ import java.net.InetAddress; * A simple endpoint snitch implementation that assumes datacenter and rack information is encoded * in the 2nd and 3rd octets of the ip address, respectively. */ -public class RackInferringSnitch extends AbstractRackAwareSnitch +public class RackInferringSnitch extends AbstractNetworkTopologySnitch { public String getRack(InetAddress endpoint) { Copied: cassandra/trunk/src/java/org/apache/cassandra/locator/SimpleStrategy.java (from r985536, cassandra/trunk/src/java/org/apache/cassandra/locator/RackUnawareStrategy.java) URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/locator/SimpleStrategy.java?p2=cassandra/trunk/src/java/org/apache/cassandra/locator/SimpleStrategy.java&p1=cassandra/trunk/src/java/org/apache/cassandra/locator/RackUnawareStrategy.java&r1=985536&r2=985701&rev=985701&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/locator/RackUnawareStrategy.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/locator/SimpleStrategy.java Sun Aug 15 16:16:58 2010 @@ -30,9 +30,9 @@ import org.apache.cassandra.dht.Token; * returns the RF nodes that lie right next to each other * on the ring. */ -public class RackUnawareStrategy extends AbstractReplicationStrategy +public class SimpleStrategy extends AbstractReplicationStrategy { - public RackUnawareStrategy(String table, TokenMetadata tokenMetadata, IEndpointSnitch snitch, Map<String, String> configOptions) + public SimpleStrategy(String table, TokenMetadata tokenMetadata, IEndpointSnitch snitch, Map<String, String> configOptions) { super(table, tokenMetadata, snitch, configOptions); } Modified: cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterQuorumResponseHandler.java URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterQuorumResponseHandler.java?rev=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterQuorumResponseHandler.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterQuorumResponseHandler.java Sun Aug 15 16:16:58 2010 @@ -24,9 +24,8 @@ package org.apache.cassandra.service; import java.util.concurrent.atomic.AtomicInteger; import org.apache.cassandra.config.DatabaseDescriptor; -import org.apache.cassandra.locator.AbstractRackAwareSnitch; -import org.apache.cassandra.locator.DatacenterShardStrategy; -import org.apache.cassandra.locator.RackInferringSnitch; +import org.apache.cassandra.locator.AbstractNetworkTopologySnitch; +import org.apache.cassandra.locator.NetworkTopologyStrategy; import org.apache.cassandra.net.Message; import org.apache.cassandra.thrift.ConsistencyLevel; import org.apache.cassandra.utils.FBUtilities; @@ -36,7 +35,7 @@ import org.apache.cassandra.utils.FBUtil */ public class DatacenterQuorumResponseHandler<T> extends QuorumResponseHandler<T> { - private static final AbstractRackAwareSnitch snitch = (AbstractRackAwareSnitch) DatabaseDescriptor.getEndpointSnitch(); + private static final AbstractNetworkTopologySnitch snitch = (AbstractNetworkTopologySnitch) DatabaseDescriptor.getEndpointSnitch(); private static final String localdc = snitch.getDatacenter(FBUtilities.getLocalAddress()); private AtomicInteger localResponses; @@ -65,7 +64,7 @@ public class DatacenterQuorumResponseHan @Override public int determineBlockFor(ConsistencyLevel consistency_level, String table) { - DatacenterShardStrategy stategy = (DatacenterShardStrategy) StorageService.instance.getReplicationStrategy(table); + NetworkTopologyStrategy stategy = (NetworkTopologyStrategy) StorageService.instance.getReplicationStrategy(table); return (stategy.getReplicationFactor(localdc) / 2) + 1; } } Modified: cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterSyncWriteResponseHandler.java URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterSyncWriteResponseHandler.java?rev=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterSyncWriteResponseHandler.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterSyncWriteResponseHandler.java Sun Aug 15 16:16:58 2010 @@ -25,15 +25,14 @@ package org.apache.cassandra.service; import java.net.InetAddress; -import java.net.UnknownHostException; import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import org.apache.cassandra.config.DatabaseDescriptor; -import org.apache.cassandra.locator.AbstractRackAwareSnitch; -import org.apache.cassandra.locator.DatacenterShardStrategy; +import org.apache.cassandra.locator.AbstractNetworkTopologySnitch; +import org.apache.cassandra.locator.NetworkTopologyStrategy; import org.apache.cassandra.net.Message; import org.apache.cassandra.thrift.ConsistencyLevel; import org.apache.cassandra.thrift.UnavailableException; @@ -46,7 +45,7 @@ import org.apache.cassandra.utils.FBUtil */ public class DatacenterSyncWriteResponseHandler extends AbstractWriteResponseHandler { - private static final AbstractRackAwareSnitch snitch = (AbstractRackAwareSnitch) DatabaseDescriptor.getEndpointSnitch(); + private static final AbstractNetworkTopologySnitch snitch = (AbstractNetworkTopologySnitch) DatabaseDescriptor.getEndpointSnitch(); private static final String localdc; static @@ -54,7 +53,7 @@ public class DatacenterSyncWriteResponse localdc = snitch.getDatacenter(FBUtilities.getLocalAddress()); } - private final DatacenterShardStrategy strategy; + private final NetworkTopologyStrategy strategy; private HashMap<String, AtomicInteger> responses = new HashMap<String, AtomicInteger>(); public DatacenterSyncWriteResponseHandler(Collection<InetAddress> writeEndpoints, Multimap<InetAddress, InetAddress> hintedEndpoints, ConsistencyLevel consistencyLevel, String table) @@ -63,7 +62,7 @@ public class DatacenterSyncWriteResponse super(writeEndpoints, hintedEndpoints, consistencyLevel); assert consistencyLevel == ConsistencyLevel.DCQUORUM; - strategy = (DatacenterShardStrategy) StorageService.instance.getReplicationStrategy(table); + strategy = (NetworkTopologyStrategy) StorageService.instance.getReplicationStrategy(table); for (String dc : strategy.getDatacenters()) { Modified: cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterWriteResponseHandler.java URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterWriteResponseHandler.java?rev=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterWriteResponseHandler.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterWriteResponseHandler.java Sun Aug 15 16:16:58 2010 @@ -25,13 +25,11 @@ package org.apache.cassandra.service; import java.net.InetAddress; -import java.net.UnknownHostException; import java.util.Collection; -import java.util.concurrent.atomic.AtomicInteger; import org.apache.cassandra.config.DatabaseDescriptor; -import org.apache.cassandra.locator.AbstractRackAwareSnitch; -import org.apache.cassandra.locator.DatacenterShardStrategy; +import org.apache.cassandra.locator.AbstractNetworkTopologySnitch; +import org.apache.cassandra.locator.NetworkTopologyStrategy; import org.apache.cassandra.net.Message; import org.apache.cassandra.thrift.ConsistencyLevel; import org.apache.cassandra.thrift.UnavailableException; @@ -44,7 +42,7 @@ import com.google.common.collect.Multima */ public class DatacenterWriteResponseHandler extends WriteResponseHandler { - private static final AbstractRackAwareSnitch snitch = (AbstractRackAwareSnitch) DatabaseDescriptor.getEndpointSnitch(); + private static final AbstractNetworkTopologySnitch snitch = (AbstractNetworkTopologySnitch) DatabaseDescriptor.getEndpointSnitch(); private static final String localdc; static @@ -62,7 +60,7 @@ public class DatacenterWriteResponseHand @Override protected int determineBlockFor(String table) { - DatacenterShardStrategy strategy = (DatacenterShardStrategy) StorageService.instance.getReplicationStrategy(table); + NetworkTopologyStrategy strategy = (NetworkTopologyStrategy) StorageService.instance.getReplicationStrategy(table); return (strategy.getReplicationFactor(localdc) / 2) + 1; } Modified: cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java?rev=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java Sun Aug 15 16:16:58 2010 @@ -34,13 +34,12 @@ import org.apache.cassandra.db.marshal.M import org.apache.cassandra.dht.IPartitioner; import org.apache.cassandra.dht.RandomPartitioner; import org.apache.cassandra.dht.Token; -import org.apache.cassandra.locator.DatacenterShardStrategy; import org.apache.cassandra.service.StorageService; import org.apache.cassandra.utils.FBUtilities; public class ThriftValidation { - private static final Logger logger = LoggerFactory.getLogger(DatacenterShardStrategy.class); + private static final Logger logger = LoggerFactory.getLogger(ThriftValidation.class); static void validateKey(byte[] key) throws InvalidRequestException { Modified: cassandra/trunk/test/conf/cassandra.yaml URL: http://svn.apache.org/viewvc/cassandra/trunk/test/conf/cassandra.yaml?rev=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/test/conf/cassandra.yaml (original) +++ cassandra/trunk/test/conf/cassandra.yaml Sun Aug 15 16:16:58 2010 @@ -26,7 +26,7 @@ request_scheduler: org.apache.cassandra. request_scheduler_id: keyspace keyspaces: - name: Keyspace1 - replica_placement_strategy: org.apache.cassandra.locator.RackUnawareStrategy + replica_placement_strategy: org.apache.cassandra.locator.SimpleStrategy replication_factor: 1 column_families: - name: Standard1 @@ -77,7 +77,7 @@ keyspaces: index_type: KEYS - name: Keyspace2 - replica_placement_strategy: org.apache.cassandra.locator.RackUnawareStrategy + replica_placement_strategy: org.apache.cassandra.locator.SimpleStrategy replication_factor: 1 column_families: @@ -93,14 +93,14 @@ keyspaces: compare_subcolumns_with: TimeUUIDType - name: Keyspace3 - replica_placement_strategy: org.apache.cassandra.locator.RackUnawareStrategy + replica_placement_strategy: org.apache.cassandra.locator.SimpleStrategy replication_factor: 5 column_families: - name: Standard1 - name: Keyspace4 - replica_placement_strategy: org.apache.cassandra.locator.RackUnawareStrategy + replica_placement_strategy: org.apache.cassandra.locator.SimpleStrategy replication_factor: 3 column_families: @@ -116,7 +116,7 @@ keyspaces: compare_subcolumns_with: TimeUUIDType - name: Keyspace5 - replica_placement_strategy: org.apache.cassandra.locator.RackUnawareStrategy + replica_placement_strategy: org.apache.cassandra.locator.SimpleStrategy replication_factor: 2 column_families: Modified: cassandra/trunk/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java?rev=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java Sun Aug 15 16:16:58 2010 @@ -22,15 +22,13 @@ import static org.junit.Assert.assertNot import org.apache.avro.specific.SpecificRecord; -import org.apache.cassandra.config.avro.KsDef; import org.apache.cassandra.CleanupHelper; import org.apache.cassandra.db.migration.AddKeyspace; -import org.apache.cassandra.locator.RackUnawareStrategy; +import org.apache.cassandra.locator.SimpleStrategy; import org.apache.cassandra.io.SerDeUtils; -import org.apache.cassandra.io.util.OutputBuffer; + import org.junit.Test; -import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.UUID; @@ -86,9 +84,9 @@ public class DatabaseDescriptorTest assert DatabaseDescriptor.getNonSystemTables().size() == 0; // add a few. - AddKeyspace ks0 = new AddKeyspace(new KSMetaData("ks0", RackUnawareStrategy.class, null, 3)); + AddKeyspace ks0 = new AddKeyspace(new KSMetaData("ks0", SimpleStrategy.class, null, 3)); ks0.apply(); - AddKeyspace ks1 = new AddKeyspace(new KSMetaData("ks1", RackUnawareStrategy.class, null, 3)); + AddKeyspace ks1 = new AddKeyspace(new KSMetaData("ks1", SimpleStrategy.class, null, 3)); ks1.apply(); assert DatabaseDescriptor.getTableDefinition("ks0") != null; Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java?rev=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java Sun Aug 15 16:16:58 2010 @@ -33,7 +33,7 @@ import org.apache.cassandra.db.filter.Qu import org.apache.cassandra.db.marshal.BytesType; import org.apache.cassandra.db.marshal.UTF8Type; import org.apache.cassandra.db.migration.*; -import org.apache.cassandra.locator.RackUnawareStrategy; +import org.apache.cassandra.locator.SimpleStrategy; import org.apache.cassandra.utils.FBUtilities; import org.apache.cassandra.utils.UUIDGen; @@ -272,7 +272,7 @@ public class DefsTest extends CleanupHel { DecoratedKey dk = Util.dk("key0"); CFMetaData newCf = new CFMetaData("NewKeyspace1", "AddedStandard1", ColumnFamilyType.Standard, ClockType.Timestamp, UTF8Type.instance, null, new TimestampReconciler(), "A new cf for a new ks", 0, false, 1.0, 0, 864000, Collections.<byte[], ColumnDefinition>emptyMap()); - KSMetaData newKs = new KSMetaData(newCf.tableName, RackUnawareStrategy.class, null, 5, newCf); + KSMetaData newKs = new KSMetaData(newCf.tableName, SimpleStrategy.class, null, 5, newCf); new AddKeyspace(newKs).apply(); @@ -424,7 +424,7 @@ public class DefsTest extends CleanupHel { assert DatabaseDescriptor.getTableDefinition("EmptyKeyspace") == null; - KSMetaData newKs = new KSMetaData("EmptyKeyspace", RackUnawareStrategy.class, null, 5); + KSMetaData newKs = new KSMetaData("EmptyKeyspace", SimpleStrategy.class, null, 5); new AddKeyspace(newKs).apply(); assert DatabaseDescriptor.getTableDefinition("EmptyKeyspace") != null; Modified: cassandra/trunk/test/unit/org/apache/cassandra/hadoop/ColumnFamilyOutputFormatTest.java URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/hadoop/ColumnFamilyOutputFormatTest.java?rev=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/hadoop/ColumnFamilyOutputFormatTest.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/hadoop/ColumnFamilyOutputFormatTest.java Sun Aug 15 16:16:58 2010 @@ -138,7 +138,7 @@ public class ColumnFamilyOutputFormatTes if (!keyspaces.contains(KEYSPACE)) { List<CfDef> cfDefs = new ArrayList<CfDef>(); - thriftClient.system_add_keyspace(new KsDef(KEYSPACE, "org.apache.cassandra.locator.RackUnawareStrategy", 1, cfDefs)); + thriftClient.system_add_keyspace(new KsDef(KEYSPACE, "org.apache.cassandra.locator.SimpleStrategy", 1, cfDefs)); } thriftClient.set_keyspace(KEYSPACE); Copied: cassandra/trunk/test/unit/org/apache/cassandra/locator/NetworkTopologyStrategyTest.java (from r985536, cassandra/trunk/test/unit/org/apache/cassandra/locator/DatacenterShardStrategyTest.java) URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/locator/NetworkTopologyStrategyTest.java?p2=cassandra/trunk/test/unit/org/apache/cassandra/locator/NetworkTopologyStrategyTest.java&p1=cassandra/trunk/test/unit/org/apache/cassandra/locator/DatacenterShardStrategyTest.java&r1=985536&r2=985701&rev=985701&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/locator/DatacenterShardStrategyTest.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/locator/NetworkTopologyStrategyTest.java Sun Aug 15 16:16:58 2010 @@ -35,7 +35,7 @@ import org.apache.cassandra.dht.StringTo import org.apache.cassandra.dht.Token; import org.xml.sax.SAXException; -public class DatacenterShardStrategyTest +public class NetworkTopologyStrategyTest { private String table = "Keyspace1"; @@ -52,7 +52,7 @@ public class DatacenterShardStrategyTest configOptions.put("DC3", "1"); // Set the localhost to the tokenmetadata. Embedded cassandra way? - DatacenterShardStrategy strategy = new DatacenterShardStrategy(table, metadata, snitch, configOptions); + NetworkTopologyStrategy strategy = new NetworkTopologyStrategy(table, metadata, snitch, configOptions); assert strategy.getReplicationFactor("DC1") == 3; assert strategy.getReplicationFactor("DC2") == 2; assert strategy.getReplicationFactor("DC3") == 1; Copied: cassandra/trunk/test/unit/org/apache/cassandra/locator/OldNetworkTopologyStrategyTest.java (from r985536, cassandra/trunk/test/unit/org/apache/cassandra/locator/RackAwareStrategyTest.java) URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/locator/OldNetworkTopologyStrategyTest.java?p2=cassandra/trunk/test/unit/org/apache/cassandra/locator/OldNetworkTopologyStrategyTest.java&p1=cassandra/trunk/test/unit/org/apache/cassandra/locator/RackAwareStrategyTest.java&r1=985536&r2=985701&rev=985701&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/locator/RackAwareStrategyTest.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/locator/OldNetworkTopologyStrategyTest.java Sun Aug 15 16:16:58 2010 @@ -34,7 +34,7 @@ import org.apache.cassandra.config.Datab import org.apache.cassandra.dht.BigIntegerToken; import org.apache.cassandra.dht.Token; -public class RackAwareStrategyTest +public class OldNetworkTopologyStrategyTest { private List<Token> endpointTokens; private List<Token> keyTokens; @@ -60,7 +60,7 @@ public class RackAwareStrategyTest { RackInferringSnitch endpointSnitch = new RackInferringSnitch(); - AbstractReplicationStrategy strategy = new RackAwareStrategy("Keyspace1", tmd, endpointSnitch, null); + AbstractReplicationStrategy strategy = new OldNetworkTopologyStrategy("Keyspace1", tmd, endpointSnitch, null); addEndpoint("0", "5", "254.0.0.1"); addEndpoint("10", "15", "254.0.0.2"); addEndpoint("20", "25", "254.0.0.3"); @@ -85,7 +85,7 @@ public class RackAwareStrategyTest { RackInferringSnitch endpointSnitch = new RackInferringSnitch(); - AbstractReplicationStrategy strategy = new RackAwareStrategy("Keyspace1", tmd, endpointSnitch, null); + AbstractReplicationStrategy strategy = new OldNetworkTopologyStrategy("Keyspace1", tmd, endpointSnitch, null); addEndpoint("0", "5", "254.0.0.1"); addEndpoint("10", "15", "254.0.0.2"); addEndpoint("20", "25", "254.1.0.3"); @@ -111,7 +111,7 @@ public class RackAwareStrategyTest { RackInferringSnitch endpointSnitch = new RackInferringSnitch(); - AbstractReplicationStrategy strategy = new RackAwareStrategy("Keyspace1", tmd, endpointSnitch, null); + AbstractReplicationStrategy strategy = new OldNetworkTopologyStrategy("Keyspace1", tmd, endpointSnitch, null); addEndpoint("0", "5", "254.0.0.1"); addEndpoint("10", "15", "254.0.0.2"); addEndpoint("20", "25", "254.0.1.3"); Modified: cassandra/trunk/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java?rev=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java Sun Aug 15 16:16:58 2010 @@ -19,7 +19,6 @@ package org.apache.cassandra.locator; -import java.lang.reflect.Constructor; import java.net.InetAddress; import java.util.*; @@ -58,9 +57,9 @@ public class ReplicationStrategyEndpoint @Test public void testEndpointsWereCached() throws Exception { - runEndpointsWereCachedTest(FakeRackUnawareStrategy.class, null); - runEndpointsWereCachedTest(FakeRackAwareStrategy.class, null); - runEndpointsWereCachedTest(FakeDatacenterShardStrategy.class, new HashMap<String, String>()); + runEndpointsWereCachedTest(FakeSimpleStrategy.class, null); + runEndpointsWereCachedTest(FakeOldNetworkTopologyStrategy.class, null); + runEndpointsWereCachedTest(FakeNetworkTopologyStrategy.class, new HashMap<String, String>()); } public void runEndpointsWereCachedTest(Class stratClass, Map<String, String> configOptions) throws Exception @@ -72,9 +71,9 @@ public class ReplicationStrategyEndpoint @Test public void testCacheRespectsTokenChanges() throws Exception { - runCacheRespectsTokenChangesTest(RackUnawareStrategy.class, null); - runCacheRespectsTokenChangesTest(RackAwareStrategy.class, null); - runCacheRespectsTokenChangesTest(DatacenterShardStrategy.class, new HashMap<String, String>()); + runCacheRespectsTokenChangesTest(SimpleStrategy.class, null); + runCacheRespectsTokenChangesTest(OldNetworkTopologyStrategy.class, null); + runCacheRespectsTokenChangesTest(NetworkTopologyStrategy.class, new HashMap<String, String>()); } public void runCacheRespectsTokenChangesTest(Class stratClass, Map<String, String> configOptions) throws Exception @@ -110,11 +109,11 @@ public class ReplicationStrategyEndpoint assert !endpoints.equals(initial); } - protected static class FakeRackUnawareStrategy extends RackUnawareStrategy + protected static class FakeSimpleStrategy extends SimpleStrategy { private boolean called = false; - public FakeRackUnawareStrategy(String table, TokenMetadata tokenMetadata, IEndpointSnitch snitch, Map<String, String> configOptions) + public FakeSimpleStrategy(String table, TokenMetadata tokenMetadata, IEndpointSnitch snitch, Map<String, String> configOptions) { super(table, tokenMetadata, snitch, configOptions); } @@ -128,11 +127,11 @@ public class ReplicationStrategyEndpoint } } - protected static class FakeRackAwareStrategy extends RackAwareStrategy + protected static class FakeOldNetworkTopologyStrategy extends OldNetworkTopologyStrategy { private boolean called = false; - public FakeRackAwareStrategy(String table, TokenMetadata tokenMetadata, IEndpointSnitch snitch, Map<String, String> configOptions) + public FakeOldNetworkTopologyStrategy(String table, TokenMetadata tokenMetadata, IEndpointSnitch snitch, Map<String, String> configOptions) { super(table, tokenMetadata, snitch, configOptions); } @@ -146,11 +145,11 @@ public class ReplicationStrategyEndpoint } } - protected static class FakeDatacenterShardStrategy extends DatacenterShardStrategy + protected static class FakeNetworkTopologyStrategy extends NetworkTopologyStrategy { private boolean called = false; - public FakeDatacenterShardStrategy(String table, TokenMetadata tokenMetadata, IEndpointSnitch snitch, Map<String, String> configOptions) throws ConfigurationException + public FakeNetworkTopologyStrategy(String table, TokenMetadata tokenMetadata, IEndpointSnitch snitch, Map<String, String> configOptions) throws ConfigurationException { super(table, tokenMetadata, snitch, configOptions); } Copied: cassandra/trunk/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java (from r985536, cassandra/trunk/test/unit/org/apache/cassandra/locator/RackUnawareStrategyTest.java) URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java?p2=cassandra/trunk/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java&p1=cassandra/trunk/test/unit/org/apache/cassandra/locator/RackUnawareStrategyTest.java&r1=985536&r2=985701&rev=985701&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/locator/RackUnawareStrategyTest.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java Sun Aug 15 16:16:58 2010 @@ -36,7 +36,7 @@ import org.apache.cassandra.dht.*; import org.apache.cassandra.service.StorageService; import org.apache.cassandra.service.StorageServiceAccessor; -public class RackUnawareStrategyTest extends SchemaLoader +public class SimpleStrategyTest extends SchemaLoader { @Test public void tryBogusTable() @@ -185,7 +185,7 @@ public class RackUnawareStrategyTest ext { return AbstractReplicationStrategy.createReplicationStrategy( table, - "org.apache.cassandra.locator.RackUnawareStrategy", + "org.apache.cassandra.locator.SimpleStrategy", tmd, new SimpleSnitch(), null); Modified: cassandra/trunk/test/unit/org/apache/cassandra/service/MoveTest.java URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/service/MoveTest.java?rev=985701&r1=985700&r2=985701&view=diff ============================================================================== --- cassandra/trunk/test/unit/org/apache/cassandra/service/MoveTest.java (original) +++ cassandra/trunk/test/unit/org/apache/cassandra/service/MoveTest.java Sun Aug 15 16:16:58 2010 @@ -34,21 +34,11 @@ import org.apache.cassandra.config.Datab import org.apache.cassandra.dht.*; import org.apache.cassandra.gms.ApplicationState; import org.apache.cassandra.locator.AbstractReplicationStrategy; -import org.apache.cassandra.locator.RackUnawareStrategy; import org.apache.cassandra.locator.SimpleSnitch; import org.apache.cassandra.locator.TokenMetadata; public class MoveTest extends CleanupHelper { - // handy way of creating a mapping of strategies to use in StorageService. - private static Map<String, AbstractReplicationStrategy> createReplacements(AbstractReplicationStrategy strat) - { - Map<String, AbstractReplicationStrategy> replacements = new HashMap<String, AbstractReplicationStrategy>(); - for (String table : DatabaseDescriptor.getTables()) - replacements.put(table, strat); - return replacements; - } - /** * Test whether write endpoints is correct when the node is leaving. Uses * StorageService.onChange and does not manipulate token metadata directly. @@ -642,7 +632,7 @@ public class MoveTest extends CleanupHel { return AbstractReplicationStrategy.createReplicationStrategy( table, - "org.apache.cassandra.locator.RackUnawareStrategy", + "org.apache.cassandra.locator.SimpleStrategy", tmd, new SimpleSnitch(), null);