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


Java SSTable类代码示例

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


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

示例1: compact

import org.apache.cassandra.io.sstable.SSTable; //导入依赖的package包/类
@VisibleForTesting
protected synchronized void compact()
{
    ArrayList<Descriptor> descriptors = new ArrayList<>();
    for (SSTable sstable : hintStore.getDataTracker().getUncompactingSSTables())
        descriptors.add(sstable.descriptor);

    if (descriptors.isEmpty())
        return;

    try
    {
        CompactionManager.instance.submitUserDefined(hintStore, descriptors, (int) (System.currentTimeMillis() / 1000)).get();
    }
    catch (InterruptedException | ExecutionException e)
    {
        throw new RuntimeException(e);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:20,代码来源:HintedHandOffManager.java

示例2: cleanup

import org.apache.cassandra.io.sstable.SSTable; //导入依赖的package包/类
public void cleanup()
{
    List<String> files = readLockfile(lockfile);
    for (String file : files)
    {
        try
        {
            Descriptor desc = Descriptor.fromFilename(file, true);
            SSTable.delete(desc, SSTable.componentsFor(desc));
        }
        catch (Exception e)
        {
            JVMStabilityInspector.inspectThrowable(e);
            logger.warn("failed to delete a potentially stale sstable {}", file);
        }
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:18,代码来源:StreamLockfile.java

示例3: getColumnStats

import org.apache.cassandra.io.sstable.SSTable; //导入依赖的package包/类
public ColumnStats getColumnStats()
{
    long minTimestampSeen = deletionInfo().isLive() ? Long.MAX_VALUE : deletionInfo().minTimestamp();
    long maxTimestampSeen = deletionInfo().maxTimestamp();
    StreamingHistogram tombstones = new StreamingHistogram(SSTable.TOMBSTONE_HISTOGRAM_BIN_SIZE);
    int maxLocalDeletionTime = Integer.MIN_VALUE;
    List<ByteBuffer> minColumnNamesSeen = Collections.emptyList();
    List<ByteBuffer> maxColumnNamesSeen = Collections.emptyList();
    for (Column column : this)
    {
        minTimestampSeen = Math.min(minTimestampSeen, column.minTimestamp());
        maxTimestampSeen = Math.max(maxTimestampSeen, column.maxTimestamp());
        maxLocalDeletionTime = Math.max(maxLocalDeletionTime, column.getLocalDeletionTime());
        int deletionTime = column.getLocalDeletionTime();
        if (deletionTime < Integer.MAX_VALUE)
            tombstones.update(deletionTime);
        minColumnNamesSeen = ColumnNameHelper.minComponents(minColumnNamesSeen, column.name, metadata.comparator);
        maxColumnNamesSeen = ColumnNameHelper.maxComponents(maxColumnNamesSeen, column.name, metadata.comparator);
    }
    return new ColumnStats(getColumnCount(), minTimestampSeen, maxTimestampSeen, maxLocalDeletionTime, tombstones, minColumnNamesSeen, maxColumnNamesSeen);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:22,代码来源:ColumnFamily.java

示例4: close

import org.apache.cassandra.io.sstable.SSTable; //导入依赖的package包/类
public void close()
{
    FileUtils.closeQuietly(writer);
    byte[] bytes = digest.digest();
    if (bytes == null)
        return;
    SequentialWriter out = SequentialWriter.open(new File(descriptor.filenameFor(SSTable.COMPONENT_DIGEST)), true);
    // Writting output compatible with sha1sum
    Descriptor newdesc = descriptor.asTemporary(false);
    String[] tmp = newdesc.filenameFor(SSTable.COMPONENT_DATA).split(Pattern.quote(File.separator));
    String dataFileName = tmp[tmp.length - 1];
    try
    {
        out.write(String.format("%s  %s", Hex.bytesToHex(bytes), dataFileName).getBytes());
    }
    catch (ClosedChannelException e)
    {
        throw new AssertionError(); // can't happen.
    }
    finally
    {
        FileUtils.closeQuietly(out);
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:25,代码来源:DataIntegrityMetadata.java

示例5: run

import org.apache.cassandra.io.sstable.SSTable; //导入依赖的package包/类
public void run()
{
    SystemKeyspace.clearSSTableReadMeter(desc.ksname, desc.cfname, desc.generation);

    try
    {
        // If we can't successfully delete the DATA component, set the task to be retried later: see TransactionTidier
        File datafile = new File(desc.filenameFor(Component.DATA));

        delete(datafile);
        // let the remainder be cleaned up by delete
        SSTable.delete(desc, SSTable.discoverComponentsFor(desc));
    }
    catch (Throwable t)
    {
        logger.error("Failed deletion for {}, we'll retry after GC and on server restart", desc);
        failedDeletions.add(this);
        return;
    }

    if (tracker != null && tracker.cfstore != null && !wasNew)
        tracker.cfstore.metric.totalDiskSpaceUsed.dec(sizeOnDisk);

    // release the referent to the parent so that the all transaction files can be released
    parentRef.release();
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:27,代码来源:LogTransaction.java

示例6: cleanup

import org.apache.cassandra.io.sstable.SSTable; //导入依赖的package包/类
public void cleanup()
{
    List<String> files = readLockfile(lockfile);
    for (String file : files)
    {
        try
        {
            Descriptor desc = Descriptor.fromFilename(file, true);
            SSTable.delete(desc, SSTable.componentsFor(desc));
        }
        catch (Exception e)
        {
            logger.warn("failed to delete a potentially stale sstable {}", file);
        }
    }
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:17,代码来源:StreamLockfile.java

示例7: getColumnStats

import org.apache.cassandra.io.sstable.SSTable; //导入依赖的package包/类
public ColumnStats getColumnStats()
{
    long minTimestampSeen = deletionInfo().isLive() ? Long.MAX_VALUE : deletionInfo().minTimestamp();
    long maxTimestampSeen = deletionInfo().maxTimestamp();
    StreamingHistogram tombstones = new StreamingHistogram(SSTable.TOMBSTONE_HISTOGRAM_BIN_SIZE);

    for (IColumn column : columns)
    {
        minTimestampSeen = Math.min(minTimestampSeen, column.minTimestamp());
        maxTimestampSeen = Math.max(maxTimestampSeen, column.maxTimestamp());
        int deletionTime = column.getLocalDeletionTime();
        if (deletionTime < Integer.MAX_VALUE)
            tombstones.update(deletionTime);
    }
    return new ColumnStats(getColumnCount(), minTimestampSeen, maxTimestampSeen, tombstones);
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:17,代码来源:ColumnFamily.java

示例8: repairOverlappingSSTables

import org.apache.cassandra.io.sstable.SSTable; //导入依赖的package包/类
public synchronized void repairOverlappingSSTables(int level)
{
    SSTableReader previous = null;
    Collections.sort(generations[level], SSTable.sstableComparator);
    List<SSTableReader> outOfOrderSSTables = new ArrayList<SSTableReader>();
    for (SSTableReader current : generations[level])
    {
        if (previous != null && current.first.compareTo(previous.last) <= 0)
        {
            logger.error(String.format("At level %d, %s [%s, %s] overlaps %s [%s, %s].  This is caused by a bug in Cassandra 1.1.0 .. 1.1.3.  Sending back to L0.  If you have not yet run scrub, you should do so since you may also have rows out-of-order within an sstable",
                                       level, previous, previous.first, previous.last, current, current.first, current.last));
            outOfOrderSSTables.add(current);
        }
        else
        {
            previous = current;
        }
    }

    if (!outOfOrderSSTables.isEmpty())
    {
        for (SSTableReader sstable : outOfOrderSSTables)
            sendBackToL0(sstable);
        serialize();
    }
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:27,代码来源:LeveledManifest.java

示例9: getColumnStats

import org.apache.cassandra.io.sstable.SSTable; //导入依赖的package包/类
public ColumnStats getColumnStats()
{
    long minTimestampSeen = deletionInfo().isLive() ? Long.MAX_VALUE : deletionInfo().minTimestamp();
    long maxTimestampSeen = deletionInfo().maxTimestamp();
    StreamingHistogram tombstones = new StreamingHistogram(SSTable.TOMBSTONE_HISTOGRAM_BIN_SIZE);
    int maxLocalDeletionTime = Integer.MIN_VALUE;
    List<ByteBuffer> minColumnNamesSeen = Collections.emptyList();
    List<ByteBuffer> maxColumnNamesSeen = Collections.emptyList();
    for (Cell cell : this)
    {
        minTimestampSeen = Math.min(minTimestampSeen, cell.minTimestamp());
        maxTimestampSeen = Math.max(maxTimestampSeen, cell.maxTimestamp());
        maxLocalDeletionTime = Math.max(maxLocalDeletionTime, cell.getLocalDeletionTime());
        int deletionTime = cell.getLocalDeletionTime();
        if (deletionTime < Integer.MAX_VALUE)
            tombstones.update(deletionTime);
        minColumnNamesSeen = ColumnNameHelper.minComponents(minColumnNamesSeen, cell.name, metadata.comparator);
        maxColumnNamesSeen = ColumnNameHelper.maxComponents(maxColumnNamesSeen, cell.name, metadata.comparator);
    }
    return new ColumnStats(getColumnCount(), minTimestampSeen, maxTimestampSeen, maxLocalDeletionTime, tombstones, minColumnNamesSeen, maxColumnNamesSeen);
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:22,代码来源:ColumnFamily.java

示例10: getReplayPosition

import org.apache.cassandra.io.sstable.SSTable; //导入依赖的package包/类
/**
 * Convenience method to compute the replay position for a group of SSTables.
 * @param sstables
 * @return the most recent (highest) replay position
 */
public static ReplayPosition getReplayPosition(Iterable<? extends SSTable> sstables)
{
    if (Iterables.isEmpty(sstables))
        return NONE;

    Function<SSTable, ReplayPosition> f = new Function<SSTable, ReplayPosition>()
    {
        public ReplayPosition apply(SSTable sstable)
        {
            return sstable.replayPosition;
        }
    };
    Ordering<ReplayPosition> ordering = Ordering.from(ReplayPosition.comparator);
    return ordering.max(Iterables.transform(sstables, f));
}
 
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:21,代码来源:ReplayPosition.java

示例11: makeSSTable

import org.apache.cassandra.io.sstable.SSTable; //导入依赖的package包/类
private static SSTable makeSSTable()
{
    Table t = Table.open("Keyspace1");
    for (int i = 0; i < 100; i++)
    {
        RowMutation rm = new RowMutation(t.name, ByteBufferUtil.bytes(Long.toString(System.nanoTime())));
        rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("cola")), ByteBufferUtil.bytes("value"), 0);
        try
        {
            rm.apply();
        }
        catch (IOException ex) 
        {
            throw new RuntimeException(ex);
        }
    }
    try
    {
        t.getColumnFamilyStore("Standard1").forceBlockingFlush();
        return t.getColumnFamilyStore("Standard1").getSSTables().iterator().next();
    }
    catch (Exception any)
    {
        throw new RuntimeException(any);
    }
}
 
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:27,代码来源:SerializationsTest.java

示例12: run

import org.apache.cassandra.io.sstable.SSTable; //导入依赖的package包/类
public void run()
{
    logger.info("SSTableTidier is running..");
    //if (tracker != null && !tracker.isDummy())
    //    SystemKeyspace.clearSSTableReadMeter(desc.ksname, desc.cfname, desc.generation);

    try
    {
        // If we can't successfully delete the DATA component, set the task to be retried later: see TransactionTidier
        File datafile = new File(desc.filenameFor(Component.DATA));

        if (datafile.exists())
            delete(datafile);
        else if (!wasNew)
            logger.error("SSTableTidier ran with no existing data file for an sstable that was not new");

        // let the remainder be cleaned up by delete
        SSTable.delete(desc, SSTable.discoverComponentsFor(desc));
    }
    catch (Throwable t)
    {
        logger.error("Failed deletion for {}, we'll retry after GC and on server restart", desc);
        failedDeletions.add(this);
        return;
    }

    //if (tracker != null && tracker.cfstore != null && !wasNew)
    //    tracker.cfstore.metric.totalDiskSpaceUsed.dec(sizeOnDisk);

    // release the referent to the parent so that the all transaction files can be released
    parentRef.release();
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:33,代码来源:LogTransaction.java

示例13: doPrepare

import org.apache.cassandra.io.sstable.SSTable; //导入依赖的package包/类
protected void doPrepare()
{
    iwriter.prepareToCommit();

    // write sstable statistics
    dataFile.prepareToCommit();
    writeMetadata(descriptor, finalizeMetadata());

    // save the table of components
    SSTable.appendTOC(descriptor, components);

    //if (openResult)
    //    finalReader = openFinal(SSTableReader.OpenReason.NORMAL);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:15,代码来源:BigTableWriter.java

示例14: compact

import org.apache.cassandra.io.sstable.SSTable; //导入依赖的package包/类
@VisibleForTesting
protected Future<?> compact()
{
    hintStore.forceBlockingFlush();
    ArrayList<Descriptor> descriptors = new ArrayList<Descriptor>();
    for (SSTable sstable : hintStore.getSSTables())
        descriptors.add(sstable.descriptor);
    return CompactionManager.instance.submitUserDefined(hintStore, descriptors, (int) (System.currentTimeMillis() / 1000));
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:10,代码来源:HintedHandOffManager.java

示例15: makeRecord

import org.apache.cassandra.io.sstable.SSTable; //导入依赖的package包/类
private LogRecord makeRecord(Type type, SSTable table)
{
    assert type == Type.ADD || type == Type.REMOVE;

    File folder = table.descriptor.directory;
    replicas.maybeCreateReplica(folder, getFileName(folder), records);
    return LogRecord.make(type, table);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:9,代码来源:LogFile.java


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