use of org.apache.cassandra.db.filter.AbstractClusteringIndexFilter in project cassandra by apache.
the class SinglePartitionSliceCommandTest method testMultiNamesOrSlicesCommand.
private void testMultiNamesOrSlicesCommand(boolean flush, boolean isSlice) {
int deletionTime = 5;
int ck1 = 1;
int uniqueCk1 = 2;
int uniqueCk2 = 3;
DecoratedKey key = Util.dk(ByteBufferUtil.bytes("k"));
QueryProcessor.executeInternal(String.format("DELETE FROM ks.tbl_slices USING TIMESTAMP %d WHERE k='k' AND c1=%d", deletionTime, ck1));
if (flush)
Keyspace.open(KEYSPACE).getColumnFamilyStore(TABLE_SCLICES).forceBlockingFlush();
AbstractClusteringIndexFilter clusteringFilter = createClusteringFilter(uniqueCk1, uniqueCk2, isSlice);
ReadCommand cmd = SinglePartitionReadCommand.create(CFM_SLICES, FBUtilities.nowInSeconds(), ColumnFilter.all(CFM_SLICES), RowFilter.NONE, DataLimits.NONE, key, clusteringFilter);
UnfilteredPartitionIterator partitionIterator = cmd.executeLocally(cmd.executionController());
assert partitionIterator.hasNext();
UnfilteredRowIterator partition = partitionIterator.next();
int count = 0;
boolean open = true;
while (partition.hasNext()) {
Unfiltered unfiltered = partition.next();
assertTrue(unfiltered.isRangeTombstoneMarker());
RangeTombstoneMarker marker = (RangeTombstoneMarker) unfiltered;
// check if it's open-close pair
assertEquals(open, marker.isOpen(false));
// check deletion time same as Range Deletion
DeletionTime delete = (open ? marker.openDeletionTime(false) : marker.closeDeletionTime(false));
;
assertEquals(deletionTime, delete.markedForDeleteAt());
// check clustering values
Clustering<?> clustering = Util.clustering(CFM_SLICES.comparator, ck1, count / 2);
assertArrayEquals(clustering.getRawValues(), marker.clustering().getBufferArray());
open = !open;
count++;
}
// open and close range tombstones
assertEquals(uniqueCk2 * 2, count);
}
Aggregations