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


Java SSTableReader.getSSTableLevel方法代码示例

本文整理汇总了Java中org.apache.cassandra.io.sstable.SSTableReader.getSSTableLevel方法的典型用法代码示例。如果您正苦于以下问题:Java SSTableReader.getSSTableLevel方法的具体用法?Java SSTableReader.getSSTableLevel怎么用?Java SSTableReader.getSSTableLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cassandra.io.sstable.SSTableReader的用法示例。


在下文中一共展示了SSTableReader.getSSTableLevel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSSTableMetadata

import org.apache.cassandra.io.sstable.SSTableReader; //导入方法依赖的package包/类
public List<SSTableMetadata> getSSTableMetadata(String ksName, String cfName) {
    ColumnFamilyStore cfStore = getStore(ksName, cfName);
    Collection<SSTableReader> tables = cfStore.getSSTables();
    List<SSTableMetadata> metaData = new ArrayList<>(tables.size());
    for (SSTableReader table : tables) {
        SSTableMetadata tableMetadata = new SSTableMetadata();
        File dataFile = new File(table.descriptor.filenameFor(Component.DATA));
        tableMetadata.filename = dataFile.getName();
        tableMetadata.generation = table.descriptor.generation;
        try {
            tableMetadata.fileTimestamp = Files.getLastModifiedTime(dataFile.toPath()).toMillis();
        } catch (IOException e) {
            tableMetadata.fileTimestamp = 0;
        }
        tableMetadata.minTimestamp = table.getMinTimestamp();
        tableMetadata.maxTimestamp = table.getMaxTimestamp();
        tableMetadata.diskLength = table.onDiskLength();
        tableMetadata.uncompressedLength = table.uncompressedLength();
        tableMetadata.keys = table.estimatedKeys();
        EstimatedHistogram rowSizeHistogram = table.getEstimatedRowSize();
        tableMetadata.maxRowSize = rowSizeHistogram.max();
        tableMetadata.avgRowSize = rowSizeHistogram.mean();
        EstimatedHistogram columnCountHistogram = table.getEstimatedColumnCount();
        tableMetadata.maxColumnCount = columnCountHistogram.max();
        tableMetadata.avgColumnCount = columnCountHistogram.mean();
        tableMetadata.droppableTombstones = table.getDroppableTombstonesBefore(Util.NOW_SECONDS - table.metadata.getGcGraceSeconds());
        tableMetadata.level = table.getSSTableLevel();
        tableMetadata.isRepaired = table.isRepaired();
        tableMetadata.repairedAt = table.getSSTableMetadata().repairedAt;
        metaData.add(tableMetadata);
    }
    return metaData;
}
 
开发者ID:instaclustr,项目名称:cassandra-sstable-tools,代码行数:34,代码来源:CassandraBackend.java

示例2: getSSTableMetadata

import org.apache.cassandra.io.sstable.SSTableReader; //导入方法依赖的package包/类
public List<SSTableMetadata> getSSTableMetadata(String ksName, String cfName) {
    ColumnFamilyStore cfStore = getStore(ksName, cfName);
    Collection<SSTableReader> tables = cfStore.getSSTables();
    List<SSTableMetadata> metaData = new ArrayList<>(tables.size());
    for (SSTableReader table : tables) {
        SSTableMetadata tableMetadata = new SSTableMetadata();
        File dataFile = new File(table.descriptor.filenameFor(Component.DATA));
        tableMetadata.filename = dataFile.getName();
        tableMetadata.generation = table.descriptor.generation;
        try {
            tableMetadata.fileTimestamp = Files.getLastModifiedTime(dataFile.toPath()).toMillis();
        } catch (IOException e) {
            tableMetadata.fileTimestamp = 0;
        }
        tableMetadata.minTimestamp = table.getMinTimestamp();
        tableMetadata.maxTimestamp = table.getMaxTimestamp();
        tableMetadata.diskLength = table.onDiskLength();
        tableMetadata.uncompressedLength = table.uncompressedLength();
        tableMetadata.keys = table.estimatedKeys();
        EstimatedHistogram rowSizeHistogram = table.getEstimatedRowSize();
        tableMetadata.maxRowSize = rowSizeHistogram.max();
        tableMetadata.avgRowSize = rowSizeHistogram.mean();
        EstimatedHistogram columnCountHistogram = table.getEstimatedColumnCount();
        tableMetadata.maxColumnCount = columnCountHistogram.max();
        tableMetadata.avgColumnCount = columnCountHistogram.mean();
        tableMetadata.droppableTombstones = table.getDroppableTombstonesBefore(Util.NOW_SECONDS - table.metadata.getGcGraceSeconds());
        tableMetadata.level = table.getSSTableLevel();
        tableMetadata.isRepaired = false;
        metaData.add(tableMetadata);
    }
    return metaData;
}
 
开发者ID:instaclustr,项目名称:cassandra-sstable-tools,代码行数:33,代码来源:CassandraBackend.java

示例3: getMaximalTask

import org.apache.cassandra.io.sstable.SSTableReader; //导入方法依赖的package包/类
public Collection<AbstractCompactionTask> getMaximalTask(int gcBefore)
{
    while (true)
    {
        OperationType op;
        LeveledManifest.CompactionCandidate candidate = manifest.getCompactionCandidates();
        if (candidate == null)
        {
            // if there is no sstable to compact in standard way, try compacting based on droppable tombstone ratio
            SSTableReader sstable = findDroppableSSTable(gcBefore);
            if (sstable == null)
            {
                logger.debug("No compaction necessary for {}", this);
                return null;
            }
            candidate = new LeveledManifest.CompactionCandidate(Collections.singleton(sstable),
                                                                sstable.getSSTableLevel(),
                                                                getMaxSSTableBytes());
            op = OperationType.TOMBSTONE_COMPACTION;
        }
        else
        {
            op = OperationType.COMPACTION;
        }

        if (cfs.getDataTracker().markCompacting(candidate.sstables))
        {
            LeveledCompactionTask newTask = new LeveledCompactionTask(cfs, candidate.sstables, candidate.level, gcBefore, candidate.maxSSTableBytes);
            newTask.setCompactionType(op);
            return Arrays.<AbstractCompactionTask>asList(newTask);
        }
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:34,代码来源:LeveledCompactionStrategy.java

示例4: getMaximalTask

import org.apache.cassandra.io.sstable.SSTableReader; //导入方法依赖的package包/类
public AbstractCompactionTask getMaximalTask(int gcBefore)
{
    while (true)
    {
        Pair<? extends Collection<SSTableReader>, Integer> pair = manifest.getCompactionCandidates();
        Collection<SSTableReader> sstables;
        OperationType op;
        int level;
        if (pair == null)
        {
            // if there is no sstable to compact in standard way, try compacting based on droppable tombstone ratio
            SSTableReader sstable = findDroppableSSTable(gcBefore);
            if (sstable == null)
            {
                logger.debug("No compaction necessary for {}", this);
                return null;
            }
            sstables = Collections.singleton(sstable);
            op = OperationType.TOMBSTONE_COMPACTION;
            level = sstable.getSSTableLevel();
        }
        else
        {
            op = OperationType.COMPACTION;
            sstables = pair.left;
            level = pair.right;
        }

        if (cfs.getDataTracker().markCompacting(sstables))
        {
            LeveledCompactionTask newTask = new LeveledCompactionTask(cfs, sstables, level, gcBefore, maxSSTableSizeInMB);
            newTask.setCompactionType(op);
            return newTask;
        }
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:37,代码来源:LeveledCompactionStrategy.java


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