Merge branch 'cassandra-3.11' into trunk * cassandra-3.11: Possible AssertionError in UnfilteredRowIteratorWithLowerBound
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/a87b15d1 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/a87b15d1 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/a87b15d1 Branch: refs/heads/trunk Commit: a87b15d1d6c42f4247c84b460ed39899d8813a6f Parents: 8b74ae4 f55cb88 Author: Sylvain Lebresne <sylv...@datastax.com> Authored: Thu Mar 23 10:29:59 2017 +0100 Committer: Sylvain Lebresne <sylv...@datastax.com> Committed: Thu Mar 23 10:29:59 2017 +0100 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../db/SinglePartitionReadCommand.java | 4 +-- .../db/compaction/CompactionController.java | 2 +- .../UnfilteredRowIteratorWithLowerBound.java | 30 +++++++++++++++--- .../io/sstable/format/SSTableReader.java | 33 +++++++------------- 5 files changed, 42 insertions(+), 28 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/a87b15d1/CHANGES.txt ---------------------------------------------------------------------- diff --cc CHANGES.txt index b68e51c,f4e48ff..c1d5e94 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,50 -1,5 +1,51 @@@ +4.0 + * Cleanup ParentRepairSession after repairs (CASSANDRA-13359) + * Incremental repair not streaming correct sstables (CASSANDRA-13328) + * Upgrade the jna version to 4.3.0 (CASSANDRA-13300) + * Add the currentTimestamp, currentDate, currentTime and currentTimeUUID functions (CASSANDRA-13132) + * Remove config option index_interval (CASSANDRA-10671) + * Reduce lock contention for collection types and serializers (CASSANDRA-13271) + * Make it possible to override MessagingService.Verb ids (CASSANDRA-13283) + * Avoid synchronized on prepareForRepair in ActiveRepairService (CASSANDRA-9292) + * Adds the ability to use uncompressed chunks in compressed files (CASSANDRA-10520) + * Don't flush sstables when streaming for incremental repair (CASSANDRA-13226) + * Remove unused method (CASSANDRA-13227) + * Fix minor bugs related to #9143 (CASSANDRA-13217) + * Output warning if user increases RF (CASSANDRA-13079) + * Remove pre-3.0 streaming compatibility code for 4.0 (CASSANDRA-13081) + * Add support for + and - operations on dates (CASSANDRA-11936) + * Fix consistency of incrementally repaired data (CASSANDRA-9143) + * Increase commitlog version (CASSANDRA-13161) + * Make TableMetadata immutable, optimize Schema (CASSANDRA-9425) + * Refactor ColumnCondition (CASSANDRA-12981) + * Parallelize streaming of different keyspaces (CASSANDRA-4663) + * Improved compactions metrics (CASSANDRA-13015) + * Speed-up start-up sequence by avoiding un-needed flushes (CASSANDRA-13031) + * Use Caffeine (W-TinyLFU) for on-heap caches (CASSANDRA-10855) + * Thrift removal (CASSANDRA-11115) + * Remove pre-3.0 compatibility code for 4.0 (CASSANDRA-12716) + * Add column definition kind to dropped columns in schema (CASSANDRA-12705) + * Add (automate) Nodetool Documentation (CASSANDRA-12672) + * Update bundled cqlsh python driver to 3.7.0 (CASSANDRA-12736) + * Reject invalid replication settings when creating or altering a keyspace (CASSANDRA-12681) + * Clean up the SSTableReader#getScanner API wrt removal of RateLimiter (CASSANDRA-12422) + * Use new token allocation for non bootstrap case as well (CASSANDRA-13080) + * Avoid byte-array copy when key cache is disabled (CASSANDRA-13084) + * Require forceful decommission if number of nodes is less than replication factor (CASSANDRA-12510) + * Allow IN restrictions on column families with collections (CASSANDRA-12654) + * Log message size in trace message in OutboundTcpConnection (CASSANDRA-13028) + * Add timeUnit Days for cassandra-stress (CASSANDRA-13029) + * Add mutation size and batch metrics (CASSANDRA-12649) + * Add method to get size of endpoints to TokenMetadata (CASSANDRA-12999) + * Expose time spent waiting in thread pool queue (CASSANDRA-8398) + * Conditionally update index built status to avoid unnecessary flushes (CASSANDRA-12969) + * cqlsh auto completion: refactor definition of compaction strategy options (CASSANDRA-12946) + * Add support for arithmetic operators (CASSANDRA-11935) + * Add histogram for delay to deliver hints (CASSANDRA-13234) + + 3.11.0 + * Possible AssertionError in UnfilteredRowIteratorWithLowerBound (CASSANDRA-13366) * Support unaligned memory access for AArch64 (CASSANDRA-13326) * Improve SASI range iterator efficiency on intersection with an empty range (CASSANDRA-12915). * Fix equality comparisons of columns using the duration type (CASSANDRA-13174) http://git-wip-us.apache.org/repos/asf/cassandra/blob/a87b15d1/src/java/org/apache/cassandra/db/SinglePartitionReadCommand.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/a87b15d1/src/java/org/apache/cassandra/db/rows/UnfilteredRowIteratorWithLowerBound.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/db/rows/UnfilteredRowIteratorWithLowerBound.java index 74ade1e,4536036..d23c37c --- a/src/java/org/apache/cassandra/db/rows/UnfilteredRowIteratorWithLowerBound.java +++ b/src/java/org/apache/cassandra/db/rows/UnfilteredRowIteratorWithLowerBound.java @@@ -203,7 -234,10 +222,10 @@@ public class UnfilteredRowIteratorWithL */ private boolean canUseMetadataLowerBound() { - return !sstable.hasTombstones(); + // Side-note: pre-2.1 sstable stat file had clustering value arrays whose size may not match the comparator size + // and that would break getMetadataLowerBound. We don't support upgrade from 2.0 to 3.0 directly however so it's + // not a true concern. Besides, !sstable.mayHaveTombstones already ensure this is a 3.0 sstable anyway. - return !sstable.mayHaveTombstones() && !sstable.metadata.isCompactTable(); ++ return !sstable.mayHaveTombstones() && !sstable.metadata().isCompactTable(); } /** http://git-wip-us.apache.org/repos/asf/cassandra/blob/a87b15d1/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java index f9f6f5f,321abc7..980acbb --- a/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java +++ b/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java @@@ -43,10 -44,14 +43,11 @@@ import org.apache.cassandra.cache.KeyCa import org.apache.cassandra.concurrent.DebuggableThreadPoolExecutor; import org.apache.cassandra.concurrent.NamedThreadFactory; import org.apache.cassandra.concurrent.ScheduledExecutors; -import org.apache.cassandra.config.CFMetaData; import org.apache.cassandra.config.Config; import org.apache.cassandra.config.DatabaseDescriptor; -import org.apache.cassandra.config.Schema; -import org.apache.cassandra.config.SchemaConstants; import org.apache.cassandra.db.*; import org.apache.cassandra.db.filter.ColumnFilter; + import org.apache.cassandra.db.rows.Cell; import org.apache.cassandra.db.rows.EncodingStats; import org.apache.cassandra.db.rows.UnfilteredRowIterator; import org.apache.cassandra.dht.AbstractBounds; @@@ -1864,12 -1882,20 +1865,18 @@@ public abstract class SSTableReader ext return sstableMetadata.maxLocalDeletionTime; } - /** sstable contains no tombstones if minLocalDeletionTime == Integer.MAX_VALUE */ - public boolean hasTombstones() + /** + * Whether the sstable may contain tombstones or if it is guaranteed to not contain any. + * <p> + * Note that having that method return {@code false} guarantees the sstable has no tombstones whatsoever (so no + * cell tombstone, no range tombstone maker and no expiring columns), but having it return {@code true} doesn't - * guarantee it contains any as 1) it may simply have non-expired cells and 2) old-format sstables didn't contain - * enough information to decide this and so always return {@code true}. ++ * guarantee it contains any as it may simply have non-expired cells. + */ + public boolean mayHaveTombstones() { - // sstable contains no tombstone if minLocalDeletionTime is still set to the default value Integer.MAX_VALUE - // which is bigger than any valid deletion times - return getMinLocalDeletionTime() != Integer.MAX_VALUE; - // A sstable is guaranteed to have no tombstones if it properly tracked the minLocalDeletionTime (which we only - // do since 3.0 - see CASSANDRA-13366) and that value is still set to its default, Cell.NO_DELETION_TIME, which - // is bigger than any valid deletion times. - return !descriptor.version.storeRows() || getMinLocalDeletionTime() != Cell.NO_DELETION_TIME; ++ // A sstable is guaranteed to have no tombstones if minLocalDeletionTime is still set to its default, ++ // Cell.NO_DELETION_TIME, which is bigger than any valid deletion times. ++ return getMinLocalDeletionTime() != Cell.NO_DELETION_TIME; } public int getMinTTL() @@@ -1991,25 -2017,9 +1998,9 @@@ readMeter.mark(); } - /** - * Checks if this sstable can overlap with another one based on the min/man clustering values. - * If this methods return false, we're guarantee that {@code this} and {@code other} have no overlapping - * data, i.e. no cells to reconcile. - */ - public boolean mayOverlapsWith(SSTableReader other) - { - StatsMetadata m1 = getSSTableMetadata(); - StatsMetadata m2 = other.getSSTableMetadata(); - - if (m1.minClusteringValues.isEmpty() || m1.maxClusteringValues.isEmpty() || m2.minClusteringValues.isEmpty() || m2.maxClusteringValues.isEmpty()) - return true; - - return !(compare(m1.maxClusteringValues, m2.minClusteringValues) < 0 || compare(m1.minClusteringValues, m2.maxClusteringValues) > 0); - } - private int compare(List<ByteBuffer> values1, List<ByteBuffer> values2) { - ClusteringComparator comparator = metadata.comparator; + ClusteringComparator comparator = metadata().comparator; for (int i = 0; i < Math.min(values1.size(), values2.size()); i++) { int cmp = comparator.subtype(i).compare(values1.get(i), values2.get(i));