本文整理汇总了Java中org.apache.cassandra.io.sstable.SSTableReader.bytesOnDisk方法的典型用法代码示例。如果您正苦于以下问题:Java SSTableReader.bytesOnDisk方法的具体用法?Java SSTableReader.bytesOnDisk怎么用?Java SSTableReader.bytesOnDisk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.io.sstable.SSTableReader
的用法示例。
在下文中一共展示了SSTableReader.bytesOnDisk方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: avgSize
import org.apache.cassandra.io.sstable.SSTableReader; //导入方法依赖的package包/类
private long avgSize(List<SSTableReader> sstables)
{
long n = 0;
for (SSTableReader sstable : sstables)
n += sstable.bytesOnDisk();
return n / sstables.size();
}
示例2: addNewSSTablesSize
import org.apache.cassandra.io.sstable.SSTableReader; //导入方法依赖的package包/类
private void addNewSSTablesSize(Iterable<SSTableReader> newSSTables)
{
for (SSTableReader sstable : newSSTables)
{
if (logger.isDebugEnabled())
logger.debug(String.format("adding %s to list of files tracked for %s.%s",
sstable.descriptor, cfstore.keyspace.getName(), cfstore.name));
long size = sstable.bytesOnDisk();
StorageMetrics.load.inc(size);
cfstore.metric.liveDiskSpaceUsed.inc(size);
cfstore.metric.totalDiskSpaceUsed.inc(size);
sstable.setTrackedBy(this);
}
}
示例3: removeOldSSTablesSize
import org.apache.cassandra.io.sstable.SSTableReader; //导入方法依赖的package包/类
private void removeOldSSTablesSize(Iterable<SSTableReader> oldSSTables)
{
for (SSTableReader sstable : oldSSTables)
{
if (logger.isDebugEnabled())
logger.debug(String.format("removing %s from list of files tracked for %s.%s",
sstable.descriptor, cfstore.keyspace.getName(), cfstore.name));
long size = sstable.bytesOnDisk();
StorageMetrics.load.dec(size);
cfstore.metric.liveDiskSpaceUsed.dec(size);
}
}
示例4: testSizeMetric
import org.apache.cassandra.io.sstable.SSTableReader; //导入方法依赖的package包/类
@Test
public void testSizeMetric()
{
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore store = keyspace.getColumnFamilyStore("Standard1");
store.disableAutoCompaction();
store.truncateBlocking();
assertEquals(0, store.metric.liveDiskSpaceUsed.count());
assertEquals(0, store.metric.totalDiskSpaceUsed.count());
for (int j = 0; j < 10; j++)
{
ByteBuffer key = ByteBufferUtil.bytes(String.valueOf(j));
Mutation rm = new Mutation("Keyspace1", key);
rm.add("Standard1", cellname("0"), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
rm.apply();
}
store.forceBlockingFlush();
Collection<SSTableReader> sstables = store.getSSTables();
long size = 0;
for (SSTableReader reader : sstables)
{
size += reader.bytesOnDisk();
}
// size metrics should show the sum of all SSTable sizes
assertEquals(size, store.metric.liveDiskSpaceUsed.count());
assertEquals(size, store.metric.totalDiskSpaceUsed.count());
store.truncateBlocking();
// after truncate, size metrics should be down to 0
assertEquals(0, store.metric.liveDiskSpaceUsed.count());
assertEquals(0, store.metric.totalDiskSpaceUsed.count());
store.enableAutoCompaction();
}