本文整理汇总了Java中org.apache.cassandra.db.compaction.CompactionInfo类的典型用法代码示例。如果您正苦于以下问题:Java CompactionInfo类的具体用法?Java CompactionInfo怎么用?Java CompactionInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompactionInfo类属于org.apache.cassandra.db.compaction包,在下文中一共展示了CompactionInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Writer
import org.apache.cassandra.db.compaction.CompactionInfo; //导入依赖的package包/类
protected Writer(int keysToSave)
{
if (keysToSave >= getKeySet().size())
keys = getKeySet();
else
keys = hotKeySet(keysToSave);
OperationType type;
if (cacheType == CacheService.CacheType.KEY_CACHE)
type = OperationType.KEY_CACHE_SAVE;
else if (cacheType == CacheService.CacheType.ROW_CACHE)
type = OperationType.ROW_CACHE_SAVE;
else if (cacheType == CacheService.CacheType.COUNTER_CACHE)
type = OperationType.COUNTER_CACHE_SAVE;
else
type = OperationType.UNKNOWN;
info = new CompactionInfo(CFMetaData.denseCFMetaData(Keyspace.SYSTEM_KS, cacheType.toString(), BytesType.instance),
type,
0,
keys.size(),
"keys");
}
示例2: Writer
import org.apache.cassandra.db.compaction.CompactionInfo; //导入依赖的package包/类
protected Writer(int keysToSave)
{
if (keysToSave >= getKeySet().size())
keys = getKeySet();
else
keys = hotKeySet(keysToSave);
OperationType type;
if (cacheType == CacheService.CacheType.KEY_CACHE)
type = OperationType.KEY_CACHE_SAVE;
else if (cacheType == CacheService.CacheType.ROW_CACHE)
type = OperationType.ROW_CACHE_SAVE;
else
type = OperationType.UNKNOWN;
info = new CompactionInfo(new CFMetaData(Keyspace.SYSTEM_KS, cacheType.toString(), ColumnFamilyType.Standard, BytesType.instance, null),
type,
0,
keys.size(),
"keys");
}
示例3: getCompactionInfo
import org.apache.cassandra.db.compaction.CompactionInfo; //导入依赖的package包/类
public CompactionInfo getCompactionInfo()
{
long rangesLeft = 0, rangesTotal = 0;
Token lastToken = prevToken;
// This approximation is not very accurate, but since we do not have a method which allows us to calculate the
// percentage of a range covered by a second range, this is the best approximation that we can calculate.
// Instead, we just count the total number of ranges that haven't been seen by the node (we use the order of
// the tokens to determine whether they have been seen yet or not), and the total number of ranges that a node
// has.
for (Range<Token> range : StorageService.instance.getLocalRanges(baseCfs.keyspace.getName()))
{
rangesLeft++;
rangesTotal++;
// This will reset rangesLeft, so that the number of ranges left will be less than the total ranges at the
// end of the method.
if (lastToken == null || range.contains(lastToken))
rangesLeft = 0;
}
return new CompactionInfo(baseCfs.metadata, OperationType.VIEW_BUILD, rangesLeft, rangesTotal, "ranges", compactionId);
}
示例4: afterTest
import org.apache.cassandra.db.compaction.CompactionInfo; //导入依赖的package包/类
@After
public void afterTest()
{
for (CompactionInfo.Holder holder: CompactionMetrics.getCompactions())
{
holder.stop();
}
String ksname = KEYSPACE1;
String cfname = CF_STANDARDLOWiINTERVAL; // index interval of 8, no key caching
Keyspace keyspace = Keyspace.open(ksname);
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfname);
cfs.metadata.minIndexInterval(originalMinIndexInterval);
cfs.metadata.maxIndexInterval(originalMaxIndexInterval);
IndexSummaryManager.instance.setMemoryPoolCapacityInMB(originalCapacity);
}
示例5: Writer
import org.apache.cassandra.db.compaction.CompactionInfo; //导入依赖的package包/类
protected Writer(int keysToSave)
{
if (keysToSave >= getKeySet().size())
keys = getKeySet();
else
keys = hotKeySet(keysToSave);
OperationType type;
if (cacheType == CacheService.CacheType.KEY_CACHE)
type = OperationType.KEY_CACHE_SAVE;
else if (cacheType == CacheService.CacheType.ROW_CACHE)
type = OperationType.ROW_CACHE_SAVE;
else
type = OperationType.UNKNOWN;
info = new CompactionInfo(new CFMetaData(Table.SYSTEM_KS, cacheType.toString(), null, null, null),
type,
0,
keys.size(),
"keys");
}
示例6: Writer
import org.apache.cassandra.db.compaction.CompactionInfo; //导入依赖的package包/类
protected Writer(int keysToSave)
{
if (keysToSave >= getKeySet().size())
keys = getKeySet();
else
keys = hotKeySet(keysToSave);
OperationType type;
if (cacheType == CacheService.CacheType.KEY_CACHE)
type = OperationType.KEY_CACHE_SAVE;
else if (cacheType == CacheService.CacheType.ROW_CACHE)
type = OperationType.ROW_CACHE_SAVE;
else
type = OperationType.UNKNOWN;
info = new CompactionInfo(CFMetaData.denseCFMetaData(Keyspace.SYSTEM_KS, cacheType.toString(), BytesType.instance),
type,
0,
keys.size(),
"keys");
}
示例7: Writer
import org.apache.cassandra.db.compaction.CompactionInfo; //导入依赖的package包/类
private Writer(String ksname, String cfname)
{
keys = getKeySet();
long bytes = 0;
for (K key : keys)
bytes += translateKey(key).remaining();
// an approximation -- the keyset can change while saving
estimatedTotalBytes = bytes;
CompactionType type;
if (cacheType.equals(ColumnFamilyStore.CacheType.KEY_CACHE_TYPE))
type = CompactionType.KEY_CACHE_SAVE;
else if (cacheType.equals(ColumnFamilyStore.CacheType.ROW_CACHE_TYPE))
type = CompactionType.ROW_CACHE_SAVE;
else
type = CompactionType.UNKNOWN;
info = new CompactionInfo(ksname,
cfname,
type,
0,
estimatedTotalBytes);
}
示例8: finishCompaction
import org.apache.cassandra.db.compaction.CompactionInfo; //导入依赖的package包/类
public void finishCompaction(CompactionInfo.Holder ci)
{
// notify
ci.finished();
compactions.remove(ci);
bytesCompacted.inc(ci.getCompactionInfo().getTotal());
totalCompactionsCompleted.mark();
}
示例9: getCompactionInfo
import org.apache.cassandra.db.compaction.CompactionInfo; //导入依赖的package包/类
public CompactionInfo getCompactionInfo()
{
return new CompactionInfo(cfs.metadata,
OperationType.INDEX_BUILD,
iter.getBytesRead(),
iter.getTotalBytes());
}
示例10: getCompactionInfo
import org.apache.cassandra.db.compaction.CompactionInfo; //导入依赖的package包/类
public CompactionInfo getCompactionInfo()
{
return new CompactionInfo(cfs.metadata,
OperationType.INDEX_BUILD,
iter.getBytesRead(),
iter.getTotalBytes(),
compactionId);
}
示例11: Writer
import org.apache.cassandra.db.compaction.CompactionInfo; //导入依赖的package包/类
protected Writer(int keysToSave)
{
int size = size();
if (keysToSave >= size || keysToSave == 0)
{
keyIterator = keyIterator();
keysEstimate = size;
}
else
{
keyIterator = hotKeyIterator(keysToSave);
keysEstimate = keysToSave;
}
OperationType type;
if (cacheType == CacheService.CacheType.KEY_CACHE)
type = OperationType.KEY_CACHE_SAVE;
else if (cacheType == CacheService.CacheType.ROW_CACHE)
type = OperationType.ROW_CACHE_SAVE;
else if (cacheType == CacheService.CacheType.COUNTER_CACHE)
type = OperationType.COUNTER_CACHE_SAVE;
else
type = OperationType.UNKNOWN;
info = new CompactionInfo(CFMetaData.createFake(SystemKeyspace.NAME, cacheType.toString()),
type,
0,
keysEstimate,
"keys",
UUIDGen.getTimeUUID());
}
示例12: getCompactionInfo
import org.apache.cassandra.db.compaction.CompactionInfo; //导入依赖的package包/类
public CompactionInfo getCompactionInfo()
{
return new CompactionInfo(cfs.table.name,
cfs.columnFamily,
CompactionType.INDEX_BUILD,
iter.getBytesRead(),
iter.getTotalBytes());
}
示例13: getCompactionInfo
import org.apache.cassandra.db.compaction.CompactionInfo; //导入依赖的package包/类
public CompactionInfo getCompactionInfo()
{
long bytesWritten = this.bytesWritten;
// keyset can change in size, thus totalBytes can too
return info.forProgress(bytesWritten,
Math.max(bytesWritten, estimatedTotalBytes));
}
示例14: printCompactionStats
import org.apache.cassandra.db.compaction.CompactionInfo; //导入依赖的package包/类
public void printCompactionStats(PrintStream outs)
{
CompactionManagerMBean cm = probe.getCompactionManagerProxy();
outs.println("pending tasks: " + cm.getPendingTasks());
if (cm.getCompactions().size() > 0)
outs.printf("%25s%16s%16s%16s%16s%10s%n", "compaction type", "keyspace", "column family", "bytes compacted", "bytes total", "progress");
for (CompactionInfo c : cm.getCompactions())
{
String percentComplete = c.getTotalBytes() == 0
? "n/a"
: new DecimalFormat("0.00").format((double) c.getBytesComplete() / c.getTotalBytes() * 100) + "%";
outs.printf("%25s%16s%16s%16s%16s%10s%n", c.getTaskType(), c.getKeyspace(), c.getColumnFamily(), c.getBytesComplete(), c.getTotalBytes(), percentComplete);
}
}
示例15: beginCompaction
import org.apache.cassandra.db.compaction.CompactionInfo; //导入依赖的package包/类
public void beginCompaction(CompactionInfo.Holder ci)
{
// notify
ci.started();
compactions.add(ci);
}