当前位置: 首页>>代码示例>>Java>>正文


Java OnDiskAtomIterator.next方法代码示例

本文整理汇总了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);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:49,代码来源:RangeTombstoneTest.java

示例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);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:49,代码来源:RangeTombstoneTest.java

示例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);
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:49,代码来源:RangeTombstoneTest.java

示例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);
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:49,代码来源:RangeTombstoneTest.java


注:本文中的org.apache.cassandra.db.columniterator.OnDiskAtomIterator.next方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。