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


Java CompactionInterruptedException类代码示例

本文整理汇总了Java中org.apache.cassandra.db.compaction.CompactionInterruptedException的典型用法代码示例。如果您正苦于以下问题:Java CompactionInterruptedException类的具体用法?Java CompactionInterruptedException怎么用?Java CompactionInterruptedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CompactionInterruptedException类属于org.apache.cassandra.db.compaction包,在下文中一共展示了CompactionInterruptedException类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: build

import org.apache.cassandra.db.compaction.CompactionInterruptedException; //导入依赖的package包/类
public void build()
{
    while (iter.hasNext())
    {
        if (isStopRequested())
            throw new CompactionInterruptedException(getCompactionInfo());
        DecoratedKey key = iter.next();
        Keyspace.indexRow(key, cfs, idxNames);
    }

    try
    {
        iter.close();
    }
    catch (IOException e)
    {
        throw new RuntimeException(e);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:20,代码来源:SecondaryIndexBuilder.java

示例2: build

import org.apache.cassandra.db.compaction.CompactionInterruptedException; //导入依赖的package包/类
public void build()
{
    try
    {
        while (iter.hasNext())
        {
            if (isStopRequested())
                throw new CompactionInterruptedException(getCompactionInfo());
            DecoratedKey key = iter.next();
            Keyspace.indexPartition(key, cfs, indexers);
        }
    }
    finally
    {
        iter.close();
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:18,代码来源:SecondaryIndexBuilder.java

示例3: build

import org.apache.cassandra.db.compaction.CompactionInterruptedException; //导入依赖的package包/类
public void build()
{
    while (iter.hasNext())
    {
        if (isStopRequested())
            throw new CompactionInterruptedException(getCompactionInfo());
        DecoratedKey key = iter.next();
        Table.indexRow(key, cfs, idxNames);
    }

    try
    {
        iter.close();
    }
    catch (IOException e)
    {
        throw new RuntimeException(e);
    }
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:20,代码来源:SecondaryIndexBuilder.java

示例4: testDropDuringCompaction

import org.apache.cassandra.db.compaction.CompactionInterruptedException; //导入依赖的package包/类
@Test
public void testDropDuringCompaction() throws Throwable
{
    CompactionManager.instance.disableAutoCompaction();

    //Start with crc_check_chance of 99%
    createTable("CREATE TABLE %s (p text, c text, v text, s text static, PRIMARY KEY (p, c)) WITH compression = {'sstable_compression': 'LZ4Compressor', 'crc_check_chance' : 0.99}");

    ColumnFamilyStore cfs = Keyspace.open(CQLTester.KEYSPACE).getColumnFamilyStore(currentTable());

    //Write a few SSTables then Compact, and drop
    for (int i = 0; i < 100; i++)
    {
        execute("INSERT INTO %s(p, c, v, s) values (?, ?, ?, ?)", "p1", "k1", "v1", "sv1");
        execute("INSERT INTO %s(p, c, v) values (?, ?, ?)", "p1", "k2", "v2");
        execute("INSERT INTO %s(p, s) values (?, ?)", "p2", "sv2");

        cfs.forceBlockingFlush();
    }

    DatabaseDescriptor.setCompactionThroughputMbPerSec(1);
    List<Future<?>> futures = CompactionManager.instance.submitMaximal(cfs, CompactionManager.getDefaultGcBefore(cfs, FBUtilities.nowInSeconds()), false); 
    execute("DROP TABLE %s");

    try
    {
        FBUtilities.waitOnFutures(futures);
    }
    catch (Throwable t)
    {
        if (!(t.getCause() instanceof ExecutionException) || !(t.getCause().getCause() instanceof CompactionInterruptedException))
            throw t;
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:35,代码来源:CrcCheckChanceTest.java

示例5: build

import org.apache.cassandra.db.compaction.CompactionInterruptedException; //导入依赖的package包/类
@Override
public void build()
{
    for (Map.Entry<SSTableReader, Map<ByteBuffer, ColumnIndex>> e : sstables.entrySet())
    {
        SSTableReader sstable = e.getKey();
        Map<ByteBuffer, ColumnIndex> indexes = e.getValue();

        if (!sstable.acquireReference())
        {
            bytesProcessed += getPrimaryIndexLength(sstable);
            continue;
        }

        try
        {
            PerSSTableIndexWriter indexWriter = newWriter(sstable.descriptor.asTemporary(true), indexes, Source.COMPACTION);

            long previousKeyPosition = 0;
            try (KeyIterator keys = new KeyIterator(sstable.descriptor))
            {
                while (keys.hasNext())
                {
                    if (isStopRequested())
                        throw new CompactionInterruptedException(getCompactionInfo());

                    final DecoratedKey key = keys.next();
                    final long keyPosition = keys.getKeyPosition();

                    indexWriter.startRow(key, keyPosition);
                    try (SSTableSliceIterator row = new SSTableSliceIterator(sstable, key, ColumnSlice.ALL_COLUMNS_ARRAY, false))
                    {
                        while (row.hasNext())
                        {
                            OnDiskAtom atom = row.next();
                            if (atom != null && atom instanceof Column)
                                indexWriter.nextColumn((Column) atom);
                        }
                    }
                    catch (IOException ex)
                    {
                        throw new FSReadError(ex, sstable.getFilename());
                    }

                    bytesProcessed += keyPosition - previousKeyPosition;
                    previousKeyPosition = keyPosition;
                }

                completeSSTable(indexWriter, sstable, indexes.values());
            }
        }
        finally
        {
            sstable.releaseReference();
        }
    }
}
 
开发者ID:xedin,项目名称:sasi,代码行数:58,代码来源:SSTableAttachedSecondaryIndex.java

示例6: testCancelIndex

import org.apache.cassandra.db.compaction.CompactionInterruptedException; //导入依赖的package包/类
@Test
public void testCancelIndex() throws Exception
{
    String ksname = KEYSPACE1;
    String cfname = CF_STANDARDLOWiINTERVAL; // index interval of 8, no key caching
    Keyspace keyspace = Keyspace.open(ksname);
    final ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfname);
    final int numSSTables = 4;
    int numRows = 256;
    createSSTables(ksname, cfname, numSSTables, numRows);

    final List<SSTableReader> sstables = new ArrayList<>(cfs.getLiveSSTables());
    for (SSTableReader sstable : sstables)
        sstable.overrideReadMeter(new RestorableMeter(100.0, 100.0));

    final long singleSummaryOffHeapSpace = sstables.get(0).getIndexSummaryOffHeapSize();

    // everything should get cut in half
    final AtomicReference<CompactionInterruptedException> exception = new AtomicReference<>();

    Thread t = new Thread(new Runnable()
    {
        public void run()
        {
            try
            {
                // Don't leave enough space for even the minimal index summaries
                try (LifecycleTransaction txn = cfs.getTracker().tryModify(sstables, OperationType.UNKNOWN))
                {
                    redistributeSummaries(Collections.EMPTY_LIST, of(cfs.metadata.cfId, txn), singleSummaryOffHeapSpace);
                }
            }
            catch (CompactionInterruptedException ex)
            {
                exception.set(ex);
            }
            catch (IOException ignored)
            {
            }
        }
    });
    t.start();
    while (CompactionManager.instance.getActiveCompactions() == 0 && t.isAlive())
        Thread.sleep(1);
    CompactionManager.instance.stopCompaction("INDEX_SUMMARY");
    t.join();

    assertNotNull("Expected compaction interrupted exception", exception.get());
    assertTrue("Expected no active compactions", CompactionMetrics.getCompactions().isEmpty());

    Set<SSTableReader> beforeRedistributionSSTables = new HashSet<>(sstables);
    Set<SSTableReader> afterCancelSSTables = new HashSet<>(cfs.getLiveSSTables());
    Set<SSTableReader> disjoint = Sets.symmetricDifference(beforeRedistributionSSTables, afterCancelSSTables);
    assertTrue(String.format("Mismatched files before and after cancelling redistribution: %s",
                             Joiner.on(",").join(disjoint)),
               disjoint.isEmpty());

    validateData(cfs, numRows);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:60,代码来源:IndexSummaryManagerTest.java


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