本文整理汇总了Java中org.apache.cassandra.Util.namesQueryFilter方法的典型用法代码示例。如果您正苦于以下问题:Java Util.namesQueryFilter方法的具体用法?Java Util.namesQueryFilter怎么用?Java Util.namesQueryFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.Util
的用法示例。
在下文中一共展示了Util.namesQueryFilter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEmptyRow
import org.apache.cassandra.Util; //导入方法依赖的package包/类
@Test
public void testEmptyRow() throws Exception
{
Keyspace keyspace = Keyspace.open("Keyspace1");
final ColumnFamilyStore store = keyspace.getColumnFamilyStore("Standard2");
Mutation rm;
rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("key1"));
rm.delete("Standard2", System.currentTimeMillis());
rm.apply();
Runnable r = new WrappedRunnable()
{
public void runMayThrow() throws IOException
{
QueryFilter sliceFilter = QueryFilter.getSliceFilter(Util.dk("key1"), "Standard2", Composites.EMPTY, Composites.EMPTY, false, 1, System.currentTimeMillis());
ColumnFamily cf = store.getColumnFamily(sliceFilter);
assertTrue(cf.isMarkedForDelete());
assertFalse(cf.hasColumns());
QueryFilter namesFilter = Util.namesQueryFilter(store, Util.dk("key1"), "a");
cf = store.getColumnFamily(namesFilter);
assertTrue(cf.isMarkedForDelete());
assertFalse(cf.hasColumns());
}
};
KeyspaceTest.reTest(store, r);
}
示例2: getTopLevelColumnsSkipsSSTablesModifiedBeforeRowDelete
import org.apache.cassandra.Util; //导入方法依赖的package包/类
@Test
public void getTopLevelColumnsSkipsSSTablesModifiedBeforeRowDelete()
{
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore("Standard1");
Mutation rm;
DecoratedKey dk = Util.dk("key1");
// add data
rm = new Mutation(keyspace.getName(), dk.getKey());
rm.add(cfs.name, Util.cellname("Column1"), ByteBufferUtil.bytes("asdf"), 0);
rm.apply();
cfs.forceBlockingFlush();
// remove
rm = new Mutation(keyspace.getName(), dk.getKey());
rm.delete(cfs.name, 10);
rm.apply();
// add another mutation because sstable maxtimestamp isn't set
// correctly during flush if the most recent mutation is a row delete
rm = new Mutation(keyspace.getName(), Util.dk("key2").getKey());
rm.add(cfs.name, Util.cellname("Column1"), ByteBufferUtil.bytes("zxcv"), 20);
rm.apply();
cfs.forceBlockingFlush();
// add yet one more mutation
rm = new Mutation(keyspace.getName(), dk.getKey());
rm.add(cfs.name, Util.cellname("Column1"), ByteBufferUtil.bytes("foobar"), 30);
rm.apply();
cfs.forceBlockingFlush();
// A NamesQueryFilter goes down one code path (through collectTimeOrderedData())
// It should only iterate the last flushed sstable, since it probably contains the most recent value for Column1
QueryFilter filter = Util.namesQueryFilter(cfs, dk, "Column1");
CollationController controller = new CollationController(cfs, filter, Integer.MIN_VALUE);
controller.getTopLevelColumns(true);
assertEquals(1, controller.getSstablesIterated());
// SliceQueryFilter goes down another path (through collectAllData())
// We will read "only" the last sstable in that case, but because the 2nd sstable has a tombstone that is more
// recent than the maxTimestamp of the very first sstable we flushed, we should only read the 2 first sstables.
filter = QueryFilter.getIdentityFilter(dk, cfs.name, System.currentTimeMillis());
controller = new CollationController(cfs, filter, Integer.MIN_VALUE);
controller.getTopLevelColumns(true);
assertEquals(2, controller.getSstablesIterated());
}