本文整理汇总了Java中org.apache.cassandra.utils.OutputHandler类的典型用法代码示例。如果您正苦于以下问题:Java OutputHandler类的具体用法?Java OutputHandler怎么用?Java OutputHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OutputHandler类属于org.apache.cassandra.utils包,在下文中一共展示了OutputHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.apache.cassandra.utils.OutputHandler; //导入依赖的package包/类
public static void main(String args[])
{
LoaderOptions options = LoaderOptions.parseArgs(args);
OutputHandler handler = new OutputHandler.SystemOutput(options.verbose, options.debug);
SSTableLoader loader = new SSTableLoader(options.directory, new ExternalClient(options.hosts, options.rpcPort, options.user, options.passwd), handler);
DatabaseDescriptor.setStreamThroughputOutboundMegabitsPerSec(options.throttle);
StreamResultFuture future = loader.stream(options.ignores);
future.addEventListener(new ProgressIndicator());
try
{
future.get();
System.exit(0); // We need that to stop non daemonized threads
}
catch (Exception e)
{
System.err.println("Streaming to the following hosts failed:");
System.err.println(loader.getFailedHosts());
System.err.println(e);
if (options.debug)
e.printStackTrace(System.err);
System.exit(1);
}
}
示例2: Upgrader
import org.apache.cassandra.utils.OutputHandler; //导入依赖的package包/类
public Upgrader(ColumnFamilyStore cfs, SSTableReader sstable, OutputHandler outputHandler)
{
this.cfs = cfs;
this.sstable = sstable;
this.toUpgrade = Collections.singletonList(sstable);
this.outputHandler = outputHandler;
this.directory = new File(sstable.getFilename()).getParentFile();
this.controller = new UpgradeController(cfs);
this.strategy = cfs.getCompactionStrategy();
long estimatedTotalKeys = Math.max(cfs.metadata.getIndexInterval(), SSTableReader.getApproximateKeyCount(toUpgrade, cfs.metadata));
long estimatedSSTables = Math.max(1, SSTable.getTotalBytes(this.toUpgrade) / strategy.getMaxSSTableSize());
this.estimatedRows = (long) Math.ceil((double) estimatedTotalKeys / estimatedSSTables);
}
示例3: Upgrader
import org.apache.cassandra.utils.OutputHandler; //导入依赖的package包/类
public Upgrader(ColumnFamilyStore cfs, LifecycleTransaction txn, OutputHandler outputHandler)
{
this.cfs = cfs;
this.transaction = txn;
this.sstable = txn.onlyOne();
this.outputHandler = outputHandler;
this.directory = new File(sstable.getFilename()).getParentFile();
this.controller = new UpgradeController(cfs);
this.strategyManager = cfs.getCompactionStrategyManager();
long estimatedTotalKeys = Math.max(cfs.metadata.params.minIndexInterval, SSTableReader.getApproximateKeyCount(Arrays.asList(this.sstable)));
long estimatedSSTables = Math.max(1, SSTableReader.getTotalBytes(Arrays.asList(this.sstable)) / strategyManager.getMaxSSTableBytes());
this.estimatedRows = (long) Math.ceil((double) estimatedTotalKeys / estimatedSSTables);
}
示例4: Upgrader
import org.apache.cassandra.utils.OutputHandler; //导入依赖的package包/类
public Upgrader(ColumnFamilyStore cfs, SSTableReader sstable, OutputHandler outputHandler)
{
this.cfs = cfs;
this.sstable = sstable;
this.toUpgrade = new HashSet<>(Collections.singleton(sstable));
this.outputHandler = outputHandler;
this.directory = new File(sstable.getFilename()).getParentFile();
this.controller = new UpgradeController(cfs);
this.strategy = cfs.getCompactionStrategy();
long estimatedTotalKeys = Math.max(cfs.metadata.getMinIndexInterval(), SSTableReader.getApproximateKeyCount(toUpgrade));
long estimatedSSTables = Math.max(1, SSTableReader.getTotalBytes(this.toUpgrade) / strategy.getMaxSSTableBytes());
this.estimatedRows = (long) Math.ceil((double) estimatedTotalKeys / estimatedSSTables);
}
示例5: Upgrader
import org.apache.cassandra.utils.OutputHandler; //导入依赖的package包/类
public Upgrader(ColumnFamilyStore cfs, SSTableReader sstable, OutputHandler outputHandler)
{
this.cfs = cfs;
this.sstable = sstable;
this.toUpgrade = Collections.singletonList(sstable);
this.outputHandler = outputHandler;
this.directory = new File(sstable.getFilename()).getParentFile();
this.controller = new UpgradeController(cfs);
this.strategy = cfs.getCompactionStrategy();
long estimatedTotalKeys = Math.max(DatabaseDescriptor.getIndexInterval(), SSTableReader.getApproximateKeyCount(toUpgrade));
long estimatedSSTables = Math.max(1, SSTable.getTotalBytes(this.toUpgrade) / strategy.getMaxSSTableSize());
this.estimatedRows = (long) Math.ceil((double) estimatedTotalKeys / estimatedSSTables);
}
示例6: Upgrader
import org.apache.cassandra.utils.OutputHandler; //导入依赖的package包/类
public Upgrader(ColumnFamilyStore cfs, SSTableReader sstable, OutputHandler outputHandler)
{
this.cfs = cfs;
this.sstable = sstable;
this.toUpgrade = Collections.singletonList(sstable);
this.outputHandler = outputHandler;
this.directory = new File(sstable.getFilename()).getParentFile();
this.controller = new UpgradeController(cfs);
this.strategy = cfs.getCompactionStrategy();
long estimatedTotalKeys = Math.max(cfs.metadata.getIndexInterval(), SSTableReader.getApproximateKeyCount(toUpgrade));
long estimatedSSTables = Math.max(1, SSTableReader.getTotalBytes(this.toUpgrade) / strategy.getMaxSSTableBytes());
this.estimatedRows = (long) Math.ceil((double) estimatedTotalKeys / estimatedSSTables);
}
示例7: Upgrader
import org.apache.cassandra.utils.OutputHandler; //导入依赖的package包/类
public Upgrader(ColumnFamilyStore cfs, SSTableReader sstable, OutputHandler outputHandler)
{
this.cfs = cfs;
this.sstable = sstable;
this.toUpgrade = Collections.singletonList(sstable);
this.outputHandler = outputHandler;
this.directory = new File(sstable.getFilename()).getParentFile();
this.controller = new UpgradeController(cfs);
this.strategy = cfs.getCompactionStrategy();
long estimatedTotalKeys = Math.max(cfs.metadata.getMinIndexInterval(), SSTableReader.getApproximateKeyCount(toUpgrade));
long estimatedSSTables = Math.max(1, SSTableReader.getTotalBytes(this.toUpgrade) / strategy.getMaxSSTableBytes());
this.estimatedRows = (long) Math.ceil((double) estimatedTotalKeys / estimatedSSTables);
}
示例8: Upgrader
import org.apache.cassandra.utils.OutputHandler; //导入依赖的package包/类
public Upgrader(ColumnFamilyStore cfs, SSTableReader sstable, OutputHandler outputHandler)
{
this.cfs = cfs;
this.sstable = sstable;
this.outputHandler = outputHandler;
this.directory = new File(sstable.getFilename()).getParentFile();
this.controller = new UpgradeController(cfs);
this.strategy = cfs.getCompactionStrategy();
long estimatedTotalKeys = Math.max(cfs.metadata.getMinIndexInterval(), SSTableReader.getApproximateKeyCount(Arrays.asList(this.sstable)));
long estimatedSSTables = Math.max(1, SSTableReader.getTotalBytes(Arrays.asList(this.sstable)) / strategy.getMaxSSTableBytes());
this.estimatedRows = (long) Math.ceil((double) estimatedTotalKeys / estimatedSSTables);
}
示例9: Scrubber
import org.apache.cassandra.utils.OutputHandler; //导入依赖的package包/类
public Scrubber(ColumnFamilyStore cfs, SSTableReader sstable, boolean skipCorrupted, OutputHandler outputHandler, boolean isOffline) throws IOException
{
this.cfs = cfs;
this.sstable = sstable;
this.outputHandler = outputHandler;
this.skipCorrupted = skipCorrupted;
this.isOffline = isOffline;
List<SSTableReader> toScrub = Collections.singletonList(sstable);
// Calculate the expected compacted filesize
this.destination = cfs.directories.getWriteableLocationAsFile(cfs.getExpectedCompactedFileSize(toScrub, OperationType.SCRUB));
if (destination == null)
throw new IOException("disk full");
// If we run scrub offline, we should never purge tombstone, as we cannot know if other sstable have data that the tombstone deletes.
this.controller = isOffline
? new ScrubController(cfs)
: new CompactionController(cfs, Collections.singleton(sstable), CompactionManager.getDefaultGcBefore(cfs));
this.isCommutative = cfs.metadata.isCounter();
this.expectedBloomFilterSize = Math.max(cfs.metadata.getMinIndexInterval(), (int)(SSTableReader.getApproximateKeyCount(toScrub)));
// loop through each row, deserializing to check for damage.
// we'll also loop through the index at the same time, using the position from the index to recover if the
// row header (key or data size) is corrupt. (This means our position in the index file will be one row
// "ahead" of the data file.)
this.dataFile = isOffline
? sstable.openDataReader()
: sstable.openDataReader(CompactionManager.instance.getRateLimiter());
this.indexFile = RandomAccessReader.open(new File(sstable.descriptor.filenameFor(Component.PRIMARY_INDEX)));
this.scrubInfo = new ScrubInfo(dataFile, sstable);
}
示例10: SSTableLoader
import org.apache.cassandra.utils.OutputHandler; //导入依赖的package包/类
public SSTableLoader(File directory, Client client, OutputHandler outputHandler, int connectionsPerHost)
{
this.directory = directory;
this.keyspace = directory.getParentFile().getName();
this.client = client;
this.outputHandler = outputHandler;
this.connectionsPerHost = connectionsPerHost;
}
示例11: Scrubber
import org.apache.cassandra.utils.OutputHandler; //导入依赖的package包/类
public Scrubber(ColumnFamilyStore cfs, SSTableReader sstable, OutputHandler outputHandler, boolean isOffline) throws IOException
{
this.cfs = cfs;
this.sstable = sstable;
this.outputHandler = outputHandler;
// Calculate the expected compacted filesize
this.destination = cfs.directories.getDirectoryForNewSSTables();
if (destination == null)
throw new IOException("disk full");
List<SSTableReader> toScrub = Collections.singletonList(sstable);
// If we run scrub offline, we should never purge tombstone, as we cannot know if other sstable have data that the tombstone deletes.
this.controller = isOffline
? new ScrubController(cfs)
: new CompactionController(cfs, Collections.singleton(sstable), CompactionManager.getDefaultGcBefore(cfs));
this.isCommutative = cfs.metadata.getDefaultValidator().isCommutative();
this.expectedBloomFilterSize = Math.max(cfs.metadata.getIndexInterval(), (int)(SSTableReader.getApproximateKeyCount(toScrub,cfs.metadata)));
// loop through each row, deserializing to check for damage.
// we'll also loop through the index at the same time, using the position from the index to recover if the
// row header (key or data size) is corrupt. (This means our position in the index file will be one row
// "ahead" of the data file.)
this.dataFile = isOffline
? sstable.openDataReader()
: sstable.openDataReader(CompactionManager.instance.getRateLimiter());
this.indexFile = RandomAccessReader.open(new File(sstable.descriptor.filenameFor(Component.PRIMARY_INDEX)));
this.scrubInfo = new ScrubInfo(dataFile, sstable);
}
示例12: SSTableLoader
import org.apache.cassandra.utils.OutputHandler; //导入依赖的package包/类
public SSTableLoader(File directory, Client client, OutputHandler outputHandler)
{
this.directory = directory;
this.keyspace = directory.getParentFile().getName();
this.client = client;
this.outputHandler = outputHandler;
}
示例13: Verifier
import org.apache.cassandra.utils.OutputHandler; //导入依赖的package包/类
public Verifier(ColumnFamilyStore cfs, SSTableReader sstable, OutputHandler outputHandler, boolean isOffline) throws IOException
{
this.cfs = cfs;
this.sstable = sstable;
this.outputHandler = outputHandler;
this.rowIndexEntrySerializer = sstable.descriptor.version.getSSTableFormat().getIndexSerializer(sstable.metadata, sstable.descriptor.version, sstable.header);
this.controller = new VerifyController(cfs);
this.dataFile = isOffline
? sstable.openDataReader()
: sstable.openDataReader(CompactionManager.instance.getRateLimiter());
this.indexFile = RandomAccessReader.open(new File(sstable.descriptor.filenameFor(Component.PRIMARY_INDEX)));
this.verifyInfo = new VerifyInfo(dataFile, sstable);
}
示例14: main
import org.apache.cassandra.utils.OutputHandler; //导入依赖的package包/类
public static void main(String args[])
{
Options options = Options.parseArgs(args);
try
{
// load keyspace descriptions.
Schema.instance.loadFromDiskForTool();
CFMetaData metadata = Schema.instance.getCFMetaData(options.keyspaceName, options.cfName);
if (metadata == null)
throw new IllegalArgumentException(String.format("Unknown keyspace/table %s.%s",
options.keyspaceName,
options.cfName));
OutputHandler handler = new OutputHandler.SystemOutput(options.verbose, options.debug);
if (options.cleanup)
{
handler.output("Cleanuping up...");
LifecycleTransaction.removeUnfinishedLeftovers(metadata);
}
else
{
handler.output("Listing files...");
listFiles(options, metadata, handler);
}
System.exit(0);
}
catch (Exception e)
{
System.err.println(e.getMessage());
if (options.debug)
e.printStackTrace(System.err);
System.exit(1);
}
}
示例15: listFiles
import org.apache.cassandra.utils.OutputHandler; //导入依赖的package包/类
private static void listFiles(Options options, CFMetaData metadata, OutputHandler handler) throws IOException
{
Directories directories = new Directories(metadata, ColumnFamilyStore.getInitialDirectories());
for (File dir : directories.getCFDirectories())
{
for (File file : LifecycleTransaction.getFiles(dir.toPath(), getFilter(options), Directories.OnTxnErr.THROW))
handler.output(file.getCanonicalPath());
}
}