Merge branch 'cassandra-3.0' into cassandra-3.11
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/863ad11c Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/863ad11c Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/863ad11c Branch: refs/heads/trunk Commit: 863ad11c8acb6c5f811d2cb2668eb353863f29e6 Parents: 5efaaf9 2d6fd78 Author: Alex Petrov <oleksandr.pet...@gmail.com> Authored: Fri Apr 7 12:16:22 2017 +0200 Committer: Alex Petrov <oleksandr.pet...@gmail.com> Committed: Fri Apr 7 12:16:22 2017 +0200 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../db/SinglePartitionReadCommand.java | 11 +-- .../db/filter/ClusteringIndexNamesFilter.java | 6 +- .../db/partitions/AbstractBTreePartition.java | 5 -- .../cassandra/utils/IndexedSearchIterator.java | 5 ++ .../apache/cassandra/utils/SearchIterator.java | 2 - .../cassandra/utils/memory/EnsureOnHeap.java | 5 -- .../cql3/validation/operations/DeleteTest.java | 82 +++++++++++++++++++- .../partition/PartitionImplementationTest.java | 2 +- 9 files changed, 92 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/863ad11c/CHANGES.txt ---------------------------------------------------------------------- diff --cc CHANGES.txt index 26e64d2,440ccd8..aa8c3ff --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,27 -1,5 +1,28 @@@ -3.0.13 +3.11.0 + * Avoid rebuilding SASI indexes containing no values (CASSANDRA-12962) + * Add charset to Analyser input stream (CASSANDRA-13151) + * Fix testLimitSSTables flake caused by concurrent flush (CASSANDRA-12820) + * cdc column addition strikes again (CASSANDRA-13382) + * Fix static column indexes (CASSANDRA-13277) + * DataOutputBuffer.asNewBuffer broken (CASSANDRA-13298) + * unittest CipherFactoryTest failed on MacOS (CASSANDRA-13370) + * Forbid SELECT restrictions and CREATE INDEX over non-frozen UDT columns (CASSANDRA-13247) + * Default logging we ship will incorrectly print "?:?" for "%F:%L" pattern (CASSANDRA-13317) + * 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) + * Obfuscate password in stress-graphs (CASSANDRA-12233) + * Move to FastThreadLocalThread and FastThreadLocal (CASSANDRA-13034) + * nodetool stopdaemon errors out (CASSANDRA-13030) + * Tables in system_distributed should not use gcgs of 0 (CASSANDRA-12954) + * Fix primary index calculation for SASI (CASSANDRA-12910) + * More fixes to the TokenAllocator (CASSANDRA-12990) + * NoReplicationTokenAllocator should work with zero replication factor (CASSANDRA-12983) + * Address message coalescing regression (CASSANDRA-12676) + * Delete illegal character from StandardTokenizerImpl.jflex (CASSANDRA-13417) +Merged from 3.0: + * Make reading of range tombstones more reliable (CASSANDRA-12811) * Fix startup problems due to schema tables not completely flushed (CASSANDRA-12213) * Fix view builder bug that can filter out data on restart (CASSANDRA-13405) * Fix 2i page size calculation when there are no regular columns (CASSANDRA-13400) http://git-wip-us.apache.org/repos/asf/cassandra/blob/863ad11c/src/java/org/apache/cassandra/db/SinglePartitionReadCommand.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/db/SinglePartitionReadCommand.java index 724f59e,99abd10..1358f29 --- a/src/java/org/apache/cassandra/db/SinglePartitionReadCommand.java +++ b/src/java/org/apache/cassandra/db/SinglePartitionReadCommand.java @@@ -778,13 -736,13 +778,13 @@@ public class SinglePartitionReadComman // We need to get the partition deletion and include it if it's live. In any case though, we're done with that sstable. sstable.incrementReadCount(); - try (UnfilteredRowIterator iter = StorageHook.instance.makeRowIterator(cfs, sstable, partitionKey(), Slices.ALL, columnFilter(), filter.isReversed(), isForThrift())) - try (UnfilteredRowIterator iter = filter.filter(sstable.iterator(partitionKey(), columnFilter(), filter.isReversed(), isForThrift()))) ++ try (UnfilteredRowIterator iter = StorageHook.instance.makeRowIterator(cfs, sstable, partitionKey(), filter.getSlices(metadata()), columnFilter(), filter.isReversed(), isForThrift())) { + sstablesIterated++; if (!iter.partitionLevelDeletion().isLive()) - { - sstablesIterated++; result = add(UnfilteredRowIterators.noRowsIterator(iter.metadata(), iter.partitionKey(), Rows.EMPTY_STATIC_ROW, iter.partitionLevelDeletion(), filter.isReversed()), result, filter, sstable.isRepaired()); - } + else + result = add(iter, result, filter, sstable.isRepaired()); } continue; } http://git-wip-us.apache.org/repos/asf/cassandra/blob/863ad11c/src/java/org/apache/cassandra/db/filter/ClusteringIndexNamesFilter.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/863ad11c/src/java/org/apache/cassandra/db/partitions/AbstractBTreePartition.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/863ad11c/src/java/org/apache/cassandra/utils/SearchIterator.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/863ad11c/src/java/org/apache/cassandra/utils/memory/EnsureOnHeap.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/utils/memory/EnsureOnHeap.java index 8345118,0000000..54ace5e mode 100644,000000..100644 --- a/src/java/org/apache/cassandra/utils/memory/EnsureOnHeap.java +++ b/src/java/org/apache/cassandra/utils/memory/EnsureOnHeap.java @@@ -1,170 -1,0 +1,165 @@@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.cassandra.utils.memory; + +import java.util.Iterator; + +import org.apache.cassandra.db.BufferDecoratedKey; +import org.apache.cassandra.db.Clustering; +import org.apache.cassandra.db.DecoratedKey; +import org.apache.cassandra.db.DeletionInfo; +import org.apache.cassandra.db.rows.*; +import org.apache.cassandra.db.transform.Transformation; +import org.apache.cassandra.utils.SearchIterator; + +public abstract class EnsureOnHeap extends Transformation +{ + public abstract DecoratedKey applyToPartitionKey(DecoratedKey key); + public abstract UnfilteredRowIterator applyToPartition(UnfilteredRowIterator partition); + public abstract SearchIterator<Clustering, Row> applyToPartition(SearchIterator<Clustering, Row> partition); + public abstract Iterator<Row> applyToPartition(Iterator<Row> partition); + public abstract DeletionInfo applyToDeletionInfo(DeletionInfo deletionInfo); + public abstract Row applyToRow(Row row); + public abstract Row applyToStatic(Row row); + public abstract RangeTombstoneMarker applyToMarker(RangeTombstoneMarker marker); + + static class CloneToHeap extends EnsureOnHeap + { + protected BaseRowIterator<?> applyToPartition(BaseRowIterator partition) + { + return partition instanceof UnfilteredRowIterator + ? Transformation.apply((UnfilteredRowIterator) partition, this) + : Transformation.apply((RowIterator) partition, this); + } + + public DecoratedKey applyToPartitionKey(DecoratedKey key) + { + return new BufferDecoratedKey(key.getToken(), HeapAllocator.instance.clone(key.getKey())); + } + + public Row applyToRow(Row row) + { + if (row == null) + return null; + return Rows.copy(row, HeapAllocator.instance.cloningBTreeRowBuilder()).build(); + } + + public Row applyToStatic(Row row) + { + if (row == Rows.EMPTY_STATIC_ROW) + return row; + return applyToRow(row); + } + + public RangeTombstoneMarker applyToMarker(RangeTombstoneMarker marker) + { + return marker.copy(HeapAllocator.instance); + } + + public UnfilteredRowIterator applyToPartition(UnfilteredRowIterator partition) + { + return Transformation.apply(partition, this); + } + + public SearchIterator<Clustering, Row> applyToPartition(SearchIterator<Clustering, Row> partition) + { + return new SearchIterator<Clustering, Row>() + { - public boolean hasNext() - { - return partition.hasNext(); - } - + public Row next(Clustering key) + { + return applyToRow(partition.next(key)); + } + }; + } + + public Iterator<Row> applyToPartition(Iterator<Row> partition) + { + return new Iterator<Row>() + { + public boolean hasNext() + { + return partition.hasNext(); + } + public Row next() + { + return applyToRow(partition.next()); + } + public void remove() + { + partition.remove(); + } + }; + } + + public DeletionInfo applyToDeletionInfo(DeletionInfo deletionInfo) + { + return deletionInfo.copy(HeapAllocator.instance); + } + } + + static class NoOp extends EnsureOnHeap + { + protected BaseRowIterator<?> applyToPartition(BaseRowIterator partition) + { + return partition; + } + + public DecoratedKey applyToPartitionKey(DecoratedKey key) + { + return key; + } + + public Row applyToRow(Row row) + { + return row; + } + + public Row applyToStatic(Row row) + { + return row; + } + + public RangeTombstoneMarker applyToMarker(RangeTombstoneMarker marker) + { + return marker; + } + + public UnfilteredRowIterator applyToPartition(UnfilteredRowIterator partition) + { + return partition; + } + + public SearchIterator<Clustering, Row> applyToPartition(SearchIterator<Clustering, Row> partition) + { + return partition; + } + + public Iterator<Row> applyToPartition(Iterator<Row> partition) + { + return partition; + } + + public DeletionInfo applyToDeletionInfo(DeletionInfo deletionInfo) + { + return deletionInfo; + } + } +} http://git-wip-us.apache.org/repos/asf/cassandra/blob/863ad11c/test/unit/org/apache/cassandra/cql3/validation/operations/DeleteTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/863ad11c/test/unit/org/apache/cassandra/db/partition/PartitionImplementationTest.java ----------------------------------------------------------------------