Return-Path: Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: (qmail 97642 invoked from network); 8 Mar 2011 18:21:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Mar 2011 18:21:27 -0000 Received: (qmail 98918 invoked by uid 500); 8 Mar 2011 18:21:27 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 98898 invoked by uid 500); 8 Mar 2011 18:21:27 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 98890 invoked by uid 99); 8 Mar 2011 18:21:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Mar 2011 18:21:27 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Mar 2011 18:21:22 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 2C22023889B9; Tue, 8 Mar 2011 18:21:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1079465 - in /cassandra/branches/cassandra-0.7: ./ conf/ src/java/org/apache/cassandra/config/ src/java/org/apache/cassandra/service/ Date: Tue, 08 Mar 2011 18:21:01 -0000 To: commits@cassandra.apache.org From: jbellis@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110308182101.2C22023889B9@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jbellis Date: Tue Mar 8 18:21:00 2011 New Revision: 1079465 URL: http://svn.apache.org/viewvc?rev=1079465&view=rev Log: move sample schema from cassandra.yaml to schema-sample.txt (backport of r1079462) Added: cassandra/branches/cassandra-0.7/conf/schema-sample.txt Modified: cassandra/branches/cassandra-0.7/CHANGES.txt cassandra/branches/cassandra-0.7/conf/cassandra.yaml cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/config/DatabaseDescriptor.java cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/IResponseResolver.java cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/ReadCallback.java cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageProxy.java cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java Modified: cassandra/branches/cassandra-0.7/CHANGES.txt URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/CHANGES.txt?rev=1079465&r1=1079464&r2=1079465&view=diff ============================================================================== --- cassandra/branches/cassandra-0.7/CHANGES.txt (original) +++ cassandra/branches/cassandra-0.7/CHANGES.txt Tue Mar 8 18:21:00 2011 @@ -12,6 +12,8 @@ * add configurable row limit to Pig loadfunc (CASSANDRA-2276) * validate column values in batches as well as single-Column inserts (CASSANDRA-2259) + * move sample schema from cassandra.yaml to schema-sample.txt, + a cli scripts (CASSANDRA-2007) 0.7.3 Modified: cassandra/branches/cassandra-0.7/conf/cassandra.yaml URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/conf/cassandra.yaml?rev=1079465&r1=1079464&r2=1079465&view=diff ============================================================================== --- cassandra/branches/cassandra-0.7/conf/cassandra.yaml (original) +++ cassandra/branches/cassandra-0.7/conf/cassandra.yaml Tue Mar 8 18:21:00 2011 @@ -342,177 +342,3 @@ request_scheduler: org.apache.cassandra. # is for a given SSTable. The larger the sampling, the more effective # the index is at the cost of space. index_interval: 128 - -# Keyspaces have ColumnFamilies. (Usually 1 KS per application.) -# ColumnFamilies have Rows. (Dozens of CFs per KS.) -# Rows contain Columns. (Many per CF.) -# Columns contain name:value:timestamp. (Many per Row.) -# -# A KS is most similar to a schema, and a CF is most similar to a relational table. -# -# Keyspaces, ColumnFamilies, and Columns may carry additional -# metadata that change their behavior. These are as follows: -# -# Keyspace required parameters: -# - name: name of the keyspace; "system" is -# reserved for Cassandra Internals. -# - replica_placement_strategy: the class that determines how replicas -# 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.SimpleStrategy -# * org.apache.cassandra.locator.NetworkTopologyStrategy -# * org.apache.cassandra.locator.OldNetworkTopologyStrategy -# -# 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. -# -# 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.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 -# Keyspace optional paramaters: -# - strategy_options: Additional information for the replication strategy. -# - column_families: -# ColumnFamily required parameters: -# - name: name of the ColumnFamily. Must not contain the character "-". -# - compare_with: tells Cassandra how to sort the columns for slicing -# operations. The default is BytesType, which is a straightforward -# lexical comparison of the bytes in each column. Other options are -# AsciiType, UTF8Type, LexicalUUIDType, TimeUUIDType, LongType, -# and IntegerType (a generic variable-length integer type). -# You can also specify the fully-qualified class name to a class of -# your choice extending org.apache.cassandra.db.marshal.AbstractType. -# -# ColumnFamily optional parameters: -# - keys_cached: specifies the number of keys per sstable whose -# locations we keep in memory in "mostly LRU" order. (JUST the key -# locations, NOT any column values.) Specify a fraction (value less -# than 1) or an absolute number of keys to cache. Defaults to 200000 -# keys. -# - rows_cached: specifies the number of rows whose entire contents we -# cache in memory. Do not use this on ColumnFamilies with large rows, -# or ColumnFamilies with high write:read ratios. Specify a fraction -# (value less than 1) or an absolute number of rows to cache. -# Defaults to 0. (i.e. row caching is off by default) -# - comment: used to attach additional human-readable information about -# the column family to its definition. -# - read_repair_chance: specifies the probability with which read -# repairs should be invoked on non-quorum reads. must be between 0 -# and 1. defaults to 1.0 (always read repair). -# - gc_grace_seconds: specifies the time to wait before garbage -# collecting tombstones (deletion markers). defaults to 864000 (10 -# days). See http://wiki.apache.org/cassandra/DistributedDeletes -# - default_validation_class: specifies a validator class to use for -# validating all the column values in the CF. -# NOTE: -# min_ must be less than max_compaction_threshold! -# - min_compaction_threshold: the minimum number of SSTables needed -# to start a minor compaction. increasing this will cause minor -# compactions to start less frequently and be more intensive. setting -# this to 0 disables minor compactions. defaults to 4. -# - max_compaction_threshold: the maximum number of SSTables allowed -# before a minor compaction is forced. decreasing this will cause -# minor compactions to start more frequently and be less intensive. -# setting this to 0 disables minor compactions. defaults to 32. -# /NOTE -# - row_cache_save_period_in_seconds: number of seconds between saving -# row caches. The row caches can be saved periodically and if one -# exists on startup it will be loaded. -# - key_cache_save_period_in_seconds: number of seconds between saving -# key caches. The key caches can be saved periodically and if one -# exists on startup it will be loaded. -# - memtable_flush_after_mins: The maximum time to leave a dirty table -# unflushed. This should be large enough that it won't cause a flush -# storm of all memtables during periods of inactivity. -# - memtable_throughput_in_mb: The maximum size of the memtable before -# it is flushed. If undefined, 1/8 * heapsize will be used. -# - memtable_operations_in_millions: Number of operations in millions -# before the memtable is flushed. If undefined, throughput / 64 * 0.3 -# will be used. -# - column_metadata: -# Column required parameters: -# - name: binds a validator (and optionally an indexer) to columns -# with this name in any row of the enclosing column family. -# - validator: like cf.compare_with, an AbstractType that checks -# that the value of the column is well-defined. -# Column optional parameters: -# NOTE: -# index_name cannot be set if index_type is not also set! -# - index_name: User-friendly name for the index. -# - index_type: The type of index to be created. Currently only -# KEYS is supported. -# /NOTE -# -# NOTE: -# this keyspace definition is for demonstration purposes only. -# Cassandra will not load these definitions during startup. See -# http://wiki.apache.org/cassandra/FAQ#no_keyspaces for an explanation. -# /NOTE -keyspaces: - - name: Keyspace1 - replica_placement_strategy: org.apache.cassandra.locator.SimpleStrategy - replication_factor: 1 - column_families: - - name: Standard1 - compare_with: BytesType - keys_cached: 10000 - rows_cached: 1000 - row_cache_save_period_in_seconds: 0 - key_cache_save_period_in_seconds: 3600 - memtable_flush_after_mins: 59 - memtable_throughput_in_mb: 255 - memtable_operations_in_millions: 0.29 - - - name: Standard2 - compare_with: UTF8Type - read_repair_chance: 0.1 - keys_cached: 100 - gc_grace_seconds: 0 - min_compaction_threshold: 5 - max_compaction_threshold: 31 - - - name: StandardByUUID1 - compare_with: TimeUUIDType - - - name: Super1 - column_type: Super - compare_with: BytesType - compare_subcolumns_with: BytesType - - - name: Super2 - column_type: Super - compare_subcolumns_with: UTF8Type - rows_cached: 10000 - keys_cached: 50 - comment: 'A column family with supercolumns, whose column and subcolumn names are UTF8 strings' - - - name: Super3 - column_type: Super - compare_with: LongType - comment: 'A column family with supercolumns, whose column names are Longs (8 bytes)' - - - name: Indexed1 - default_validation_class: LongType - column_metadata: - - name: birthdate - validator_class: LongType - index_name: birthdate_idx - index_type: KEYS Added: cassandra/branches/cassandra-0.7/conf/schema-sample.txt URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/conf/schema-sample.txt?rev=1079465&view=auto ============================================================================== --- cassandra/branches/cassandra-0.7/conf/schema-sample.txt (added) +++ cassandra/branches/cassandra-0.7/conf/schema-sample.txt Tue Mar 8 18:21:00 2011 @@ -0,0 +1,62 @@ +/*This file contains an example Keyspace that can be created using the +cassandra-cli command line interface as follows. + +bin/cassandra-cli -host localhost --file conf/Keyspace1.txt + +The cassandra-cli includes online help that explains the statements below. You can +accessed the help without connecting to a running cassandra instance by starting the +client and typing "help;" +*/ + +create keyspace Keyspace1 + with replication_factor = 1 + and placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'; + +use Keyspace1; + +create column family Standard1 + with comparator = BytesType + and keys_cached = 10000 + and rows_cached = 1000 + and row_cache_save_period = 0 + and key_cache_save_period = 3600 + and memtable_flush_after = 59 + and memtable_throughput = 255 + and memtable_operations = 0.29; + +create column family Standard2 + with comparator = UTF8Type + and read_repair_chance = 0.1 + and keys_cached = 100 + and gc_grace = 0 + and min_compaction_threshold = 5 + and max_compaction_threshold = 31; + +create column family StandardByUUID1 + with comparator = TimeUUIDType; + +create column family Super1 + with column_type = Super + and comparator = BytesType + and subcomparator = BytesType; + +create column family Super2 + with column_type = Super + and subcomparator = UTF8Type + and rows_cached = 10000 + and keys_cached = 50 + and comment = 'A column family with supercolumns, whose column and subcolumn names are UTF8 strings'; + +create column family Super3 + with column_type = Super + and comparator = LongType + and comment = 'A column family with supercolumns, whose column names are Longs (8 bytes)'; + +create column family Indexed1 + with default_validation_class = LongType + and column_metadata = [{ + column_name : birthdate, + validation_class : LongType, + index_name : birthdate_idx, + index_type : 0} + ]; Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/config/DatabaseDescriptor.java URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/config/DatabaseDescriptor.java?rev=1079465&r1=1079464&r2=1079465&view=diff ============================================================================== --- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/config/DatabaseDescriptor.java (original) +++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/config/DatabaseDescriptor.java Tue Mar 8 18:21:00 2011 @@ -500,7 +500,8 @@ public class DatabaseDescriptor public static Collection readTablesFromYaml() throws ConfigurationException { List defs = new ArrayList(); - + if (conf.keyspaces == null) + return defs; /* Read the table related stuff from config */ for (RawKeyspace keyspace : conf.keyspaces) Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/IResponseResolver.java URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/IResponseResolver.java?rev=1079465&r1=1079464&r2=1079465&view=diff ============================================================================== --- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/IResponseResolver.java (original) +++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/IResponseResolver.java Tue Mar 8 18:21:00 2011 @@ -43,5 +43,7 @@ public interface IResponseResolver { public void preprocess(Message message); public Iterable getMessages(); + + /** Potentially called by multiple response threads, so must be threadsafe. */ public int getMessageCount(); } Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/ReadCallback.java URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/ReadCallback.java?rev=1079465&r1=1079464&r2=1079465&view=diff ============================================================================== --- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/ReadCallback.java (original) +++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/ReadCallback.java Tue Mar 8 18:21:00 2011 @@ -61,9 +61,11 @@ public class ReadCallback implements protected final SimpleCondition condition = new SimpleCondition(); private final long startTime; protected final int blockfor; - final List endpoints; private final IReadCommand command; + /** the list of endpoints that StorageProxy should send requests to */ + final List endpoints; + /** * Constructor when response count has to be calculated and blocked for. */ @@ -124,7 +126,7 @@ public class ReadCallback implements public void response(Message message) { resolver.preprocess(message); - assert resolver.getMessageCount() <= endpoints.size(); + assert resolver.getMessageCount() <= endpoints.size() : "Got " + resolver.getMessageCount() + " replies but requests were only sent to " + endpoints.size() + " endpoints"; if (resolver.getMessageCount() < blockfor) return; if (resolver.isDataPresent()) Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageProxy.java URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageProxy.java?rev=1079465&r1=1079464&r2=1079465&view=diff ============================================================================== --- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageProxy.java (original) +++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageProxy.java Tue Mar 8 18:21:00 2011 @@ -516,7 +516,7 @@ public class StorageProxy implements Sto RangeSliceResponseResolver resolver = new RangeSliceResponseResolver(command.keyspace, liveEndpoints); ReadCallback> handler = getReadCallback(resolver, command, consistency_level, liveEndpoints); handler.assureSufficientLiveNodes(); - for (InetAddress endpoint : liveEndpoints) + for (InetAddress endpoint : handler.endpoints) { MessagingService.instance().sendRR(message, endpoint, handler); if (logger.isDebugEnabled()) @@ -778,7 +778,7 @@ public class StorageProxy implements Sto IndexScanCommand command = new IndexScanCommand(keyspace, column_family, index_clause, column_predicate, range); Message message = command.getMessage(); - for (InetAddress endpoint : liveEndpoints) + for (InetAddress endpoint : handler.endpoints) { MessagingService.instance().sendRR(message, endpoint, handler); if (logger.isDebugEnabled()) Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java?rev=1079465&r1=1079464&r2=1079465&view=diff ============================================================================== --- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java (original) +++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java Tue Mar 8 18:21:00 2011 @@ -1969,6 +1969,9 @@ public class StorageService implements I { // validate final Collection tables = DatabaseDescriptor.readTablesFromYaml(); + if (tables.isEmpty()) + return; + for (KSMetaData table : tables) { if (!table.name.matches(Migration.NAME_VALIDATOR_REGEX))