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


Java Directories.SSTableLister方法代码示例

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


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

示例1: main

import org.apache.cassandra.db.Directories; //导入方法依赖的package包/类
/**
 * @param args a list of sstables whose metadata we are changing
 */
public static void main(String[] args) throws IOException
{
    PrintStream out = System.out;
    if (args.length < 2)
    {
        out.println("This command should be run with Cassandra stopped!");
        out.println("Usage: sstableofflinerelevel [--dry-run] <keyspace> <columnfamily>");
        System.exit(1);
    }
    boolean dryRun = args[0].equals("--dry-run");
    String keyspace = args[args.length - 2];
    String columnfamily = args[args.length - 1];
    DatabaseDescriptor.loadSchemas(false);

    if (Schema.instance.getCFMetaData(keyspace, columnfamily) == null)
        throw new IllegalArgumentException(String.format("Unknown keyspace/columnFamily %s.%s",
                keyspace,
                columnfamily));

    Keyspace ks = Keyspace.openWithoutSSTables(keyspace);
    ColumnFamilyStore cfs = ks.getColumnFamilyStore(columnfamily);
    Directories.SSTableLister lister = cfs.directories.sstableLister().skipTemporary(true);
    Set<SSTableReader> sstables = new HashSet<>();
    for (Map.Entry<Descriptor, Set<Component>> sstable : lister.list().entrySet())
    {
        if (sstable.getKey() != null)
        {
            try
            {
                SSTableReader reader = SSTableReader.open(sstable.getKey());
                sstables.add(reader);
            }
            catch (Throwable t)
            {
                out.println("Couldn't open sstable: "+sstable.getKey().filenameFor(Component.DATA));
                Throwables.propagate(t);
            }
        }
    }
    if (sstables.isEmpty())
    {
        out.println("No sstables to relevel for "+keyspace+"."+columnfamily);
        System.exit(1);
    }
    Relevel rl = new Relevel(sstables);
    rl.relevel(dryRun);
    System.exit(0);

}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:53,代码来源:SSTableOfflineRelevel.java

示例2: main

import org.apache.cassandra.db.Directories; //导入方法依赖的package包/类
/**
 * @param args a list of sstables whose metadata we are changing
 */
public static void main(String[] args) throws IOException
{
    PrintStream out = System.out;
    if (args.length < 2)
    {
        out.println("This command should be run with Cassandra stopped!");
        out.println("Usage: sstableofflinerelevel [--dry-run] <keyspace> <columnfamily>");
        System.exit(1);
    }

    Util.initDatabaseDescriptor();

    boolean dryRun = args[0].equals("--dry-run");
    String keyspace = args[args.length - 2];
    String columnfamily = args[args.length - 1];
    Schema.instance.loadFromDiskForTool();

    if (Schema.instance.getCFMetaData(keyspace, columnfamily) == null)
        throw new IllegalArgumentException(String.format("Unknown keyspace/columnFamily %s.%s",
                keyspace,
                columnfamily));

    Keyspace ks = Keyspace.openWithoutSSTables(keyspace);
    ColumnFamilyStore cfs = ks.getColumnFamilyStore(columnfamily);
    Directories.SSTableLister lister = cfs.getDirectories().sstableLister(Directories.OnTxnErr.THROW).skipTemporary(true);
    Set<SSTableReader> sstables = new HashSet<>();
    for (Map.Entry<Descriptor, Set<Component>> sstable : lister.list().entrySet())
    {
        if (sstable.getKey() != null)
        {
            try
            {
                SSTableReader reader = SSTableReader.open(sstable.getKey());
                sstables.add(reader);
            }
            catch (Throwable t)
            {
                out.println("Couldn't open sstable: "+sstable.getKey().filenameFor(Component.DATA));
                Throwables.propagate(t);
            }
        }
    }
    if (sstables.isEmpty())
    {
        out.println("No sstables to relevel for "+keyspace+"."+columnfamily);
        System.exit(1);
    }
    Relevel rl = new Relevel(sstables);
    rl.relevel(dryRun);
    System.exit(0);

}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:56,代码来源:SSTableOfflineRelevel.java

示例3: main

import org.apache.cassandra.db.Directories; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException
{
    PrintStream out = System.out;
    if (args.length < 2)
    {
        out.println("Usage: sstableexpiredblockers <keyspace> <table>");
        System.exit(1);
    }

    Util.initDatabaseDescriptor();

    String keyspace = args[args.length - 2];
    String columnfamily = args[args.length - 1];
    Schema.instance.loadFromDiskForTool();

    CFMetaData metadata = Schema.instance.getCFMetaData(keyspace, columnfamily);
    if (metadata == null)
        throw new IllegalArgumentException(String.format("Unknown keyspace/table %s.%s",
                keyspace,
                columnfamily));

    Keyspace ks = Keyspace.openWithoutSSTables(keyspace);
    ColumnFamilyStore cfs = ks.getColumnFamilyStore(columnfamily);
    Directories.SSTableLister lister = cfs.getDirectories().sstableLister(Directories.OnTxnErr.THROW).skipTemporary(true);
    Set<SSTableReader> sstables = new HashSet<>();
    for (Map.Entry<Descriptor, Set<Component>> sstable : lister.list().entrySet())
    {
        if (sstable.getKey() != null)
        {
            try
            {
                SSTableReader reader = SSTableReader.open(sstable.getKey());
                sstables.add(reader);
            }
            catch (Throwable t)
            {
                out.println("Couldn't open sstable: " + sstable.getKey().filenameFor(Component.DATA)+" ("+t.getMessage()+")");
            }
        }
    }
    if (sstables.isEmpty())
    {
        out.println("No sstables for " + keyspace + "." + columnfamily);
        System.exit(1);
    }

    int gcBefore = (int)(System.currentTimeMillis()/1000) - metadata.params.gcGraceSeconds;
    Multimap<SSTableReader, SSTableReader> blockers = checkForExpiredSSTableBlockers(sstables, gcBefore);
    for (SSTableReader blocker : blockers.keySet())
    {
        out.println(String.format("%s blocks %d expired sstables from getting dropped: %s%n",
                                formatForExpiryTracing(Collections.singleton(blocker)),
                                blockers.get(blocker).size(),
                                formatForExpiryTracing(blockers.get(blocker))));
    }

    System.exit(0);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:59,代码来源:SSTableExpiredBlockers.java

示例4: getSSTablesToRead

import org.apache.cassandra.db.Directories; //导入方法依赖的package包/类
List<File> getSSTablesToRead() {
	final Directories directories = Directories.create(metadata.getKeyspace(), metadata.getColumnFamily());
	final Directories.SSTableLister sstableFiles = directories.sstableLister().skipTemporary(true);

	return sstableFiles.listFiles();
}
 
开发者ID:richardalow,项目名称:cassowary,代码行数:7,代码来源:RangeRowIterator.java


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