diff --git a/CHANGES.txt b/CHANGES.txt index 827a4ece75..e47bb95ec8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -21,7 +21,8 @@ non-Windows platforms (CASSANDRA-4110) * fix terminination of the stress.java when errors were encountered (CASSANDRA-4128) - +Merged from 1.0: + * allow short snitch names (CASSANDRA-4130) 1.1-beta2 * rename loaded sstables to avoid conflicts with local snapshots @@ -54,6 +55,15 @@ * Unify migration code (CASSANDRA-4017) Merged from 1.0: * cqlsh: guess correct version of Python for Arch Linux (CASSANDRA-4090) + + +1.0.9 +======= + * (CLI) properly handle quotes in create/update keyspace commands (CASSANDRA-4129) + + +1.0.9 +>>>>>>> cassandra-1.0 * improve index sampling performance (CASSANDRA-4023) * always compact away deleted hints immediately after handoff (CASSANDRA-3955) * delete hints from dropped ColumnFamilies on handoff instead of diff --git a/conf/cassandra.yaml b/conf/cassandra.yaml index 1874f320b7..af6072ac2c 100644 --- a/conf/cassandra.yaml +++ b/conf/cassandra.yaml @@ -397,20 +397,50 @@ rpc_timeout_in_ms: 10000 # phi_convict_threshold: 8 # endpoint_snitch -- Set this to a class that implements -# IEndpointSnitch, which will let Cassandra know enough -# about your network topology to route requests efficiently. +# IEndpointSnitch. The snitch has two functions: +# - it teaches Cassandra enough about your network topology to route +# requests efficiently +# - it allows Cassandra to spread replicas around your cluster to avoid +# correlated failures. It does this by grouping machines into +# "datacenters" and "racks." Cassandra will do its best not to have +# more than one replica on the same "rack" (which may not actually +# be a physical location) +# +# IF YOU CHANGE THE SNITCH AFTER DATA IS INSERTED INTO THE CLUSTER, +# YOU MUST RUN A FULL REPAIR, SINCE THE SNITCH AFFECTS WHERE REPLICAS +# ARE PLACED. +# # Out of the box, Cassandra provides -# - org.apache.cassandra.locator.SimpleSnitch: +# - SimpleSnitch: # Treats Strategy order as proximity. This improves cache locality # when disabling read repair, which can further improve throughput. -# - org.apache.cassandra.locator.RackInferringSnitch: +# Only appropriate for single-datacenter deployments. +# - PropertyFileSnitch: +# Proximity is determined by rack and data center, which are +# explicitly configured in cassandra-topology.properties. +# - RackInferringSnitch: # Proximity is determined by rack and data center, which are # assumed to correspond to the 3rd and 2nd octet of each node's -# IP address, respectively -# org.apache.cassandra.locator.PropertyFileSnitch: -# - Proximity is determined by rack and data center, which are -# explicitly configured in cassandra-topology.properties. -endpoint_snitch: org.apache.cassandra.locator.SimpleSnitch +# IP address, respectively. Unless this happens to match your +# deployment conventions (as it did Facebook's), this is best used +# as an example of writing a custom Snitch class. +# - Ec2Snitch: +# Appropriate for EC2 deployments in a single Region. Loads Region +# and Availability Zone information from the EC2 API. The Region is +# treated as the Datacenter, and the Availability Zone as the rack. +# Only private IPs are used, so this will not work across multiple +# Regions. +# - Ec2MultiRegionSnitch: +# Uses public IPs as broadcast_address to allow cross-region +# connectivity. (Thus, you should set seed addresses to the public +# IP as well.) You will need to open the storage_port or +# ssl_storage_port on the public IP firewall. (For intra-Region +# traffic, Cassandra will switch to the private IP after +# establishing a connection.) +# +# You can use a custom Snitch by setting this to the full class name +# of the snitch, which will be assumed to be on your classpath. +endpoint_snitch: SimpleSnitch # controls how often to perform the more expensive part of host score # calculation diff --git a/src/java/org/apache/cassandra/cli/CliClient.java b/src/java/org/apache/cassandra/cli/CliClient.java index 75d4a146e5..6c3872b4a5 100644 --- a/src/java/org/apache/cassandra/cli/CliClient.java +++ b/src/java/org/apache/cassandra/cli/CliClient.java @@ -984,7 +984,7 @@ public class CliClient return; // first value is the keyspace name, after that it is all key=value - String keyspaceName = statement.getChild(0).getText(); + String keyspaceName = CliUtils.unescapeSQLString(statement.getChild(0).getText()); KsDef ksDef = new KsDef(keyspaceName, DEFAULT_PLACEMENT_STRATEGY, new LinkedList()); try diff --git a/src/java/org/apache/cassandra/cli/CliCompiler.java b/src/java/org/apache/cassandra/cli/CliCompiler.java index 5a0252dc5c..7bbc5e1ed7 100644 --- a/src/java/org/apache/cassandra/cli/CliCompiler.java +++ b/src/java/org/apache/cassandra/cli/CliCompiler.java @@ -125,7 +125,7 @@ public class CliCompiler public static String getKeySpace(Tree statement, List keyspaces) { - return getKeySpace(statement.getChild(0).getText(), keyspaces); + return getKeySpace(CliUtils.unescapeSQLString(statement.getChild(0).getText()), keyspaces); } public static String getKeySpace(String ksName, List keyspaces) diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java index 792dc186a1..2eb89ba07b 100644 --- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java +++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java @@ -482,9 +482,11 @@ public class DatabaseDescriptor } } - private static IEndpointSnitch createEndpointSnitch(String endpointSnitchClassName) throws ConfigurationException + private static IEndpointSnitch createEndpointSnitch(String snitchClassName) throws ConfigurationException { - IEndpointSnitch snitch = FBUtilities.construct(endpointSnitchClassName, "snitch"); + if (!snitchClassName.contains(".")) + snitchClassName = "org.apache.cassandra.locator." + snitchClassName; + IEndpointSnitch snitch = FBUtilities.construct(snitchClassName, "snitch"); return conf.dynamic_snitch ? new DynamicEndpointSnitch(snitch) : snitch; } diff --git a/src/java/org/apache/cassandra/locator/Ec2MultiRegionSnitch.java b/src/java/org/apache/cassandra/locator/Ec2MultiRegionSnitch.java index 68421f98ec..a71e34323a 100644 --- a/src/java/org/apache/cassandra/locator/Ec2MultiRegionSnitch.java +++ b/src/java/org/apache/cassandra/locator/Ec2MultiRegionSnitch.java @@ -66,40 +66,34 @@ public class Ec2MultiRegionSnitch extends Ec2Snitch implements IEndpointStateCha DatabaseDescriptor.setBroadcastAddress(public_ip); } - @Override public void onJoin(InetAddress endpoint, EndpointState epState) { if (epState.getApplicationState(ApplicationState.INTERNAL_IP) != null) reConnect(endpoint, epState.getApplicationState(ApplicationState.INTERNAL_IP)); } - @Override public void onChange(InetAddress endpoint, ApplicationState state, VersionedValue value) { if (state == ApplicationState.INTERNAL_IP) reConnect(endpoint, value); } - @Override public void onAlive(InetAddress endpoint, EndpointState state) { if (state.getApplicationState(ApplicationState.INTERNAL_IP) != null) reConnect(endpoint, state.getApplicationState(ApplicationState.INTERNAL_IP)); } - @Override public void onDead(InetAddress endpoint, EndpointState state) { // do nothing } - @Override public void onRestart(InetAddress endpoint, EndpointState state) { // do nothing } - @Override public void onRemove(InetAddress endpoint) { // do nothing. @@ -121,6 +115,7 @@ public class Ec2MultiRegionSnitch extends Ec2Snitch implements IEndpointStateCha } } + @Override public void gossiperStarting() { super.gossiperStarting(); diff --git a/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java b/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java index 641767ad59..4e5a479972 100644 --- a/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java +++ b/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java @@ -66,6 +66,11 @@ public class OutboundTcpConnectionPool con.closeSocket(); } + /** + * reconnect to @param remoteEP (after the current message backlog is exhausted). + * Used by Ec2MultiRegionSnitch to force nodes in the same region to communicate over their private IPs. + * @param remoteEP + */ public void reset(InetAddress remoteEP) { resetedEndpoint = remoteEP;