本文整理汇总了Java中org.apache.cassandra.db.columniterator.OnDiskAtomIterator.next方法的典型用法代码示例。如果您正苦于以下问题:Java OnDiskAtomIterator.next方法的具体用法?Java OnDiskAtomIterator.next怎么用?Java OnDiskAtomIterator.next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.db.columniterator.OnDiskAtomIterator
的用法示例。
在下文中一共展示了OnDiskAtomIterator.next方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testRangeTombstoneCompaction
import org.apache.cassandra.db.columniterator.OnDiskAtomIterator; //导入方法依赖的package包/类
@Test
public void testRangeTombstoneCompaction() throws Exception
{
Keyspace table = Keyspace.open(KSNAME);
ColumnFamilyStore cfs = table.getColumnFamilyStore(CFNAME);
ByteBuffer key = ByteBufferUtil.bytes("k4");
// remove any existing sstables before starting
cfs.truncateBlocking();
cfs.disableAutoCompaction();
cfs.setCompactionStrategyClass(SizeTieredCompactionStrategy.class.getCanonicalName());
Mutation rm = new Mutation(KSNAME, key);
for (int i = 0; i < 10; i += 2)
add(rm, i, 0);
rm.apply();
cfs.forceBlockingFlush();
rm = new Mutation(KSNAME, key);
ColumnFamily cf = rm.addOrGet(CFNAME);
for (int i = 0; i < 10; i += 2)
delete(cf, 0, 7, 0);
rm.apply();
cfs.forceBlockingFlush();
// there should be 2 sstables
assertEquals(2, cfs.getSSTables().size());
// compact down to single sstable
CompactionManager.instance.performMaximal(cfs);
assertEquals(1, cfs.getSSTables().size());
// test the physical structure of the sstable i.e. rt & columns on disk
SSTableReader sstable = cfs.getSSTables().iterator().next();
OnDiskAtomIterator iter = sstable.getScanner().next();
int cnt = 0;
// after compaction, the first element should be an RT followed by the remaining non-deleted columns
while(iter.hasNext())
{
OnDiskAtom atom = iter.next();
if (cnt == 0)
assertTrue(atom instanceof RangeTombstone);
if (cnt > 0)
assertTrue(atom instanceof Cell);
cnt++;
}
assertEquals(2, cnt);
}
示例2: testLazilyCompactedRowGeneratesSameSSTablesAsPreCompactedRow
import org.apache.cassandra.db.columniterator.OnDiskAtomIterator; //导入方法依赖的package包/类
@Test
public void testLazilyCompactedRowGeneratesSameSSTablesAsPreCompactedRow() throws Exception
{
Keyspace table = Keyspace.open(KSNAME);
ColumnFamilyStore cfs = table.getColumnFamilyStore(CFNAME);
ByteBuffer key = ByteBufferUtil.bytes("k4");
// remove any existing sstables before starting
cfs.truncateBlocking();
cfs.disableAutoCompaction();
cfs.setCompactionStrategyClass(SizeTieredCompactionStrategy.class.getCanonicalName());
RowMutation rm = new RowMutation(KSNAME, key);
for (int i = 0; i < 10; i += 2)
add(rm, i, 0);
rm.apply();
cfs.forceBlockingFlush();
rm = new RowMutation(KSNAME, key);
ColumnFamily cf = rm.addOrGet(CFNAME);
for (int i = 0; i < 10; i += 2)
delete(cf, 0, 7, 0);
rm.apply();
cfs.forceBlockingFlush();
// there should be 2 sstables
assertEquals(2, cfs.getSSTables().size());
// compact down to single sstable
CompactionManager.instance.performMaximal(cfs);
assertEquals(1, cfs.getSSTables().size());
// test the physical structure of the sstable i.e. rt & columns on disk
SSTableReader sstable = cfs.getSSTables().iterator().next();
OnDiskAtomIterator iter = sstable.getScanner().next();
int cnt = 0;
// after compaction, the first element should be an RT followed by the remaining non-deleted columns
while(iter.hasNext())
{
OnDiskAtom atom = iter.next();
if (cnt == 0)
assertTrue(atom instanceof RangeTombstone);
if (cnt > 0)
assertTrue(atom instanceof Column);
cnt++;
}
assertEquals(2, cnt);
}
示例3: testRangeTombstoneCompaction
import org.apache.cassandra.db.columniterator.OnDiskAtomIterator; //导入方法依赖的package包/类
@Test
public void testRangeTombstoneCompaction() throws Exception
{
Keyspace table = Keyspace.open(KSNAME);
ColumnFamilyStore cfs = table.getColumnFamilyStore(CFNAME);
ByteBuffer key = ByteBufferUtil.bytes("k4");
// remove any existing sstables before starting
cfs.truncateBlocking();
cfs.disableAutoCompaction();
cfs.setCompactionStrategyClass(SizeTieredCompactionStrategy.class.getCanonicalName());
Mutation rm = new Mutation(KSNAME, key);
for (int i = 0; i < 10; i += 2)
add(rm, i, 0);
rm.applyUnsafe();
cfs.forceBlockingFlush();
rm = new Mutation(KSNAME, key);
ColumnFamily cf = rm.addOrGet(CFNAME);
for (int i = 0; i < 10; i += 2)
delete(cf, 0, 7, 0);
rm.applyUnsafe();
cfs.forceBlockingFlush();
// there should be 2 sstables
assertEquals(2, cfs.getSSTables().size());
// compact down to single sstable
CompactionManager.instance.performMaximal(cfs);
assertEquals(1, cfs.getSSTables().size());
// test the physical structure of the sstable i.e. rt & columns on disk
SSTableReader sstable = cfs.getSSTables().iterator().next();
OnDiskAtomIterator iter = sstable.getScanner().next();
int cnt = 0;
// after compaction, the first element should be an RT followed by the remaining non-deleted columns
while(iter.hasNext())
{
OnDiskAtom atom = iter.next();
if (cnt == 0)
assertTrue(atom instanceof RangeTombstone);
if (cnt > 0)
assertTrue(atom instanceof Cell);
cnt++;
}
assertEquals(2, cnt);
}
示例4: testLazilyCompactedRowGeneratesSameSSTablesAsPreCompactedRow
import org.apache.cassandra.db.columniterator.OnDiskAtomIterator; //导入方法依赖的package包/类
@Test
public void testLazilyCompactedRowGeneratesSameSSTablesAsPreCompactedRow() throws Exception
{
Keyspace table = Keyspace.open(KSNAME);
ColumnFamilyStore cfs = table.getColumnFamilyStore(CFNAME);
ByteBuffer key = ByteBufferUtil.bytes("k4");
// remove any existing sstables before starting
cfs.truncateBlocking();
cfs.disableAutoCompaction();
cfs.setCompactionStrategyClass(SizeTieredCompactionStrategy.class.getCanonicalName());
Mutation rm = new Mutation(KSNAME, key);
for (int i = 0; i < 10; i += 2)
add(rm, i, 0);
rm.apply();
cfs.forceBlockingFlush();
rm = new Mutation(KSNAME, key);
ColumnFamily cf = rm.addOrGet(CFNAME);
for (int i = 0; i < 10; i += 2)
delete(cf, 0, 7, 0);
rm.apply();
cfs.forceBlockingFlush();
// there should be 2 sstables
assertEquals(2, cfs.getSSTables().size());
// compact down to single sstable
CompactionManager.instance.performMaximal(cfs);
assertEquals(1, cfs.getSSTables().size());
// test the physical structure of the sstable i.e. rt & columns on disk
SSTableReader sstable = cfs.getSSTables().iterator().next();
OnDiskAtomIterator iter = sstable.getScanner().next();
int cnt = 0;
// after compaction, the first element should be an RT followed by the remaining non-deleted columns
while(iter.hasNext())
{
OnDiskAtom atom = iter.next();
if (cnt == 0)
assertTrue(atom instanceof RangeTombstone);
if (cnt > 0)
assertTrue(atom instanceof Cell);
cnt++;
}
assertEquals(2, cnt);
}