Merge branch 'cassandra-2.1' into trunk Conflicts: CHANGES.txt src/java/org/apache/cassandra/config/CFMetaData.java src/java/org/apache/cassandra/db/DataTracker.java
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/afee0229 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/afee0229 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/afee0229 Branch: refs/heads/trunk Commit: afee0229e7dbd90eaaf94954d44b617c9445f9b4 Parents: 21c5a41 97da271 Author: Aleksey Yeschenko <alek...@apache.org> Authored: Tue Feb 10 04:25:23 2015 +0300 Committer: Aleksey Yeschenko <alek...@apache.org> Committed: Tue Feb 10 04:25:23 2015 +0300 ---------------------------------------------------------------------- CHANGES.txt | 4 ++++ .../org/apache/cassandra/db/DataTracker.java | 2 ++ .../cassandra/db/SizeEstimatesRecorder.java | 20 +++++++++++++++----- .../org/apache/cassandra/db/SystemKeyspace.java | 3 ++- .../cassandra/service/CassandraDaemon.java | 5 ++++- 5 files changed, 27 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/afee0229/CHANGES.txt ---------------------------------------------------------------------- diff --cc CHANGES.txt index b1fad72,c5cff48..9f1bda5 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,62 -1,7 +1,66 @@@ +3.0 + * Add role based access control (CASSANDRA-7653, 8650) + * Avoid accessing partitioner through StorageProxy (CASSANDRA-8244, 8268) + * Upgrade Metrics library and remove depricated metrics (CASSANDRA-5657) + * Serializing Row cache alternative, fully off heap (CASSANDRA-7438) + * Duplicate rows returned when in clause has repeated values (CASSANDRA-6707) + * Make CassandraException unchecked, extend RuntimeException (CASSANDRA-8560) + * Support direct buffer decompression for reads (CASSANDRA-8464) + * DirectByteBuffer compatible LZ4 methods (CASSANDRA-7039) + * Group sstables for anticompaction correctly (CASSANDRA-8578) + * Add ReadFailureException to native protocol, respond + immediately when replicas encounter errors while handling + a read request (CASSANDRA-7886) + * Switch CommitLogSegment from RandomAccessFile to nio (CASSANDRA-8308) + * Allow mixing token and partition key restrictions (CASSANDRA-7016) + * Support index key/value entries on map collections (CASSANDRA-8473) + * Modernize schema tables (CASSANDRA-8261) + * Support for user-defined aggregation functions (CASSANDRA-8053) + * Fix NPE in SelectStatement with empty IN values (CASSANDRA-8419) + * Refactor SelectStatement, return IN results in natural order instead + of IN value list order and ignore duplicate values in partition key IN restrictions (CASSANDRA-7981) + * Support UDTs, tuples, and collections in user-defined + functions (CASSANDRA-7563) + * Fix aggregate fn results on empty selection, result column name, + and cqlsh parsing (CASSANDRA-8229) + * Mark sstables as repaired after full repair (CASSANDRA-7586) + * Extend Descriptor to include a format value and refactor reader/writer + APIs (CASSANDRA-7443) + * Integrate JMH for microbenchmarks (CASSANDRA-8151) + * Keep sstable levels when bootstrapping (CASSANDRA-7460) + * Add Sigar library and perform basic OS settings check on startup (CASSANDRA-7838) + * Support for aggregation functions (CASSANDRA-4914) + * Remove cassandra-cli (CASSANDRA-7920) + * Accept dollar quoted strings in CQL (CASSANDRA-7769) + * Make assassinate a first class command (CASSANDRA-7935) + * Support IN clause on any partition key column (CASSANDRA-7855) + * Support IN clause on any clustering column (CASSANDRA-4762) + * Improve compaction logging (CASSANDRA-7818) + * Remove YamlFileNetworkTopologySnitch (CASSANDRA-7917) + * Do anticompaction in groups (CASSANDRA-6851) + * Support user-defined functions (CASSANDRA-7395, 7526, 7562, 7740, 7781, 7929, + 7924, 7812, 8063, 7813, 7708) + * Permit configurable timestamps with cassandra-stress (CASSANDRA-7416) + * Move sstable RandomAccessReader to nio2, which allows using the + FILE_SHARE_DELETE flag on Windows (CASSANDRA-4050) + * Remove CQL2 (CASSANDRA-5918) + * Add Thrift get_multi_slice call (CASSANDRA-6757) + * Optimize fetching multiple cells by name (CASSANDRA-6933) + * Allow compilation in java 8 (CASSANDRA-7028) + * Make incremental repair default (CASSANDRA-7250) + * Enable code coverage thru JaCoCo (CASSANDRA-7226) + * Switch external naming of 'column families' to 'tables' (CASSANDRA-4369) + * Shorten SSTable path (CASSANDRA-6962) + * Use unsafe mutations for most unit tests (CASSANDRA-6969) + * Fix race condition during calculation of pending ranges (CASSANDRA-7390) + * Fail on very large batch sizes (CASSANDRA-8011) + * Improve concurrency of repair (CASSANDRA-6455, 8208) + + + 2.1.4 + * Write partition size estimates into a system table (CASSANDRA-7688) + + 2.1.3 * Upgrade libthrift to 0.9.2 (CASSANDRA-8685) * Don't use the shared ref in sstableloader (CASSANDRA-8704) http://git-wip-us.apache.org/repos/asf/cassandra/blob/afee0229/src/java/org/apache/cassandra/db/DataTracker.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/db/DataTracker.java index 0dd66a1,5ec06bc..4df2772 --- a/src/java/org/apache/cassandra/db/DataTracker.java +++ b/src/java/org/apache/cassandra/db/DataTracker.java @@@ -758,7 -758,9 +758,9 @@@ public class DataTracke public List<SSTableReader> sstablesInBounds(AbstractBounds<RowPosition> rowBounds) { + if (intervalTree.isEmpty()) + return Collections.emptyList(); - RowPosition stopInTree = rowBounds.right.isMinimum(liveMemtables.get(0).cfs.partitioner) ? intervalTree.max() : rowBounds.right; + RowPosition stopInTree = rowBounds.right.isMinimum() ? intervalTree.max() : rowBounds.right; return intervalTree.search(Interval.<RowPosition, SSTableReader>create(rowBounds.left, stopInTree)); } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/afee0229/src/java/org/apache/cassandra/db/SizeEstimatesRecorder.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/afee0229/src/java/org/apache/cassandra/db/SystemKeyspace.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/db/SystemKeyspace.java index 7d0cdf4,7338b28..dcd0e55 --- a/src/java/org/apache/cassandra/db/SystemKeyspace.java +++ b/src/java/org/apache/cassandra/db/SystemKeyspace.java @@@ -64,193 -66,33 +64,194 @@@ public final class SystemKeyspac { private static final Logger logger = LoggerFactory.getLogger(SystemKeyspace.class); - // see CFMetaData for schema definitions - public static final String PEERS_CF = "peers"; - public static final String PEER_EVENTS_CF = "peer_events"; - public static final String LOCAL_CF = "local"; - public static final String INDEX_CF = "IndexInfo"; - public static final String HINTS_CF = "hints"; - public static final String RANGE_XFERS_CF = "range_xfers"; - public static final String BATCHLOG_CF = "batchlog"; - // see layout description in the DefsTables class header - public static final String SCHEMA_KEYSPACES_CF = "schema_keyspaces"; - public static final String SCHEMA_COLUMNFAMILIES_CF = "schema_columnfamilies"; - public static final String SCHEMA_COLUMNS_CF = "schema_columns"; - public static final String SCHEMA_TRIGGERS_CF = "schema_triggers"; - public static final String SCHEMA_USER_TYPES_CF = "schema_usertypes"; - public static final String COMPACTION_LOG = "compactions_in_progress"; - public static final String PAXOS_CF = "paxos"; - public static final String SSTABLE_ACTIVITY_CF = "sstable_activity"; - public static final String COMPACTION_HISTORY_CF = "compaction_history"; - public static final String SIZE_ESTIMATES_CF = "size_estimates"; - - private static final String LOCAL_KEY = "local"; - - public static final List<String> allSchemaCfs = Arrays.asList(SCHEMA_KEYSPACES_CF, - SCHEMA_COLUMNFAMILIES_CF, - SCHEMA_COLUMNS_CF, - SCHEMA_TRIGGERS_CF, - SCHEMA_USER_TYPES_CF); + public static final String NAME = "system"; + + public static final String HINTS = "hints"; + public static final String BATCHLOG = "batchlog"; + public static final String PAXOS = "paxos"; + public static final String BUILT_INDEXES = "IndexInfo"; + public static final String LOCAL = "local"; + public static final String PEERS = "peers"; + public static final String PEER_EVENTS = "peer_events"; + public static final String RANGE_XFERS = "range_xfers"; + public static final String COMPACTIONS_IN_PROGRESS = "compactions_in_progress"; + public static final String COMPACTION_HISTORY = "compaction_history"; + public static final String SSTABLE_ACTIVITY = "sstable_activity"; + public static final String SIZE_ESTIMATES = "size_estimates"; + + public static final CFMetaData Hints = + compile(HINTS, + "hints awaiting delivery", + "CREATE TABLE %s (" + + "target_id uuid," + + "hint_id timeuuid," + + "message_version int," + + "mutation blob," + + "PRIMARY KEY ((target_id), hint_id, message_version)) " + + "WITH COMPACT STORAGE") + .compactionStrategyOptions(Collections.singletonMap("enabled", "false")) + .gcGraceSeconds(0); + + public static final CFMetaData Batchlog = + compile(BATCHLOG, + "batches awaiting replay", + "CREATE TABLE %s (" + + "id uuid," + + "data blob," + + "version int," + + "written_at timestamp," + + "PRIMARY KEY ((id)))") + .compactionStrategyOptions(Collections.singletonMap("min_threshold", "2")) + .gcGraceSeconds(0); + + private static final CFMetaData Paxos = + compile(PAXOS, + "in-progress paxos proposals", + "CREATE TABLE %s (" + + "row_key blob," + + "cf_id UUID," + + "in_progress_ballot timeuuid," + + "most_recent_commit blob," + + "most_recent_commit_at timeuuid," + + "proposal blob," + + "proposal_ballot timeuuid," + + "PRIMARY KEY ((row_key), cf_id))") + .compactionStrategyClass(LeveledCompactionStrategy.class); + + // TODO: make private + public static final CFMetaData BuiltIndexes = + compile(BUILT_INDEXES, + "built column indexes", + "CREATE TABLE \"%s\" (" + + "table_name text," + + "index_name text," + + "PRIMARY KEY ((table_name), index_name)) " + + "WITH COMPACT STORAGE"); + + private static final CFMetaData Local = + compile(LOCAL, + "information about the local node", + "CREATE TABLE %s (" + + "key text," + + "bootstrapped text," + + "cluster_name text," + + "cql_version text," + + "data_center text," + + "gossip_generation int," + + "host_id uuid," + + "native_protocol_version text," + + "partitioner text," + + "rack text," + + "release_version text," + + "schema_version uuid," + + "thrift_version text," + + "tokens set<varchar>," + + "truncated_at map<uuid, blob>," + + "PRIMARY KEY ((key)))"); + + private static final CFMetaData Peers = + compile(PEERS, + "information about known peers in the cluster", + "CREATE TABLE %s (" + + "peer inet," + + "data_center text," + + "host_id uuid," + + "preferred_ip inet," + + "rack text," + + "release_version text," + + "rpc_address inet," + + "schema_version uuid," + + "tokens set<varchar>," + + "PRIMARY KEY ((peer)))"); + + private static final CFMetaData PeerEvents = + compile(PEER_EVENTS, + "events related to peers", + "CREATE TABLE %s (" + + "peer inet," + + "hints_dropped map<uuid, int>," + + "PRIMARY KEY ((peer)))"); + + private static final CFMetaData RangeXfers = + compile(RANGE_XFERS, + "ranges requested for transfer", + "CREATE TABLE %s (" + + "token_bytes blob," + + "requested_at timestamp," + + "PRIMARY KEY ((token_bytes)))"); + + private static final CFMetaData CompactionsInProgress = + compile(COMPACTIONS_IN_PROGRESS, + "unfinished compactions", + "CREATE TABLE %s (" + + "id uuid," + + "columnfamily_name text," + + "inputs set<int>," + + "keyspace_name text," + + "PRIMARY KEY ((id)))"); + + private static final CFMetaData CompactionHistory = + compile(COMPACTION_HISTORY, + "week-long compaction history", + "CREATE TABLE %s (" + + "id uuid," + + "bytes_in bigint," + + "bytes_out bigint," + + "columnfamily_name text," + + "compacted_at timestamp," + + "keyspace_name text," + + "rows_merged map<int, bigint>," + + "PRIMARY KEY ((id)))") + .defaultTimeToLive((int) TimeUnit.DAYS.toSeconds(7)); + + private static final CFMetaData SSTableActivity = + compile(SSTABLE_ACTIVITY, + "historic sstable read rates", + "CREATE TABLE %s (" + + "keyspace_name text," + + "columnfamily_name text," + + "generation int," + + "rate_120m double," + + "rate_15m double," + + "PRIMARY KEY ((keyspace_name, columnfamily_name, generation)))"); + + private static final CFMetaData SizeEstimates = + compile(SIZE_ESTIMATES, + "per-table primary range size estimates", + "CREATE TABLE %S (" + + "keyspace_name text," + + "table_name text," + + "range_start text," + + "range_end text," + + "mean_partition_size bigint," + + "partitions_count bigint," - + "PRIMARY KEY ((keyspace_name), table_name, range_start, range_end))"); ++ + "PRIMARY KEY ((keyspace_name), table_name, range_start, range_end))") ++ .gcGraceSeconds(0); + + private static CFMetaData compile(String name, String description, String schema) + { + return CFMetaData.compile(String.format(schema, name), NAME) + .comment(description); + } + + public static KSMetaData definition() + { + Iterable<CFMetaData> tables = + Iterables.concat(LegacySchemaTables.All, + Arrays.asList(BuiltIndexes, + Hints, + Batchlog, + Paxos, + Local, + Peers, + PeerEvents, + RangeXfers, + CompactionsInProgress, + CompactionHistory, + SSTableActivity, + SizeEstimates)); + return new KSMetaData(NAME, LocalStrategy.class, Collections.<String, String>emptyMap(), true, tables); + } private static volatile Map<UUID, Pair<ReplayPosition, Long>> truncationRecords; http://git-wip-us.apache.org/repos/asf/cassandra/blob/afee0229/src/java/org/apache/cassandra/service/CassandraDaemon.java ----------------------------------------------------------------------