merge from 1.2
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/76c8fe46 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/76c8fe46 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/76c8fe46 Branch: refs/heads/trunk Commit: 76c8fe4676f8789ec407b75295d5a2a322a3a659 Parents: a7b2ff6 6a4af0c Author: Jonathan Ellis <[email protected]> Authored: Thu Apr 4 13:32:57 2013 -0500 Committer: Jonathan Ellis <[email protected]> Committed: Thu Apr 4 13:32:57 2013 -0500 ---------------------------------------------------------------------- CHANGES.txt | 2 + .../apache/cassandra/db/AtomicSortedColumns.java | 2 + .../cassandra/db/index/SecondaryIndexManager.java | 43 +++-- test/unit/org/apache/cassandra/SchemaLoader.java | 29 +++ .../db/index/PerRowSecondaryIndexTest.java | 151 +++++++++++++++ 5 files changed, 214 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/76c8fe46/CHANGES.txt ---------------------------------------------------------------------- diff --cc CHANGES.txt index 4ad46e7,e64358f..2392c56 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,35 -1,6 +1,37 @@@ +2.0 + * Add yaml network topology snitch for mixed ec2/other envs (CASSANDRA-5339) + * Log when a node is down longer than the hint window (CASSANDRA-4554) + * Optimize tombstone creation for ExpiringColumns (CASSANDRA-4917) + * Improve LeveledScanner work estimation (CASSANDRA-5250, 5407) + * Replace compaction lock with runWithCompactionsDisabled (CASSANDRA-3430) + * Change Message IDs to ints (CASSANDRA-5307) + * Move sstable level information into the Stats component, removing the + need for a separate Manifest file (CASSANDRA-4872) + * avoid serializing to byte[] on commitlog append (CASSANDRA-5199) + * make index_interval configurable per columnfamily (CASSANDRA-3961) + * add default_time_to_live (CASSANDRA-3974) + * add memtable_flush_period_in_ms (CASSANDRA-4237) + * replace supercolumns internally by composites (CASSANDRA-3237, 5123) + * upgrade thrift to 0.9.0 (CASSANDRA-3719) + * drop unnecessary keyspace parameter from user-defined compaction API + (CASSANDRA-5139) + * more robust solution to incomplete compactions + counters (CASSANDRA-5151) + * Change order of directory searching for c*.in.sh (CASSANDRA-3983) + * Add tool to reset SSTable compaction level for LCS (CASSANDRA-5271) + * Allow custom configuration loader (CASSANDRA-5045) + * Remove memory emergency pressure valve logic (CASSANDRA-3534) + * Reduce request latency with eager retry (CASSANDRA-4705) + * cqlsh: Remove ASSUME command (CASSANDRA-5331) + * Rebuild BF when loading sstables if bloom_filter_fp_chance + has changed since compaction (CASSANDRA-5015) + * remove row-level bloom filters (CASSANDRA-4885) + * Change Kernel Page Cache skipping into row preheating (disabled by default) + (CASSANDRA-4937) + + 1.2.4 + * Ensure that PerRowSecondaryIndex updates see the most recent values + (CASSANDRA-5397) * avoid duplicate index entries ind PrecompactedRow and ParallelCompactionIterable (CASSANDRA-5395) * remove the index entry on oldColumn when new column is a tombstone http://git-wip-us.apache.org/repos/asf/cassandra/blob/76c8fe46/src/java/org/apache/cassandra/db/AtomicSortedColumns.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/76c8fe46/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java index b98e184,df7ceff..92853b1 --- a/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java +++ b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java @@@ -29,15 -26,15 +26,15 @@@ import org.slf4j.Logger import org.slf4j.LoggerFactory; import org.apache.cassandra.config.ColumnDefinition; - import org.apache.cassandra.db.filter.IDiskAtomFilter; - import org.apache.cassandra.exceptions.ConfigurationException; import org.apache.cassandra.db.*; import org.apache.cassandra.db.compaction.CompactionManager; + import org.apache.cassandra.db.filter.IDiskAtomFilter; import org.apache.cassandra.dht.AbstractBounds; + import org.apache.cassandra.exceptions.ConfigurationException; import org.apache.cassandra.io.sstable.ReducingKeyIterator; import org.apache.cassandra.io.sstable.SSTableReader; -import org.apache.cassandra.thrift.Column; import org.apache.cassandra.thrift.IndexExpression; +import org.apache.cassandra.thrift.IndexType; /** * Manages all the indexes associated with a given CFS @@@ -49,11 -46,13 +46,13 @@@ public class SecondaryIndexManage public static final Updater nullUpdater = new Updater() { - public void insert(IColumn column) { } + public void insert(Column column) { } - public void update(IColumn oldColumn, IColumn column) { } + public void update(Column oldColumn, Column column) { } - public void remove(IColumn current) { } + public void remove(Column current) { } + + public void commit() {} }; /** @@@ -589,11 -579,17 +588,17 @@@ public static interface Updater { + /** called when constructing the index against pre-existing data */ - public void insert(IColumn column); + public void insert(Column column); + /** called when updating the index from a memtable */ - public void update(IColumn oldColumn, IColumn column); + public void update(Column oldColumn, Column column); + /** called when lazy-updating the index during compaction (CASSANDRA-2897) */ - public void remove(IColumn current); + public void remove(Column current); + + /** called after memtable updates are complete (CASSANDRA-5397) */ + public void commit(); } private class PerColumnIndexUpdater implements Updater @@@ -629,9 -629,17 +634,14 @@@ if (column.isMarkedForDelete()) return; - SecondaryIndex index = indexFor(column.name()); - if (index == null) - return; - - ((PerColumnSecondaryIndex) index).delete(key.key, column); + for (SecondaryIndex index : indexFor(column.name())) + ((PerColumnSecondaryIndex) index).delete(key.key, column); } + + public void commit() + { + // this is a no-op as per-column index updates are applied immediately + } } private class MixedIndexUpdater implements Updater @@@ -649,35 -657,35 +659,33 @@@ if (column.isMarkedForDelete()) return; - SecondaryIndex index = indexFor(column.name()); - if (index == null) - return; - - if (index instanceof PerColumnSecondaryIndex) + for (SecondaryIndex index : indexFor(column.name())) { - ((PerColumnSecondaryIndex) index).insert(key.key, column); - } - else - { - deferredUpdates.putIfAbsent(index, key.key); + if (index instanceof PerColumnSecondaryIndex) + { + ((PerColumnSecondaryIndex) index).insert(key.key, column); + } + else + { - if (appliedRowLevelIndexes.add(index.getClass())) - ((PerRowSecondaryIndex) index).index(key.key); ++ deferredUpdates.putIfAbsent(index, key.key); + } } } - public void update(IColumn oldColumn, IColumn column) + public void update(Column oldColumn, Column column) { - SecondaryIndex index = indexFor(column.name()); - if (index == null) - return; - - if (index instanceof PerColumnSecondaryIndex) + for (SecondaryIndex index : indexFor(column.name())) { - ((PerColumnSecondaryIndex) index).delete(key.key, oldColumn); - if (!column.isMarkedForDelete()) - ((PerColumnSecondaryIndex) index).insert(key.key, column); - } - else - { - deferredUpdates.putIfAbsent(index, key.key); + if (index instanceof PerColumnSecondaryIndex) + { + ((PerColumnSecondaryIndex) index).delete(key.key, oldColumn); + if (!column.isMarkedForDelete()) + ((PerColumnSecondaryIndex) index).insert(key.key, column); + } + else + { - if (appliedRowLevelIndexes.add(index.getClass())) - ((PerRowSecondaryIndex) index).index(key.key); ++ deferredUpdates.putIfAbsent(index, key.key); + } } } @@@ -686,18 -694,28 +694,27 @@@ if (column.isMarkedForDelete()) return; - SecondaryIndex index = indexFor(column.name()); - if (index == null) - return; - - if (index instanceof PerColumnSecondaryIndex) - { - ((PerColumnSecondaryIndex) index).delete(key.key, column); - } - else + for (SecondaryIndex index : indexFor(column.name())) { - // per-row secondary indexes are assumed to keep the index up-to-date at insert time, rather - // than performing lazy updates + if (index instanceof PerColumnSecondaryIndex) + { + ((PerColumnSecondaryIndex) index).delete(key.key, column); + } + else + { - if (appliedRowLevelIndexes.add(index.getClass())) - ((PerRowSecondaryIndex) index).index(key.key); ++ // per-row secondary indexes are assumed to keep the index up-to-date at insert time, rather ++ // than performing lazy updates + } } } + + public void commit() + { + for (Map.Entry<SecondaryIndex, ByteBuffer> update : deferredUpdates.entrySet()) + { + assert update.getKey() instanceof PerRowSecondaryIndex; + ((PerRowSecondaryIndex) update.getKey()).index(update.getValue()); + } + } } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/76c8fe46/test/unit/org/apache/cassandra/SchemaLoader.java ----------------------------------------------------------------------
