use of org.apache.cassandra.db.filter.QueryPath in project eiger by wlloyd.
the class RemoveSuperColumnTest method testRemoveSuperColumnWithNewData.
@Test
public void testRemoveSuperColumnWithNewData() throws IOException, ExecutionException, InterruptedException {
ColumnFamilyStore store = Table.open("Keyspace1").getColumnFamilyStore("Super2");
RowMutation rm;
DecoratedKey dk = Util.dk("key1");
// add data
rm = new RowMutation("Keyspace1", dk.key);
addMutation(rm, "Super2", "SC1", 1, "val1", 0);
rm.apply();
store.forceBlockingFlush();
// remove
rm = new RowMutation("Keyspace1", dk.key);
rm.delete(new QueryPath("Super2", ByteBufferUtil.bytes("SC1")), 1);
rm.apply();
// new data
rm = new RowMutation("Keyspace1", dk.key);
addMutation(rm, "Super2", "SC1", 2, "val2", 2);
rm.apply();
validateRemoveWithNewData(dk);
store.forceBlockingFlush();
validateRemoveWithNewData(dk);
CompactionManager.instance.performMaximal(store);
assertEquals(1, store.getSSTables().size());
validateRemoveWithNewData(dk);
}
use of org.apache.cassandra.db.filter.QueryPath in project eiger by wlloyd.
the class RemoveSuperColumnTest method testRemoveSuperColumnResurrection.
@Test
public void testRemoveSuperColumnResurrection() throws IOException, ExecutionException, InterruptedException {
ColumnFamilyStore store = Table.open("Keyspace1").getColumnFamilyStore("Super2");
RowMutation rm;
DecoratedKey key = Util.dk("keyC");
// add data
rm = new RowMutation("Keyspace1", key.key);
addMutation(rm, "Super2", "SC1", 1, "val1", 0);
rm.apply();
// remove
rm = new RowMutation("Keyspace1", key.key);
rm.delete(new QueryPath("Super2", ByteBufferUtil.bytes("SC1")), 1);
rm.apply();
assertNull(Util.cloneAndRemoveDeleted(store.getColumnFamily(QueryFilter.getNamesFilter(key, new QueryPath("Super2"), ByteBufferUtil.bytes("SC1"))), Integer.MAX_VALUE));
// resurrect
rm = new RowMutation("Keyspace1", key.key);
addMutation(rm, "Super2", "SC1", 1, "val2", 2);
rm.apply();
// validate
ColumnFamily cf = store.getColumnFamily(QueryFilter.getNamesFilter(key, new QueryPath("Super2"), ByteBufferUtil.bytes("SC1")));
cf = Util.cloneAndRemoveDeleted(cf, Integer.MAX_VALUE);
Collection<IColumn> subColumns = cf.getSortedColumns().iterator().next().getSubColumns();
assert subColumns.size() == 1;
assert subColumns.iterator().next().timestamp() == 2;
}
use of org.apache.cassandra.db.filter.QueryPath in project eiger by wlloyd.
the class RemoveSuperColumnTest method testRemoveDeletedSubColumn.
@Test
public void testRemoveDeletedSubColumn() throws IOException, ExecutionException, InterruptedException {
ColumnFamilyStore store = Table.open("Keyspace1").getColumnFamilyStore("Super3");
RowMutation rm;
DecoratedKey dk = Util.dk("key1");
// add data
rm = new RowMutation("Keyspace1", dk.key);
addMutation(rm, "Super3", "SC1", 1, "val1", 0);
addMutation(rm, "Super3", "SC1", 2, "val1", 0);
rm.apply();
store.forceBlockingFlush();
// remove
rm = new RowMutation("Keyspace1", dk.key);
rm.delete(new QueryPath("Super3", ByteBufferUtil.bytes("SC1"), Util.getBytes(1L)), 1);
rm.apply();
validateRemoveSubColumn(dk);
store.forceBlockingFlush();
validateRemoveSubColumn(dk);
}
use of org.apache.cassandra.db.filter.QueryPath in project eiger by wlloyd.
the class RemoveSuperColumnTest method testRemoveSuperColumn.
@Test
public void testRemoveSuperColumn() throws IOException, ExecutionException, InterruptedException {
ColumnFamilyStore store = Table.open("Keyspace1").getColumnFamilyStore("Super1");
RowMutation rm;
DecoratedKey dk = Util.dk("key1");
// add data
rm = new RowMutation("Keyspace1", dk.key);
addMutation(rm, "Super1", "SC1", 1, "val1", 0);
rm.apply();
store.forceBlockingFlush();
// remove
rm = new RowMutation("Keyspace1", dk.key);
rm.delete(new QueryPath("Super1", ByteBufferUtil.bytes("SC1")), 1);
rm.apply();
validateRemoveTwoSources(dk);
store.forceBlockingFlush();
validateRemoveTwoSources(dk);
CompactionManager.instance.performMaximal(store);
assertEquals(1, store.getSSTables().size());
validateRemoveCompacted(dk);
}
use of org.apache.cassandra.db.filter.QueryPath in project eiger by wlloyd.
the class RowIterationTest method testRowIterationDeletion.
@Test
public void testRowIterationDeletion() throws IOException, ExecutionException, InterruptedException {
Table table = Table.open(TABLE1);
String CF_NAME = "Standard3";
ColumnFamilyStore store = table.getColumnFamilyStore(CF_NAME);
DecoratedKey key = Util.dk("key");
// Delete a row in first sstable
RowMutation rm = new RowMutation(TABLE1, key.key);
rm.delete(new QueryPath(CF_NAME, null, null), 0);
rm.apply();
store.forceBlockingFlush();
ColumnFamily cf = Util.getRangeSlice(store).iterator().next().cf;
assert cf != null;
}
Aggregations