http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/src/java/org/apache/cassandra/db/Slice.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/Slice.java b/src/java/org/apache/cassandra/db/Slice.java index 8611470..c3da222 100644 --- a/src/java/org/apache/cassandra/db/Slice.java +++ b/src/java/org/apache/cassandra/db/Slice.java @@ -38,10 +38,10 @@ public class Slice public static final Serializer serializer = new Serializer(); /** The slice selecting all rows (of a given partition) */ - public static final Slice ALL = new Slice(Bound.BOTTOM, Bound.TOP) + public static final Slice ALL = new Slice(ClusteringBound.BOTTOM, ClusteringBound.TOP) { @Override - public boolean selects(ClusteringComparator comparator, Clustering clustering) + public boolean includes(ClusteringComparator comparator, ClusteringPrefix clustering) { return true; } @@ -59,19 +59,19 @@ public class Slice } }; - private final Bound start; - private final Bound end; + private final ClusteringBound start; + private final ClusteringBound end; - private Slice(Bound start, Bound end) + private Slice(ClusteringBound start, ClusteringBound end) { assert start.isStart() && end.isEnd(); this.start = start; this.end = end; } - public static Slice make(Bound start, Bound end) + public static Slice make(ClusteringBound start, ClusteringBound end) { - if (start == Bound.BOTTOM && end == Bound.TOP) + if (start == ClusteringBound.BOTTOM && end == ClusteringBound.TOP) return ALL; return new Slice(start, end); @@ -95,7 +95,7 @@ public class Slice // This doesn't give us what we want with the clustering prefix assert clustering != Clustering.STATIC_CLUSTERING; ByteBuffer[] values = extractValues(clustering); - return new Slice(Bound.inclusiveStartOf(values), Bound.inclusiveEndOf(values)); + return new Slice(ClusteringBound.inclusiveStartOf(values), ClusteringBound.inclusiveEndOf(values)); } public static Slice make(Clustering start, Clustering end) @@ -106,7 +106,7 @@ public class Slice ByteBuffer[] startValues = extractValues(start); ByteBuffer[] endValues = extractValues(end); - return new Slice(Bound.inclusiveStartOf(startValues), Bound.inclusiveEndOf(endValues)); + return new Slice(ClusteringBound.inclusiveStartOf(startValues), ClusteringBound.inclusiveEndOf(endValues)); } private static ByteBuffer[] extractValues(ClusteringPrefix clustering) @@ -117,22 +117,22 @@ public class Slice return values; } - public Bound start() + public ClusteringBound start() { return start; } - public Bound end() + public ClusteringBound end() { return end; } - public Bound open(boolean reversed) + public ClusteringBound open(boolean reversed) { return reversed ? end : start; } - public Bound close(boolean reversed) + public ClusteringBound close(boolean reversed) { return reversed ? start : end; } @@ -157,34 +157,21 @@ public class Slice * @return whether the slice formed by {@code start} and {@code end} is * empty or not. */ - public static boolean isEmpty(ClusteringComparator comparator, Slice.Bound start, Slice.Bound end) + public static boolean isEmpty(ClusteringComparator comparator, ClusteringBound start, ClusteringBound end) { assert start.isStart() && end.isEnd(); return comparator.compare(end, start) < 0; } /** - * Returns whether a given clustering is selected by this slice. - * - * @param comparator the comparator for the table this is a slice of. - * @param clustering the clustering to test inclusion of. - * - * @return whether {@code clustering} is selected by this slice. - */ - public boolean selects(ClusteringComparator comparator, Clustering clustering) - { - return comparator.compare(start, clustering) <= 0 && comparator.compare(clustering, end) <= 0; - } - - /** - * Returns whether a given bound is included in this slice. + * Returns whether a given clustering or bound is included in this slice. * * @param comparator the comparator for the table this is a slice of. * @param bound the bound to test inclusion of. * * @return whether {@code bound} is within the bounds of this slice. */ - public boolean includes(ClusteringComparator comparator, Bound bound) + public boolean includes(ClusteringComparator comparator, ClusteringPrefix bound) { return comparator.compare(start, bound) <= 0 && comparator.compare(bound, end) <= 0; } @@ -218,7 +205,7 @@ public class Slice return this; ByteBuffer[] values = extractValues(lastReturned); - return new Slice(start, inclusive ? Bound.inclusiveEndOf(values) : Bound.exclusiveEndOf(values)); + return new Slice(start, inclusive ? ClusteringBound.inclusiveEndOf(values) : ClusteringBound.exclusiveEndOf(values)); } else { @@ -231,7 +218,7 @@ public class Slice return this; ByteBuffer[] values = extractValues(lastReturned); - return new Slice(inclusive ? Bound.inclusiveStartOf(values) : Bound.exclusiveStartOf(values), end); + return new Slice(inclusive ? ClusteringBound.inclusiveStartOf(values) : ClusteringBound.exclusiveStartOf(values), end); } } @@ -320,238 +307,21 @@ public class Slice { public void serialize(Slice slice, DataOutputPlus out, int version, List<AbstractType<?>> types) throws IOException { - Bound.serializer.serialize(slice.start, out, version, types); - Bound.serializer.serialize(slice.end, out, version, types); + ClusteringBound.serializer.serialize(slice.start, out, version, types); + ClusteringBound.serializer.serialize(slice.end, out, version, types); } public long serializedSize(Slice slice, int version, List<AbstractType<?>> types) { - return Bound.serializer.serializedSize(slice.start, version, types) - + Bound.serializer.serializedSize(slice.end, version, types); + return ClusteringBound.serializer.serializedSize(slice.start, version, types) + + ClusteringBound.serializer.serializedSize(slice.end, version, types); } public Slice deserialize(DataInputPlus in, int version, List<AbstractType<?>> types) throws IOException { - Bound start = Bound.serializer.deserialize(in, version, types); - Bound end = Bound.serializer.deserialize(in, version, types); + ClusteringBound start = (ClusteringBound) ClusteringBound.serializer.deserialize(in, version, types); + ClusteringBound end = (ClusteringBound) ClusteringBound.serializer.deserialize(in, version, types); return new Slice(start, end); } } - - /** - * The bound of a slice. - * <p> - * This can be either a start or an end bound, and this can be either inclusive or exclusive. - */ - public static class Bound extends AbstractBufferClusteringPrefix - { - public static final Serializer serializer = new Serializer(); - - /** - * The smallest and biggest bound. Note that as range tomstone bounds are (special case) of slice bounds, - * we want the BOTTOM and TOP to be the same object, but we alias them here because it's cleaner when dealing - * with slices to refer to Slice.Bound.BOTTOM and Slice.Bound.TOP. - */ - public static final Bound BOTTOM = RangeTombstone.Bound.BOTTOM; - public static final Bound TOP = RangeTombstone.Bound.TOP; - - protected Bound(Kind kind, ByteBuffer[] values) - { - super(kind, values); - } - - public static Bound create(Kind kind, ByteBuffer[] values) - { - assert !kind.isBoundary(); - return new Bound(kind, values); - } - - public static Kind boundKind(boolean isStart, boolean isInclusive) - { - return isStart - ? (isInclusive ? Kind.INCL_START_BOUND : Kind.EXCL_START_BOUND) - : (isInclusive ? Kind.INCL_END_BOUND : Kind.EXCL_END_BOUND); - } - - public static Bound inclusiveStartOf(ByteBuffer... values) - { - return create(Kind.INCL_START_BOUND, values); - } - - public static Bound inclusiveEndOf(ByteBuffer... values) - { - return create(Kind.INCL_END_BOUND, values); - } - - public static Bound exclusiveStartOf(ByteBuffer... values) - { - return create(Kind.EXCL_START_BOUND, values); - } - - public static Bound exclusiveEndOf(ByteBuffer... values) - { - return create(Kind.EXCL_END_BOUND, values); - } - - public static Bound inclusiveStartOf(ClusteringPrefix prefix) - { - ByteBuffer[] values = new ByteBuffer[prefix.size()]; - for (int i = 0; i < prefix.size(); i++) - values[i] = prefix.get(i); - return inclusiveStartOf(values); - } - - public static Bound exclusiveStartOf(ClusteringPrefix prefix) - { - ByteBuffer[] values = new ByteBuffer[prefix.size()]; - for (int i = 0; i < prefix.size(); i++) - values[i] = prefix.get(i); - return exclusiveStartOf(values); - } - - public static Bound inclusiveEndOf(ClusteringPrefix prefix) - { - ByteBuffer[] values = new ByteBuffer[prefix.size()]; - for (int i = 0; i < prefix.size(); i++) - values[i] = prefix.get(i); - return inclusiveEndOf(values); - } - - public static Bound create(ClusteringComparator comparator, boolean isStart, boolean isInclusive, Object... values) - { - CBuilder builder = CBuilder.create(comparator); - for (Object val : values) - { - if (val instanceof ByteBuffer) - builder.add((ByteBuffer) val); - else - builder.add(val); - } - return builder.buildBound(isStart, isInclusive); - } - - public Bound withNewKind(Kind kind) - { - assert !kind.isBoundary(); - return new Bound(kind, values); - } - - public boolean isStart() - { - return kind().isStart(); - } - - public boolean isEnd() - { - return !isStart(); - } - - public boolean isInclusive() - { - return kind == Kind.INCL_START_BOUND || kind == Kind.INCL_END_BOUND; - } - - public boolean isExclusive() - { - return kind == Kind.EXCL_START_BOUND || kind == Kind.EXCL_END_BOUND; - } - - /** - * Returns the inverse of the current bound. - * <p> - * This invert both start into end (and vice-versa) and inclusive into exclusive (and vice-versa). - * - * @return the invert of this bound. For instance, if this bound is an exlusive start, this return - * an inclusive end with the same values. - */ - public Slice.Bound invert() - { - return withNewKind(kind().invert()); - } - - // For use by intersects, it's called with the sstable bound opposite to the slice bound - // (so if the slice bound is a start, it's call with the max sstable bound) - private int compareTo(ClusteringComparator comparator, List<ByteBuffer> sstableBound) - { - for (int i = 0; i < sstableBound.size(); i++) - { - // Say the slice bound is a start. It means we're in the case where the max - // sstable bound is say (1:5) while the slice start is (1). So the start - // does start before the sstable end bound (and intersect it). It's the exact - // inverse with a end slice bound. - if (i >= size()) - return isStart() ? -1 : 1; - - int cmp = comparator.compareComponent(i, get(i), sstableBound.get(i)); - if (cmp != 0) - return cmp; - } - - // Say the slice bound is a start. I means we're in the case where the max - // sstable bound is say (1), while the slice start is (1:5). This again means - // that the slice start before the end bound. - if (size() > sstableBound.size()) - return isStart() ? -1 : 1; - - // The slice bound is equal to the sstable bound. Results depends on whether the slice is inclusive or not - return isInclusive() ? 0 : (isStart() ? 1 : -1); - } - - public String toString(CFMetaData metadata) - { - return toString(metadata.comparator); - } - - public String toString(ClusteringComparator comparator) - { - StringBuilder sb = new StringBuilder(); - sb.append(kind()).append('('); - for (int i = 0; i < size(); i++) - { - if (i > 0) - sb.append(", "); - sb.append(comparator.subtype(i).getString(get(i))); - } - return sb.append(')').toString(); - } - - /** - * Serializer for slice bounds. - * <p> - * Contrarily to {@code Clustering}, a slice bound can be a true prefix of the full clustering, so we actually record - * its size. - */ - public static class Serializer - { - public void serialize(Slice.Bound bound, DataOutputPlus out, int version, List<AbstractType<?>> types) throws IOException - { - out.writeByte(bound.kind().ordinal()); - out.writeShort(bound.size()); - ClusteringPrefix.serializer.serializeValuesWithoutSize(bound, out, version, types); - } - - public long serializedSize(Slice.Bound bound, int version, List<AbstractType<?>> types) - { - return 1 // kind ordinal - + TypeSizes.sizeof((short)bound.size()) - + ClusteringPrefix.serializer.valuesWithoutSizeSerializedSize(bound, version, types); - } - - public Slice.Bound deserialize(DataInputPlus in, int version, List<AbstractType<?>> types) throws IOException - { - Kind kind = Kind.values()[in.readByte()]; - return deserializeValues(in, kind, version, types); - } - - public Slice.Bound deserializeValues(DataInputPlus in, Kind kind, int version, List<AbstractType<?>> types) throws IOException - { - int size = in.readUnsignedShort(); - if (size == 0) - return kind.isStart() ? BOTTOM : TOP; - - ByteBuffer[] values = ClusteringPrefix.serializer.deserializeValuesWithoutSize(in, size, version, types); - return Slice.Bound.create(kind, values); - } - } - } }
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/src/java/org/apache/cassandra/db/Slices.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/Slices.java b/src/java/org/apache/cassandra/db/Slices.java index 13533d6..4fcda59 100644 --- a/src/java/org/apache/cassandra/db/Slices.java +++ b/src/java/org/apache/cassandra/db/Slices.java @@ -59,7 +59,7 @@ public abstract class Slices implements Iterable<Slice> */ public static Slices with(ClusteringComparator comparator, Slice slice) { - if (slice.start() == Slice.Bound.BOTTOM && slice.end() == Slice.Bound.TOP) + if (slice.start() == ClusteringBound.BOTTOM && slice.end() == ClusteringBound.TOP) return Slices.ALL; assert comparator.compare(slice.start(), slice.end()) <= 0; @@ -186,7 +186,7 @@ public abstract class Slices implements Iterable<Slice> this.slices = new ArrayList<>(initialSize); } - public Builder add(Slice.Bound start, Slice.Bound end) + public Builder add(ClusteringBound start, ClusteringBound end) { return add(Slice.make(start, end)); } @@ -328,7 +328,7 @@ public abstract class Slices implements Iterable<Slice> for (int i = 0; i < size; i++) slices[i] = Slice.serializer.deserialize(in, version, metadata.comparator.subtypes()); - if (size == 1 && slices[0].start() == Slice.Bound.BOTTOM && slices[0].end() == Slice.Bound.TOP) + if (size == 1 && slices[0].start() == ClusteringBound.BOTTOM && slices[0].end() == ClusteringBound.TOP) return ALL; return new ArrayBackedSlices(metadata.comparator, slices); @@ -646,8 +646,8 @@ public abstract class Slices implements Iterable<Slice> public static ComponentOfSlice fromSlice(int component, Slice slice) { - Slice.Bound start = slice.start(); - Slice.Bound end = slice.end(); + ClusteringBound start = slice.start(); + ClusteringBound end = slice.end(); if (component >= start.size() && component >= end.size()) return null; http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/src/java/org/apache/cassandra/db/UnfilteredDeserializer.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/UnfilteredDeserializer.java b/src/java/org/apache/cassandra/db/UnfilteredDeserializer.java index a9b2903..88be4e5 100644 --- a/src/java/org/apache/cassandra/db/UnfilteredDeserializer.java +++ b/src/java/org/apache/cassandra/db/UnfilteredDeserializer.java @@ -81,7 +81,7 @@ public abstract class UnfilteredDeserializer * comparison. Whenever we know what to do with this atom (read it or skip it), * readNext or skipNext should be called. */ - public abstract int compareNextTo(Slice.Bound bound) throws IOException; + public abstract int compareNextTo(ClusteringBound bound) throws IOException; /** * Returns whether the next atom is a row or not. @@ -173,7 +173,7 @@ public abstract class UnfilteredDeserializer isReady = true; } - public int compareNextTo(Slice.Bound bound) throws IOException + public int compareNextTo(ClusteringBound bound) throws IOException { if (!isReady) prepareNext(); @@ -202,7 +202,7 @@ public abstract class UnfilteredDeserializer isReady = false; if (UnfilteredSerializer.kind(nextFlags) == Unfiltered.Kind.RANGE_TOMBSTONE_MARKER) { - RangeTombstone.Bound bound = clusteringDeserializer.deserializeNextBound(); + ClusteringBoundOrBoundary bound = clusteringDeserializer.deserializeNextBound(); return UnfilteredSerializer.serializer.deserializeMarkerBody(in, header, bound); } else @@ -326,7 +326,7 @@ public abstract class UnfilteredDeserializer return tombstone.isCollectionTombstone() || tombstone.isRowDeletion(metadata); } - public int compareNextTo(Slice.Bound bound) throws IOException + public int compareNextTo(ClusteringBound bound) throws IOException { if (!hasNext()) throw new IllegalStateException(); http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/src/java/org/apache/cassandra/db/columniterator/AbstractSSTableIterator.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/columniterator/AbstractSSTableIterator.java b/src/java/org/apache/cassandra/db/columniterator/AbstractSSTableIterator.java index 5ee46da..8e0f42e 100644 --- a/src/java/org/apache/cassandra/db/columniterator/AbstractSSTableIterator.java +++ b/src/java/org/apache/cassandra/db/columniterator/AbstractSSTableIterator.java @@ -555,11 +555,11 @@ public abstract class AbstractSSTableIterator implements UnfilteredRowIterator // Finds the index of the first block containing the provided bound, starting at the provided index. // Will be -1 if the bound is before any block, and blocksCount() if it is after every block. - public int findBlockIndex(Slice.Bound bound, int fromIdx) throws IOException + public int findBlockIndex(ClusteringBound bound, int fromIdx) throws IOException { - if (bound == Slice.Bound.BOTTOM) + if (bound == ClusteringBound.BOTTOM) return -1; - if (bound == Slice.Bound.TOP) + if (bound == ClusteringBound.TOP) return blocksCount(); return indexFor(bound, fromIdx); http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/src/java/org/apache/cassandra/db/columniterator/SSTableIterator.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/columniterator/SSTableIterator.java b/src/java/org/apache/cassandra/db/columniterator/SSTableIterator.java index 6b8f83f..e4f6700 100644 --- a/src/java/org/apache/cassandra/db/columniterator/SSTableIterator.java +++ b/src/java/org/apache/cassandra/db/columniterator/SSTableIterator.java @@ -59,9 +59,9 @@ public class SSTableIterator extends AbstractSSTableIterator private class ForwardReader extends Reader { // The start of the current slice. This will be null as soon as we know we've passed that bound. - protected Slice.Bound start; + protected ClusteringBound start; // The end of the current slice. Will never be null. - protected Slice.Bound end = Slice.Bound.TOP; + protected ClusteringBound end = ClusteringBound.TOP; protected Unfiltered next; // the next element to return: this is computed by hasNextInternal(). @@ -75,7 +75,7 @@ public class SSTableIterator extends AbstractSSTableIterator public void setForSlice(Slice slice) throws IOException { - start = slice.start() == Slice.Bound.BOTTOM ? null : slice.start(); + start = slice.start() == ClusteringBound.BOTTOM ? null : slice.start(); end = slice.end(); sliceDone = false; @@ -103,7 +103,7 @@ public class SSTableIterator extends AbstractSSTableIterator updateOpenMarker((RangeTombstoneMarker)deserializer.readNext()); } - Slice.Bound sliceStart = start; + ClusteringBound sliceStart = start; start = null; // We've reached the beginning of our queried slice. If we have an open marker http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/src/java/org/apache/cassandra/db/columniterator/SSTableReversedIterator.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/columniterator/SSTableReversedIterator.java b/src/java/org/apache/cassandra/db/columniterator/SSTableReversedIterator.java index 7594cbd..7f6b462 100644 --- a/src/java/org/apache/cassandra/db/columniterator/SSTableReversedIterator.java +++ b/src/java/org/apache/cassandra/db/columniterator/SSTableReversedIterator.java @@ -141,7 +141,7 @@ public class SSTableReversedIterator extends AbstractSSTableIterator // Reads the unfiltered from disk and load them into the reader buffer. It stops reading when either the partition // is fully read, or when stopReadingDisk() returns true. - protected void loadFromDisk(Slice.Bound start, Slice.Bound end, boolean includeFirst) throws IOException + protected void loadFromDisk(ClusteringBound start, ClusteringBound end, boolean includeFirst) throws IOException { buffer.reset(); @@ -163,7 +163,7 @@ public class SSTableReversedIterator extends AbstractSSTableIterator // If we have an open marker, it's either one from what we just skipped (if start != null), or it's from the previous index block. if (openMarker != null) { - RangeTombstone.Bound markerStart = start == null ? RangeTombstone.Bound.BOTTOM : RangeTombstone.Bound.fromSliceBound(start); + ClusteringBound markerStart = start == null ? ClusteringBound.BOTTOM : start; buffer.add(new RangeTombstoneBoundMarker(markerStart, openMarker)); } @@ -186,7 +186,7 @@ public class SSTableReversedIterator extends AbstractSSTableIterator if (openMarker != null) { // If we have no end and still an openMarker, this means we're indexed and the marker is closed in a following block. - RangeTombstone.Bound markerEnd = end == null ? RangeTombstone.Bound.TOP : RangeTombstone.Bound.fromSliceBound(end); + ClusteringBound markerEnd = end == null ? ClusteringBound.TOP : end; buffer.add(new RangeTombstoneBoundMarker(markerEnd, getAndClearOpenMarker())); } http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/src/java/org/apache/cassandra/db/partitions/AbstractBTreePartition.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/partitions/AbstractBTreePartition.java b/src/java/org/apache/cassandra/db/partitions/AbstractBTreePartition.java index c276c57..1c05f3c 100644 --- a/src/java/org/apache/cassandra/db/partitions/AbstractBTreePartition.java +++ b/src/java/org/apache/cassandra/db/partitions/AbstractBTreePartition.java @@ -193,8 +193,8 @@ public abstract class AbstractBTreePartition implements Partition, Iterable<Row> private UnfilteredRowIterator sliceIterator(ColumnFilter selection, Slice slice, boolean reversed, Holder current, Row staticRow) { - Slice.Bound start = slice.start() == Slice.Bound.BOTTOM ? null : slice.start(); - Slice.Bound end = slice.end() == Slice.Bound.TOP ? null : slice.end(); + ClusteringBound start = slice.start() == ClusteringBound.BOTTOM ? null : slice.start(); + ClusteringBound end = slice.end() == ClusteringBound.TOP ? null : slice.end(); Iterator<Row> rowIter = BTree.slice(current.tree, metadata.comparator, start, true, end, true, desc(reversed)); Iterator<RangeTombstone> deleteIter = current.deletionInfo.rangeIterator(slice, reversed); http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/src/java/org/apache/cassandra/db/rows/AbstractRangeTombstoneMarker.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/rows/AbstractRangeTombstoneMarker.java b/src/java/org/apache/cassandra/db/rows/AbstractRangeTombstoneMarker.java index b1ee7ec..153243c 100644 --- a/src/java/org/apache/cassandra/db/rows/AbstractRangeTombstoneMarker.java +++ b/src/java/org/apache/cassandra/db/rows/AbstractRangeTombstoneMarker.java @@ -20,18 +20,18 @@ package org.apache.cassandra.db.rows; import java.nio.ByteBuffer; import org.apache.cassandra.config.CFMetaData; -import org.apache.cassandra.db.*; +import org.apache.cassandra.db.ClusteringBoundOrBoundary; -public abstract class AbstractRangeTombstoneMarker implements RangeTombstoneMarker +public abstract class AbstractRangeTombstoneMarker<B extends ClusteringBoundOrBoundary> implements RangeTombstoneMarker { - protected final RangeTombstone.Bound bound; + protected final B bound; - protected AbstractRangeTombstoneMarker(RangeTombstone.Bound bound) + protected AbstractRangeTombstoneMarker(B bound) { this.bound = bound; } - public RangeTombstone.Bound clustering() + public B clustering() { return bound; } @@ -58,7 +58,7 @@ public abstract class AbstractRangeTombstoneMarker implements RangeTombstoneMark public void validateData(CFMetaData metadata) { - Slice.Bound bound = clustering(); + ClusteringBoundOrBoundary bound = clustering(); for (int i = 0; i < bound.size(); i++) { ByteBuffer value = bound.get(i); http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/src/java/org/apache/cassandra/db/rows/RangeTombstoneBoundMarker.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/rows/RangeTombstoneBoundMarker.java b/src/java/org/apache/cassandra/db/rows/RangeTombstoneBoundMarker.java index b35033d..45e594b 100644 --- a/src/java/org/apache/cassandra/db/rows/RangeTombstoneBoundMarker.java +++ b/src/java/org/apache/cassandra/db/rows/RangeTombstoneBoundMarker.java @@ -28,43 +28,37 @@ import org.apache.cassandra.utils.memory.AbstractAllocator; /** * A range tombstone marker that indicates the bound of a range tombstone (start or end). */ -public class RangeTombstoneBoundMarker extends AbstractRangeTombstoneMarker +public class RangeTombstoneBoundMarker extends AbstractRangeTombstoneMarker<ClusteringBound> { private final DeletionTime deletion; - public RangeTombstoneBoundMarker(RangeTombstone.Bound bound, DeletionTime deletion) + public RangeTombstoneBoundMarker(ClusteringBound bound, DeletionTime deletion) { super(bound); - assert !bound.isBoundary(); this.deletion = deletion; } - public RangeTombstoneBoundMarker(Slice.Bound bound, DeletionTime deletion) - { - this(new RangeTombstone.Bound(bound.kind(), bound.getRawValues()), deletion); - } - public static RangeTombstoneBoundMarker inclusiveOpen(boolean reversed, ByteBuffer[] boundValues, DeletionTime deletion) { - RangeTombstone.Bound bound = RangeTombstone.Bound.inclusiveOpen(reversed, boundValues); + ClusteringBound bound = ClusteringBound.inclusiveOpen(reversed, boundValues); return new RangeTombstoneBoundMarker(bound, deletion); } public static RangeTombstoneBoundMarker exclusiveOpen(boolean reversed, ByteBuffer[] boundValues, DeletionTime deletion) { - RangeTombstone.Bound bound = RangeTombstone.Bound.exclusiveOpen(reversed, boundValues); + ClusteringBound bound = ClusteringBound.exclusiveOpen(reversed, boundValues); return new RangeTombstoneBoundMarker(bound, deletion); } public static RangeTombstoneBoundMarker inclusiveClose(boolean reversed, ByteBuffer[] boundValues, DeletionTime deletion) { - RangeTombstone.Bound bound = RangeTombstone.Bound.inclusiveClose(reversed, boundValues); + ClusteringBound bound = ClusteringBound.inclusiveClose(reversed, boundValues); return new RangeTombstoneBoundMarker(bound, deletion); } public static RangeTombstoneBoundMarker exclusiveClose(boolean reversed, ByteBuffer[] boundValues, DeletionTime deletion) { - RangeTombstone.Bound bound = RangeTombstone.Bound.exclusiveClose(reversed, boundValues); + ClusteringBound bound = ClusteringBound.exclusiveClose(reversed, boundValues); return new RangeTombstoneBoundMarker(bound, deletion); } @@ -109,12 +103,12 @@ public class RangeTombstoneBoundMarker extends AbstractRangeTombstoneMarker return bound.isInclusive(); } - public RangeTombstone.Bound openBound(boolean reversed) + public ClusteringBound openBound(boolean reversed) { return isOpen(reversed) ? clustering() : null; } - public RangeTombstone.Bound closeBound(boolean reversed) + public ClusteringBound closeBound(boolean reversed) { return isClose(reversed) ? clustering() : null; } http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/src/java/org/apache/cassandra/db/rows/RangeTombstoneBoundaryMarker.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/rows/RangeTombstoneBoundaryMarker.java b/src/java/org/apache/cassandra/db/rows/RangeTombstoneBoundaryMarker.java index 06fbf87..fd41bea 100644 --- a/src/java/org/apache/cassandra/db/rows/RangeTombstoneBoundaryMarker.java +++ b/src/java/org/apache/cassandra/db/rows/RangeTombstoneBoundaryMarker.java @@ -28,12 +28,12 @@ import org.apache.cassandra.utils.memory.AbstractAllocator; /** * A range tombstone marker that represents a boundary between 2 range tombstones (i.e. it closes one range and open another). */ -public class RangeTombstoneBoundaryMarker extends AbstractRangeTombstoneMarker +public class RangeTombstoneBoundaryMarker extends AbstractRangeTombstoneMarker<ClusteringBoundary> { private final DeletionTime endDeletion; private final DeletionTime startDeletion; - public RangeTombstoneBoundaryMarker(RangeTombstone.Bound bound, DeletionTime endDeletion, DeletionTime startDeletion) + public RangeTombstoneBoundaryMarker(ClusteringBoundary bound, DeletionTime endDeletion, DeletionTime startDeletion) { super(bound); assert bound.isBoundary(); @@ -43,7 +43,7 @@ public class RangeTombstoneBoundaryMarker extends AbstractRangeTombstoneMarker public static RangeTombstoneBoundaryMarker exclusiveCloseInclusiveOpen(boolean reversed, ByteBuffer[] boundValues, DeletionTime closeDeletion, DeletionTime openDeletion) { - RangeTombstone.Bound bound = RangeTombstone.Bound.exclusiveCloseInclusiveOpen(reversed, boundValues); + ClusteringBoundary bound = ClusteringBoundary.exclusiveCloseInclusiveOpen(reversed, boundValues); DeletionTime endDeletion = reversed ? openDeletion : closeDeletion; DeletionTime startDeletion = reversed ? closeDeletion : openDeletion; return new RangeTombstoneBoundaryMarker(bound, endDeletion, startDeletion); @@ -51,7 +51,7 @@ public class RangeTombstoneBoundaryMarker extends AbstractRangeTombstoneMarker public static RangeTombstoneBoundaryMarker inclusiveCloseExclusiveOpen(boolean reversed, ByteBuffer[] boundValues, DeletionTime closeDeletion, DeletionTime openDeletion) { - RangeTombstone.Bound bound = RangeTombstone.Bound.inclusiveCloseExclusiveOpen(reversed, boundValues); + ClusteringBoundary bound = ClusteringBoundary.inclusiveCloseExclusiveOpen(reversed, boundValues); DeletionTime endDeletion = reversed ? openDeletion : closeDeletion; DeletionTime startDeletion = reversed ? closeDeletion : openDeletion; return new RangeTombstoneBoundaryMarker(bound, endDeletion, startDeletion); @@ -88,14 +88,14 @@ public class RangeTombstoneBoundaryMarker extends AbstractRangeTombstoneMarker return (bound.kind() == ClusteringPrefix.Kind.EXCL_END_INCL_START_BOUNDARY) ^ reversed; } - public RangeTombstone.Bound openBound(boolean reversed) + public ClusteringBound openBound(boolean reversed) { - return bound.withNewKind(bound.kind().openBoundOfBoundary(reversed)); + return bound.openBound(reversed); } - public RangeTombstone.Bound closeBound(boolean reversed) + public ClusteringBound closeBound(boolean reversed) { - return bound.withNewKind(bound.kind().closeBoundOfBoundary(reversed)); + return bound.closeBound(reversed); } public boolean closeIsInclusive(boolean reversed) @@ -120,9 +120,9 @@ public class RangeTombstoneBoundaryMarker extends AbstractRangeTombstoneMarker return new RangeTombstoneBoundaryMarker(clustering().copy(allocator), endDeletion, startDeletion); } - public static RangeTombstoneBoundaryMarker makeBoundary(boolean reversed, Slice.Bound close, Slice.Bound open, DeletionTime closeDeletion, DeletionTime openDeletion) + public static RangeTombstoneBoundaryMarker makeBoundary(boolean reversed, ClusteringBound close, ClusteringBound open, DeletionTime closeDeletion, DeletionTime openDeletion) { - assert RangeTombstone.Bound.Kind.compare(close.kind(), open.kind()) == 0 : "Both bound don't form a boundary"; + assert ClusteringPrefix.Kind.compare(close.kind(), open.kind()) == 0 : "Both bound don't form a boundary"; boolean isExclusiveClose = close.isExclusive() || (close.isInclusive() && open.isInclusive() && openDeletion.supersedes(closeDeletion)); return isExclusiveClose ? exclusiveCloseInclusiveOpen(reversed, close.getRawValues(), closeDeletion, openDeletion) http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/src/java/org/apache/cassandra/db/rows/RangeTombstoneMarker.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/rows/RangeTombstoneMarker.java b/src/java/org/apache/cassandra/db/rows/RangeTombstoneMarker.java index 053b5dc..bc98899 100644 --- a/src/java/org/apache/cassandra/db/rows/RangeTombstoneMarker.java +++ b/src/java/org/apache/cassandra/db/rows/RangeTombstoneMarker.java @@ -20,7 +20,6 @@ package org.apache.cassandra.db.rows; import java.nio.ByteBuffer; import java.util.*; -import org.apache.cassandra.config.CFMetaData; import org.apache.cassandra.db.*; import org.apache.cassandra.utils.memory.AbstractAllocator; @@ -33,7 +32,7 @@ import org.apache.cassandra.utils.memory.AbstractAllocator; public interface RangeTombstoneMarker extends Unfiltered { @Override - public RangeTombstone.Bound clustering(); + public ClusteringBoundOrBoundary clustering(); public boolean isBoundary(); @@ -45,8 +44,8 @@ public interface RangeTombstoneMarker extends Unfiltered public boolean openIsInclusive(boolean reversed); public boolean closeIsInclusive(boolean reversed); - public RangeTombstone.Bound openBound(boolean reversed); - public RangeTombstone.Bound closeBound(boolean reversed); + public ClusteringBound openBound(boolean reversed); + public ClusteringBound closeBound(boolean reversed); public RangeTombstoneMarker copy(AbstractAllocator allocator); @@ -68,7 +67,7 @@ public interface RangeTombstoneMarker extends Unfiltered private final DeletionTime partitionDeletion; private final boolean reversed; - private RangeTombstone.Bound bound; + private ClusteringBoundOrBoundary bound; private final RangeTombstoneMarker[] markers; // For each iterator, what is the currently open marker deletion time (or null if there is no open marker on that iterator) http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/src/java/org/apache/cassandra/db/rows/RowAndDeletionMergeIterator.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/rows/RowAndDeletionMergeIterator.java b/src/java/org/apache/cassandra/db/rows/RowAndDeletionMergeIterator.java index 389fe45..5d7d8fe 100644 --- a/src/java/org/apache/cassandra/db/rows/RowAndDeletionMergeIterator.java +++ b/src/java/org/apache/cassandra/db/rows/RowAndDeletionMergeIterator.java @@ -153,12 +153,12 @@ public class RowAndDeletionMergeIterator extends AbstractUnfilteredRowIterator return range; } - private Slice.Bound openBound(RangeTombstone range) + private ClusteringBound openBound(RangeTombstone range) { return range.deletedSlice().open(isReverseOrder()); } - private Slice.Bound closeBound(RangeTombstone range) + private ClusteringBound closeBound(RangeTombstone range) { return range.deletedSlice().close(isReverseOrder()); } http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/src/java/org/apache/cassandra/db/rows/UnfilteredRowIteratorWithLowerBound.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/rows/UnfilteredRowIteratorWithLowerBound.java b/src/java/org/apache/cassandra/db/rows/UnfilteredRowIteratorWithLowerBound.java index 5c04966..fd74fc6 100644 --- a/src/java/org/apache/cassandra/db/rows/UnfilteredRowIteratorWithLowerBound.java +++ b/src/java/org/apache/cassandra/db/rows/UnfilteredRowIteratorWithLowerBound.java @@ -31,7 +31,7 @@ public class UnfilteredRowIteratorWithLowerBound extends LazilyInitializedUnfilt private final boolean isForThrift; private final int nowInSec; private final boolean applyThriftTransformation; - private RangeTombstone.Bound lowerBound; + private ClusteringBound lowerBound; private boolean firstItemRetrieved; public UnfilteredRowIteratorWithLowerBound(DecoratedKey partitionKey, @@ -61,12 +61,11 @@ public class UnfilteredRowIteratorWithLowerBound extends LazilyInitializedUnfilt // The partition index lower bound is more accurate than the sstable metadata lower bound but it is only // present if the iterator has already been initialized, which we only do when there are tombstones since in // this case we cannot use the sstable metadata clustering values - - RangeTombstone.Bound ret = getPartitionIndexLowerBound(); + ClusteringBound ret = getPartitionIndexLowerBound(); return ret != null ? makeBound(ret) : makeBound(getMetadataLowerBound()); } - private Unfiltered makeBound(RangeTombstone.Bound bound) + private Unfiltered makeBound(ClusteringBound bound) { if (bound == null) return null; @@ -158,7 +157,7 @@ public class UnfilteredRowIteratorWithLowerBound extends LazilyInitializedUnfilt /** * @return the lower bound stored on the index entry for this partition, if available. */ - private RangeTombstone.Bound getPartitionIndexLowerBound() + private ClusteringBound getPartitionIndexLowerBound() { // NOTE: CASSANDRA-11206 removed the lookup against the key-cache as the IndexInfo objects are no longer // in memory for not heap backed IndexInfo objects (so, these are on disk). @@ -182,7 +181,7 @@ public class UnfilteredRowIteratorWithLowerBound extends LazilyInitializedUnfilt lowerBoundPrefix.getRawValues().length, sstable.metadata.comparator.size(), sstable.getFilename()); - return RangeTombstone.Bound.inclusiveOpen(filter.isReversed(), lowerBoundPrefix.getRawValues()); + return ClusteringBound.inclusiveOpen(filter.isReversed(), lowerBoundPrefix.getRawValues()); } catch (IOException e) { @@ -204,7 +203,7 @@ public class UnfilteredRowIteratorWithLowerBound extends LazilyInitializedUnfilt * @return a global lower bound made from the clustering values stored in the sstable metadata, note that * this currently does not correctly compare tombstone bounds, especially ranges. */ - private RangeTombstone.Bound getMetadataLowerBound() + private ClusteringBound getMetadataLowerBound() { if (!canUseMetadataLowerBound()) return null; @@ -216,6 +215,6 @@ public class UnfilteredRowIteratorWithLowerBound extends LazilyInitializedUnfilt vals.size(), sstable.metadata.comparator.size(), sstable.getFilename()); - return RangeTombstone.Bound.inclusiveOpen(filter.isReversed(), vals.toArray(new ByteBuffer[vals.size()])); + return ClusteringBound.inclusiveOpen(filter.isReversed(), vals.toArray(new ByteBuffer[vals.size()])); } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/src/java/org/apache/cassandra/db/rows/UnfilteredSerializer.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/rows/UnfilteredSerializer.java b/src/java/org/apache/cassandra/db/rows/UnfilteredSerializer.java index 0fa0f3e..27b0df1 100644 --- a/src/java/org/apache/cassandra/db/rows/UnfilteredSerializer.java +++ b/src/java/org/apache/cassandra/db/rows/UnfilteredSerializer.java @@ -53,7 +53,7 @@ import org.apache.cassandra.io.util.DataOutputPlus; * is the vint encoded value of n, i.e. <celln>'s 1-based index, <celli> * are the <cell> for this complex column * <marker> is <bound><deletion> where <bound> is the marker bound as serialized - * by {@code Slice.Bound.serializer} and <deletion> is the marker deletion + * by {@code ClusteringBoundOrBoundary.serializer} and <deletion> is the marker deletion * time. * * <cell> A cell start with a 1 byte <flag>. The 2nd and third flag bits indicate if @@ -203,7 +203,7 @@ public class UnfilteredSerializer throws IOException { out.writeByte((byte)IS_MARKER); - RangeTombstone.Bound.serializer.serialize(marker.clustering(), out, version, header.clusteringTypes()); + ClusteringBoundOrBoundary.serializer.serialize(marker.clustering(), out, version, header.clusteringTypes()); if (header.isForSSTable()) { @@ -305,7 +305,7 @@ public class UnfilteredSerializer { assert !header.isForSSTable(); return 1 // flags - + RangeTombstone.Bound.serializer.serializedSize(marker.clustering(), version, header.clusteringTypes()) + + ClusteringBoundOrBoundary.serializer.serializedSize(marker.clustering(), version, header.clusteringTypes()) + serializedMarkerBodySize(marker, header, previousUnfilteredSize, version); } @@ -352,7 +352,7 @@ public class UnfilteredSerializer if (kind(flags) == Unfiltered.Kind.RANGE_TOMBSTONE_MARKER) { - RangeTombstone.Bound bound = RangeTombstone.Bound.serializer.deserialize(in, helper.version, header.clusteringTypes()); + ClusteringBoundOrBoundary bound = ClusteringBoundOrBoundary.serializer.deserialize(in, helper.version, header.clusteringTypes()); return deserializeMarkerBody(in, header, bound); } else @@ -374,7 +374,7 @@ public class UnfilteredSerializer return deserializeRowBody(in, header, helper, flags, extendedFlags, builder); } - public RangeTombstoneMarker deserializeMarkerBody(DataInputPlus in, SerializationHeader header, RangeTombstone.Bound bound) + public RangeTombstoneMarker deserializeMarkerBody(DataInputPlus in, SerializationHeader header, ClusteringBoundOrBoundary bound) throws IOException { if (header.isForSSTable()) @@ -384,9 +384,9 @@ public class UnfilteredSerializer } if (bound.isBoundary()) - return new RangeTombstoneBoundaryMarker(bound, header.readDeletionTime(in), header.readDeletionTime(in)); + return new RangeTombstoneBoundaryMarker((ClusteringBoundary) bound, header.readDeletionTime(in), header.readDeletionTime(in)); else - return new RangeTombstoneBoundMarker(bound, header.readDeletionTime(in)); + return new RangeTombstoneBoundMarker((ClusteringBound) bound, header.readDeletionTime(in)); } public Row deserializeRowBody(DataInputPlus in, http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/src/java/org/apache/cassandra/index/internal/CassandraIndexSearcher.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/index/internal/CassandraIndexSearcher.java b/src/java/org/apache/cassandra/index/internal/CassandraIndexSearcher.java index 1e28579..47d2016 100644 --- a/src/java/org/apache/cassandra/index/internal/CassandraIndexSearcher.java +++ b/src/java/org/apache/cassandra/index/internal/CassandraIndexSearcher.java @@ -112,8 +112,8 @@ public abstract class CassandraIndexSearcher implements Index.Searcher DecoratedKey startKey = (DecoratedKey) range.left; DecoratedKey endKey = (DecoratedKey) range.right; - Slice.Bound start = Slice.Bound.BOTTOM; - Slice.Bound end = Slice.Bound.TOP; + ClusteringBound start = ClusteringBound.BOTTOM; + ClusteringBound end = ClusteringBound.TOP; /* * For index queries over a range, we can't do a whole lot better than querying everything for the key range, though for @@ -146,15 +146,15 @@ public abstract class CassandraIndexSearcher implements Index.Searcher else { // otherwise, just start the index slice from the key we do have - slice = Slice.make(makeIndexBound(((DecoratedKey)range.left).getKey(), Slice.Bound.BOTTOM), - Slice.Bound.TOP); + slice = Slice.make(makeIndexBound(((DecoratedKey)range.left).getKey(), ClusteringBound.BOTTOM), + ClusteringBound.TOP); } } return new ClusteringIndexSliceFilter(Slices.with(index.getIndexComparator(), slice), false); } } - private Slice.Bound makeIndexBound(ByteBuffer rowKey, Slice.Bound bound) + private ClusteringBound makeIndexBound(ByteBuffer rowKey, ClusteringBound bound) { return index.buildIndexClusteringPrefix(rowKey, bound, null) .buildBound(bound.isStart(), bound.isInclusive()); http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/src/java/org/apache/cassandra/service/DataResolver.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/service/DataResolver.java b/src/java/org/apache/cassandra/service/DataResolver.java index 7fa6b72..bbc0379 100644 --- a/src/java/org/apache/cassandra/service/DataResolver.java +++ b/src/java/org/apache/cassandra/service/DataResolver.java @@ -167,7 +167,7 @@ public class DataResolver extends ResponseResolver private final Row.Builder[] currentRows = new Row.Builder[sources.length]; private final RowDiffListener diffListener; - private final Slice.Bound[] markerOpen = new Slice.Bound[sources.length]; + private final ClusteringBound[] markerOpen = new ClusteringBound[sources.length]; private final DeletionTime[] markerTime = new DeletionTime[sources.length]; public MergeListener(DecoratedKey partitionKey, PartitionColumns columns, boolean isReversed) @@ -268,8 +268,8 @@ public class DataResolver extends ResponseResolver // Note that boundaries are both close and open, so it's not one or the other if (merged.isClose(isReversed) && markerOpen[i] != null) { - Slice.Bound open = markerOpen[i]; - Slice.Bound close = merged.closeBound(isReversed); + ClusteringBound open = markerOpen[i]; + ClusteringBound close = merged.closeBound(isReversed); update(i).add(new RangeTombstone(Slice.make(isReversed ? close : open, isReversed ? open : close), markerTime[i])); } if (merged.isOpen(isReversed) && (marker == null || merged.openDeletionTime(isReversed).supersedes(marker.openDeletionTime(isReversed)))) http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/src/java/org/apache/cassandra/thrift/CassandraServer.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/thrift/CassandraServer.java b/src/java/org/apache/cassandra/thrift/CassandraServer.java index b958c67..357958c 100644 --- a/src/java/org/apache/cassandra/thrift/CassandraServer.java +++ b/src/java/org/apache/cassandra/thrift/CassandraServer.java @@ -1218,7 +1218,7 @@ public class CassandraServer implements Cassandra.Iface } } - private void addRange(CFMetaData cfm, LegacyLayout.LegacyDeletionInfo delInfo, Slice.Bound start, Slice.Bound end, long timestamp, int nowInSec) + private void addRange(CFMetaData cfm, LegacyLayout.LegacyDeletionInfo delInfo, ClusteringBound start, ClusteringBound end, long timestamp, int nowInSec) { delInfo.add(cfm, new RangeTombstone(Slice.make(start, end), new DeletionTime(timestamp, nowInSec))); } @@ -1233,7 +1233,7 @@ public class CassandraServer implements Cassandra.Iface try { if (del.super_column == null && cfm.isSuper()) - addRange(cfm, delInfo, Slice.Bound.inclusiveStartOf(c), Slice.Bound.inclusiveEndOf(c), del.timestamp, nowInSec); + addRange(cfm, delInfo, ClusteringBound.inclusiveStartOf(c), ClusteringBound.inclusiveEndOf(c), del.timestamp, nowInSec); else if (del.super_column != null) cells.add(toLegacyDeletion(cfm, del.super_column, c, del.timestamp, nowInSec)); else @@ -1267,7 +1267,7 @@ public class CassandraServer implements Cassandra.Iface else { if (del.super_column != null) - addRange(cfm, delInfo, Slice.Bound.inclusiveStartOf(del.super_column), Slice.Bound.inclusiveEndOf(del.super_column), del.timestamp, nowInSec); + addRange(cfm, delInfo, ClusteringBound.inclusiveStartOf(del.super_column), ClusteringBound.inclusiveEndOf(del.super_column), del.timestamp, nowInSec); else delInfo.add(new DeletionTime(del.timestamp, nowInSec)); } @@ -2437,8 +2437,8 @@ public class CassandraServer implements Cassandra.Iface for (int i = 0 ; i < request.getColumn_slices().size() ; i++) { fixOptionalSliceParameters(request.getColumn_slices().get(i)); - Slice.Bound start = LegacyLayout.decodeBound(metadata, request.getColumn_slices().get(i).start, true).bound; - Slice.Bound finish = LegacyLayout.decodeBound(metadata, request.getColumn_slices().get(i).finish, false).bound; + ClusteringBound start = LegacyLayout.decodeBound(metadata, request.getColumn_slices().get(i).start, true).bound; + ClusteringBound finish = LegacyLayout.decodeBound(metadata, request.getColumn_slices().get(i).finish, false).bound; int compare = metadata.comparator.compare(start, finish); if (!request.reversed && compare > 0) http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/src/java/org/apache/cassandra/tools/JsonTransformer.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/tools/JsonTransformer.java b/src/java/org/apache/cassandra/tools/JsonTransformer.java index 93bb686..5fc4fb9 100644 --- a/src/java/org/apache/cassandra/tools/JsonTransformer.java +++ b/src/java/org/apache/cassandra/tools/JsonTransformer.java @@ -9,11 +9,7 @@ import java.util.stream.Stream; import org.apache.cassandra.config.CFMetaData; import org.apache.cassandra.config.ColumnDefinition; -import org.apache.cassandra.db.ClusteringPrefix; -import org.apache.cassandra.db.DecoratedKey; -import org.apache.cassandra.db.DeletionTime; -import org.apache.cassandra.db.LivenessInfo; -import org.apache.cassandra.db.RangeTombstone; +import org.apache.cassandra.db.*; import org.apache.cassandra.db.marshal.AbstractType; import org.apache.cassandra.db.marshal.CollectionType; import org.apache.cassandra.db.marshal.CompositeType; @@ -305,7 +301,7 @@ public final class JsonTransformer } } - private void serializeBound(RangeTombstone.Bound bound, DeletionTime deletionTime) throws IOException + private void serializeBound(ClusteringBound bound, DeletionTime deletionTime) throws IOException { json.writeFieldName(bound.isStart() ? "start" : "end"); json.writeStartObject(); http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/test/unit/org/apache/cassandra/cql3/TombstonesWithIndexedSSTableTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/cql3/TombstonesWithIndexedSSTableTest.java b/test/unit/org/apache/cassandra/cql3/TombstonesWithIndexedSSTableTest.java index 41a7d91..787c309 100644 --- a/test/unit/org/apache/cassandra/cql3/TombstonesWithIndexedSSTableTest.java +++ b/test/unit/org/apache/cassandra/cql3/TombstonesWithIndexedSSTableTest.java @@ -108,7 +108,6 @@ public class TombstonesWithIndexedSSTableTest extends CQLTester assertRowCount(execute("SELECT DISTINCT s FROM %s WHERE k = ? ORDER BY t DESC", 0), 1); } - // Creates a random string public static String makeRandomString(int length) { Random random = new Random(); http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/test/unit/org/apache/cassandra/cql3/restrictions/ClusteringColumnRestrictionsTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/cql3/restrictions/ClusteringColumnRestrictionsTest.java b/test/unit/org/apache/cassandra/cql3/restrictions/ClusteringColumnRestrictionsTest.java index 5c816da..f78967d 100644 --- a/test/unit/org/apache/cassandra/cql3/restrictions/ClusteringColumnRestrictionsTest.java +++ b/test/unit/org/apache/cassandra/cql3/restrictions/ClusteringColumnRestrictionsTest.java @@ -48,7 +48,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(1, bounds.size()); assertEmptyStart(get(bounds, 0)); @@ -71,7 +71,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(eq); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(1, bounds.size()); assertStartBound(get(bounds, 0), true, clustering_0); @@ -94,7 +94,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(eq); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(1, bounds.size()); assertStartBound(get(bounds, 0), true, clustering_0); @@ -120,7 +120,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(in); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(3, bounds.size()); assertStartBound(get(bounds, 0), true, value1); assertStartBound(get(bounds, 1), true, value2); @@ -148,7 +148,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(slice); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(1, bounds.size()); assertStartBound(get(bounds, 0), false, value1); @@ -234,7 +234,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(slice); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(1, bounds.size()); assertEmptyStart(get(bounds, 0)); @@ -321,7 +321,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(eq).mergeWith(in); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(3, bounds.size()); assertStartBound(get(bounds, 0), true, value1, value1); assertStartBound(get(bounds, 1), true, value1, value2); @@ -352,7 +352,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(eq).mergeWith(slice); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(1, bounds.size()); assertStartBound(get(bounds, 0), false, value3, value1); @@ -437,7 +437,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(eq); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(1, bounds.size()); assertStartBound(get(bounds, 0), true, value1, value2); @@ -461,7 +461,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(in); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(2, bounds.size()); assertStartBound(get(bounds, 0), true, value1, value2); assertStartBound(get(bounds, 1), true, value2, value3); @@ -488,7 +488,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(slice); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(1, bounds.size()); assertStartBound(get(bounds, 0), false, value1); @@ -575,7 +575,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(slice); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(1, bounds.size()); assertEmptyStart(get(bounds, 0)); @@ -662,7 +662,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(slice); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(1, bounds.size()); assertStartBound(get(bounds, 0), false, value1, value2); @@ -754,7 +754,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(slice); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(1, bounds.size()); assertEmptyStart(get(bounds, 0)); @@ -848,7 +848,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(slice); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(2, bounds.size()); assertEmptyStart(get(bounds, 0)); assertStartBound(get(bounds, 1), false, value1, value2); @@ -971,7 +971,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(slice); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(2, bounds.size()); assertStartBound(get(bounds, 0), true, value1); assertStartBound(get(bounds, 1), false, value1); @@ -1080,7 +1080,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(slice); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(2, bounds.size()); assertStartBound(get(bounds, 0), true, value1, value2); assertStartBound(get(bounds, 1), false, value1, value2); @@ -1240,7 +1240,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(slice); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(4, bounds.size()); assertStartBound(get(bounds, 0), true, value1); assertStartBound(get(bounds, 1), true, value1, value2, value3); @@ -1414,7 +1414,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(singleEq).mergeWith(multiEq); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(1, bounds.size()); assertStartBound(get(bounds, 0), true, value1, value2, value3); @@ -1487,7 +1487,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(singleEq).mergeWith(multiIN); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(2, bounds.size()); assertStartBound(get(bounds, 0), true, value1, value2, value3); assertStartBound(get(bounds, 1), true, value1, value4, value5); @@ -1550,7 +1550,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(singleEq).mergeWith(multiSlice); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(1, bounds.size()); assertStartBound(get(bounds, 0), false, value1, value2, value3); @@ -1608,7 +1608,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(multiEq).mergeWith(singleSlice); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(1, bounds.size()); assertStartBound(get(bounds, 0), false, value1, value2, value3); @@ -1634,7 +1634,7 @@ public class ClusteringColumnRestrictionsTest ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData); restrictions = restrictions.mergeWith(multiEq).mergeWith(multiSlice); - SortedSet<Slice.Bound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); + SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT); assertEquals(1, bounds.size()); assertStartBound(get(bounds, 0), false, value1, value2, value3, value4); @@ -1678,9 +1678,9 @@ public class ClusteringColumnRestrictionsTest * * @param bound the bound to check */ - private static void assertEmptyStart(Slice.Bound bound) + private static void assertEmptyStart(ClusteringBound bound) { - assertEquals(Slice.Bound.BOTTOM, bound); + assertEquals(ClusteringBound.BOTTOM, bound); } /** @@ -1688,36 +1688,36 @@ public class ClusteringColumnRestrictionsTest * * @param bound the bound to check */ - private static void assertEmptyEnd(Slice.Bound bound) + private static void assertEmptyEnd(ClusteringBound bound) { - assertEquals(Slice.Bound.TOP, bound); + assertEquals(ClusteringBound.TOP, bound); } /** - * Asserts that the specified <code>Slice.Bound</code> is a start with the specified elements. + * Asserts that the specified <code>ClusteringBound</code> is a start with the specified elements. * * @param bound the bound to check * @param isInclusive if the bound is expected to be inclusive * @param elements the expected elements of the clustering */ - private static void assertStartBound(Slice.Bound bound, boolean isInclusive, ByteBuffer... elements) + private static void assertStartBound(ClusteringBound bound, boolean isInclusive, ByteBuffer... elements) { assertBound(bound, true, isInclusive, elements); } /** - * Asserts that the specified <code>Slice.Bound</code> is a end with the specified elements. + * Asserts that the specified <code>ClusteringBound</code> is a end with the specified elements. * * @param bound the bound to check * @param isInclusive if the bound is expected to be inclusive * @param elements the expected elements of the clustering */ - private static void assertEndBound(Slice.Bound bound, boolean isInclusive, ByteBuffer... elements) + private static void assertEndBound(ClusteringBound bound, boolean isInclusive, ByteBuffer... elements) { assertBound(bound, false, isInclusive, elements); } - private static void assertBound(Slice.Bound bound, boolean isStart, boolean isInclusive, ByteBuffer... elements) + private static void assertBound(ClusteringBound bound, boolean isStart, boolean isInclusive, ByteBuffer... elements) { assertEquals("the bound size is not the expected one:", elements.length, bound.size()); assertEquals("the bound should be a " + (isStart ? "start" : "end") + " but is a " + (bound.isStart() ? "start" : "end"), isStart, bound.isStart()); http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/test/unit/org/apache/cassandra/db/KeyspaceTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/KeyspaceTest.java b/test/unit/org/apache/cassandra/db/KeyspaceTest.java index b0820ec..5036749 100644 --- a/test/unit/org/apache/cassandra/db/KeyspaceTest.java +++ b/test/unit/org/apache/cassandra/db/KeyspaceTest.java @@ -251,12 +251,12 @@ public class KeyspaceTest extends CQLTester private static ClusteringIndexSliceFilter slices(ColumnFamilyStore cfs, Integer sliceStart, Integer sliceEnd, boolean reversed) { - Slice.Bound startBound = sliceStart == null - ? Slice.Bound.BOTTOM - : Slice.Bound.create(ClusteringPrefix.Kind.INCL_START_BOUND, new ByteBuffer[]{ByteBufferUtil.bytes(sliceStart)}); - Slice.Bound endBound = sliceEnd == null - ? Slice.Bound.TOP - : Slice.Bound.create(ClusteringPrefix.Kind.INCL_END_BOUND, new ByteBuffer[]{ByteBufferUtil.bytes(sliceEnd)}); + ClusteringBound startBound = sliceStart == null + ? ClusteringBound.BOTTOM + : ClusteringBound.create(ClusteringPrefix.Kind.INCL_START_BOUND, new ByteBuffer[]{ByteBufferUtil.bytes(sliceStart)}); + ClusteringBound endBound = sliceEnd == null + ? ClusteringBound.TOP + : ClusteringBound.create(ClusteringPrefix.Kind.INCL_END_BOUND, new ByteBuffer[]{ByteBufferUtil.bytes(sliceEnd)}); Slices slices = Slices.with(cfs.getComparator(), Slice.make(startBound, endBound)); return new ClusteringIndexSliceFilter(slices, reversed); } http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/test/unit/org/apache/cassandra/db/RangeTombstoneListTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/RangeTombstoneListTest.java b/test/unit/org/apache/cassandra/db/RangeTombstoneListTest.java index 1e637b3..d3dc835 100644 --- a/test/unit/org/apache/cassandra/db/RangeTombstoneListTest.java +++ b/test/unit/org/apache/cassandra/db/RangeTombstoneListTest.java @@ -620,12 +620,12 @@ public class RangeTombstoneListTest private static RangeTombstone rt(int start, boolean startInclusive, int end, boolean endInclusive, long tstamp) { - return new RangeTombstone(Slice.make(Slice.Bound.create(cmp, true, startInclusive, start), Slice.Bound.create(cmp, false, endInclusive, end)), new DeletionTime(tstamp, 0)); + return new RangeTombstone(Slice.make(ClusteringBound.create(cmp, true, startInclusive, start), ClusteringBound.create(cmp, false, endInclusive, end)), new DeletionTime(tstamp, 0)); } private static RangeTombstone rt(int start, int end, long tstamp, int delTime) { - return new RangeTombstone(Slice.make(Slice.Bound.inclusiveStartOf(bb(start)), Slice.Bound.inclusiveEndOf(bb(end))), new DeletionTime(tstamp, delTime)); + return new RangeTombstone(Slice.make(ClusteringBound.inclusiveStartOf(bb(start)), ClusteringBound.inclusiveEndOf(bb(end))), new DeletionTime(tstamp, delTime)); } private static RangeTombstone rtei(int start, int end, long tstamp) @@ -635,7 +635,7 @@ public class RangeTombstoneListTest private static RangeTombstone rtei(int start, int end, long tstamp, int delTime) { - return new RangeTombstone(Slice.make(Slice.Bound.exclusiveStartOf(bb(start)), Slice.Bound.inclusiveEndOf(bb(end))), new DeletionTime(tstamp, delTime)); + return new RangeTombstone(Slice.make(ClusteringBound.exclusiveStartOf(bb(start)), ClusteringBound.inclusiveEndOf(bb(end))), new DeletionTime(tstamp, delTime)); } private static RangeTombstone rtie(int start, int end, long tstamp) @@ -645,26 +645,26 @@ public class RangeTombstoneListTest private static RangeTombstone rtie(int start, int end, long tstamp, int delTime) { - return new RangeTombstone(Slice.make(Slice.Bound.inclusiveStartOf(bb(start)), Slice.Bound.exclusiveEndOf(bb(end))), new DeletionTime(tstamp, delTime)); + return new RangeTombstone(Slice.make(ClusteringBound.inclusiveStartOf(bb(start)), ClusteringBound.exclusiveEndOf(bb(end))), new DeletionTime(tstamp, delTime)); } private static RangeTombstone atLeast(int start, long tstamp, int delTime) { - return new RangeTombstone(Slice.make(Slice.Bound.inclusiveStartOf(bb(start)), Slice.Bound.TOP), new DeletionTime(tstamp, delTime)); + return new RangeTombstone(Slice.make(ClusteringBound.inclusiveStartOf(bb(start)), ClusteringBound.TOP), new DeletionTime(tstamp, delTime)); } private static RangeTombstone atMost(int end, long tstamp, int delTime) { - return new RangeTombstone(Slice.make(Slice.Bound.BOTTOM, Slice.Bound.inclusiveEndOf(bb(end))), new DeletionTime(tstamp, delTime)); + return new RangeTombstone(Slice.make(ClusteringBound.BOTTOM, ClusteringBound.inclusiveEndOf(bb(end))), new DeletionTime(tstamp, delTime)); } private static RangeTombstone lessThan(int end, long tstamp, int delTime) { - return new RangeTombstone(Slice.make(Slice.Bound.BOTTOM, Slice.Bound.exclusiveEndOf(bb(end))), new DeletionTime(tstamp, delTime)); + return new RangeTombstone(Slice.make(ClusteringBound.BOTTOM, ClusteringBound.exclusiveEndOf(bb(end))), new DeletionTime(tstamp, delTime)); } private static RangeTombstone greaterThan(int start, long tstamp, int delTime) { - return new RangeTombstone(Slice.make(Slice.Bound.exclusiveStartOf(bb(start)), Slice.Bound.TOP), new DeletionTime(tstamp, delTime)); + return new RangeTombstone(Slice.make(ClusteringBound.exclusiveStartOf(bb(start)), ClusteringBound.TOP), new DeletionTime(tstamp, delTime)); } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java b/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java index 4be46ff..9120546 100644 --- a/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java +++ b/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java @@ -207,8 +207,8 @@ public class RangeTombstoneTest assertEquals(1, rt.size()); Slices.Builder sb = new Slices.Builder(cfs.getComparator()); - sb.add(Slice.Bound.create(cfs.getComparator(), true, true, 1), Slice.Bound.create(cfs.getComparator(), false, true, 10)); - sb.add(Slice.Bound.create(cfs.getComparator(), true, true, 16), Slice.Bound.create(cfs.getComparator(), false, true, 20)); + sb.add(ClusteringBound.create(cfs.getComparator(), true, true, 1), ClusteringBound.create(cfs.getComparator(), false, true, 10)); + sb.add(ClusteringBound.create(cfs.getComparator(), true, true, 16), ClusteringBound.create(cfs.getComparator(), false, true, 20)); partition = Util.getOnlyPartitionUnfiltered(SinglePartitionReadCommand.create(cfs.metadata, FBUtilities.nowInSeconds(), Util.dk(key), sb.build())); rt = rangeTombstones(partition); http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/test/unit/org/apache/cassandra/db/RowTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/RowTest.java b/test/unit/org/apache/cassandra/db/RowTest.java index 30a4f98..7294b3a 100644 --- a/test/unit/org/apache/cassandra/db/RowTest.java +++ b/test/unit/org/apache/cassandra/db/RowTest.java @@ -108,12 +108,12 @@ public class RowTest while (merged.hasNext()) { RangeTombstoneBoundMarker openMarker = (RangeTombstoneBoundMarker)merged.next(); - Slice.Bound openBound = openMarker.clustering(); + ClusteringBound openBound = openMarker.clustering(); DeletionTime openDeletion = new DeletionTime(openMarker.deletionTime().markedForDeleteAt(), openMarker.deletionTime().localDeletionTime()); RangeTombstoneBoundMarker closeMarker = (RangeTombstoneBoundMarker)merged.next(); - Slice.Bound closeBound = closeMarker.clustering(); + ClusteringBound closeBound = closeMarker.clustering(); DeletionTime closeDeletion = new DeletionTime(closeMarker.deletionTime().markedForDeleteAt(), closeMarker.deletionTime().localDeletionTime()); @@ -185,16 +185,16 @@ public class RowTest assertEquals(Integer.valueOf(1), map.get(row)); } - private void assertRangeTombstoneMarkers(Slice.Bound start, Slice.Bound end, DeletionTime deletionTime, Object[] expected) + private void assertRangeTombstoneMarkers(ClusteringBound start, ClusteringBound end, DeletionTime deletionTime, Object[] expected) { AbstractType clusteringType = (AbstractType)cfm.comparator.subtype(0); assertEquals(1, start.size()); - assertEquals(start.kind(), Slice.Bound.Kind.INCL_START_BOUND); + assertEquals(start.kind(), ClusteringPrefix.Kind.INCL_START_BOUND); assertEquals(expected[0], clusteringType.getString(start.get(0))); assertEquals(1, end.size()); - assertEquals(end.kind(), Slice.Bound.Kind.INCL_END_BOUND); + assertEquals(end.kind(), ClusteringPrefix.Kind.INCL_END_BOUND); assertEquals(expected[1], clusteringType.getString(end.get(0))); assertEquals(expected[2], deletionTime.markedForDeleteAt()); http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/test/unit/org/apache/cassandra/db/SinglePartitionSliceCommandTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/SinglePartitionSliceCommandTest.java b/test/unit/org/apache/cassandra/db/SinglePartitionSliceCommandTest.java index 1e4f696..8de0c75 100644 --- a/test/unit/org/apache/cassandra/db/SinglePartitionSliceCommandTest.java +++ b/test/unit/org/apache/cassandra/db/SinglePartitionSliceCommandTest.java @@ -94,7 +94,7 @@ public class SinglePartitionSliceCommandTest ColumnFilter columnFilter = ColumnFilter.selection(PartitionColumns.of(v)); ByteBuffer zero = ByteBufferUtil.bytes(0); - Slices slices = Slices.with(cfm.comparator, Slice.make(Slice.Bound.inclusiveStartOf(zero), Slice.Bound.inclusiveEndOf(zero))); + Slices slices = Slices.with(cfm.comparator, Slice.make(ClusteringBound.inclusiveStartOf(zero), ClusteringBound.inclusiveEndOf(zero))); ClusteringIndexSliceFilter sliceFilter = new ClusteringIndexSliceFilter(slices, false); ReadCommand cmd = new SinglePartitionReadCommand(false, MessagingService.VERSION_30, true, cfm, FBUtilities.nowInSeconds(), http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/test/unit/org/apache/cassandra/db/filter/SliceTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/filter/SliceTest.java b/test/unit/org/apache/cassandra/db/filter/SliceTest.java index 2f07a24..b0705ce 100644 --- a/test/unit/org/apache/cassandra/db/filter/SliceTest.java +++ b/test/unit/org/apache/cassandra/db/filter/SliceTest.java @@ -367,14 +367,14 @@ public class SliceTest assertSlicesNormalization(cc, slices(s(-1, 2), s(-1, 3), s(5, 9)), slices(s(-1, 3), s(5, 9))); } - private static Slice.Bound makeBound(ClusteringPrefix.Kind kind, Integer... components) + private static ClusteringBound makeBound(ClusteringPrefix.Kind kind, Integer... components) { ByteBuffer[] values = new ByteBuffer[components.length]; for (int i = 0; i < components.length; i++) { values[i] = ByteBufferUtil.bytes(components[i]); } - return Slice.Bound.create(kind, values); + return ClusteringBound.create(kind, values); } private static List<ByteBuffer> columnNames(Integer ... components) http://git-wip-us.apache.org/repos/asf/cassandra/blob/2cc26eba/test/unit/org/apache/cassandra/db/partition/PartitionImplementationTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/partition/PartitionImplementationTest.java b/test/unit/org/apache/cassandra/db/partition/PartitionImplementationTest.java index 6cbab7a..90d6310 100644 --- a/test/unit/org/apache/cassandra/db/partition/PartitionImplementationTest.java +++ b/test/unit/org/apache/cassandra/db/partition/PartitionImplementationTest.java @@ -39,7 +39,6 @@ import org.apache.cassandra.config.CFMetaData; import org.apache.cassandra.config.ColumnDefinition; import org.apache.cassandra.cql3.ColumnIdentifier; import org.apache.cassandra.db.*; -import org.apache.cassandra.db.Slice.Bound; import org.apache.cassandra.db.filter.ColumnFilter; import org.apache.cassandra.db.marshal.AsciiType; import org.apache.cassandra.db.partitions.AbstractBTreePartition; @@ -355,7 +354,7 @@ public class PartitionImplementationTest Clustering start = clustering(pos); pos += sz; Clustering end = clustering(pos); - Slice slice = Slice.make(skip == 0 ? Bound.exclusiveStartOf(start) : Bound.inclusiveStartOf(start), Bound.inclusiveEndOf(end)); + Slice slice = Slice.make(skip == 0 ? ClusteringBound.exclusiveStartOf(start) : ClusteringBound.inclusiveStartOf(start), ClusteringBound.inclusiveEndOf(end)); builder.add(slice); } return builder.build();
