HBASE-11329 Minor fixup of new blockcache tab number formatting

This commit is contained in:
Michael Stack 2014-06-11 12:25:18 -07:00
parent aa916b81ce
commit 3d3784dd22
4 changed files with 40 additions and 9 deletions

View File

@ -195,37 +195,37 @@ org.apache.hadoop.util.StringUtils;
</tr>
<tr>
<td>Count</td>
<td><% StringUtils.humanReadableInt(cacheConfig.getBlockCache().getBlockCount()) %></td>
<td><% String.format("%,d", cacheConfig.getBlockCache().getBlockCount()) %></td>
<td>Number of blocks in Block Cache</td>
</tr>
<tr>
<td>Evicted</td>
<td><% StringUtils.humanReadableInt(cacheConfig.getBlockCache().getStats().getEvictedCount()) %></td>
<td><% String.format("%,d", cacheConfig.getBlockCache().getStats().getEvictedCount()) %></td>
<td>Number of blocks evicted</td>
</tr>
<tr>
<td>Evictions</td>
<td><% StringUtils.humanReadableInt(cacheConfig.getBlockCache().getStats().getEvictionCount()) %></td>
<td><% String.format("%,d", cacheConfig.getBlockCache().getStats().getEvictionCount()) %></td>
<td>Number of times an eviction occurred</td>
</tr>
<tr>
<td>Hits</td>
<td><% StringUtils.humanReadableInt(cacheConfig.getBlockCache().getStats().getHitCount()) %></td>
<td><% String.format("%,d", cacheConfig.getBlockCache().getStats().getHitCount()) %></td>
<td>Number requests that were cache hits</td>
</tr>
<tr>
<td>Hits Caching</td>
<td><% StringUtils.humanReadableInt(cacheConfig.getBlockCache().getStats().getHitCachingCount()) %></td>
<td><% String.format("%,d", cacheConfig.getBlockCache().getStats().getHitCachingCount()) %></td>
<td>Cache hit block requests but only requests set to use Block Cache</td>
</tr>
<tr>
<td>Misses</td>
<td><% StringUtils.humanReadableInt(cacheConfig.getBlockCache().getStats().getMissCount()) %></td>
<td><% String.format("%,d", cacheConfig.getBlockCache().getStats().getMissCount()) %></td>
<td>Number of requests that were cache misses</td>
</tr>
<tr>
<td>Misses Caching</td>
<td><% StringUtils.humanReadableInt(cacheConfig.getBlockCache().getStats().getMissCount()) %></td>
<td><% String.format("%,d", cacheConfig.getBlockCache().getStats().getMissCount()) %></td>
<td>Block requests that were cache misses but only requests set to use Block Cache</td>
</tr>
<tr>
@ -294,15 +294,22 @@ are combined counts. Request count is sum of hits and misses.</p>
<td><a href="<% bcUrl %>"><% bc.getClass().getSimpleName() %></a></td>
<td>Class implementing this Block Cache Level</td>
</tr>
<%if bucketCache %>
<tr>
<td>Implementation</td>
<td><% ((BucketCache)bc).getIoEngine() %></a></td>
<td>IOEngine</td>
</tr>
</%if>
<tr>
<td>Count</td>
<td><% StringUtils.humanReadableInt(cbsbf.getCount()) %></td>
<td><% String.format("%,d", cbsbf.getCount()) %></td>
<td>Count of Blocks</td>
</tr>
<%if !bucketCache %>
<tr>
<td>Count</td>
<td><% StringUtils.humanReadableInt(cbsbf.getDataCount()) %></td>
<td><% String.format("%,d", cbsbf.getDataCount()) %></td>
<td>Count of DATA Blocks</td>
</tr>
</%if>

View File

@ -259,6 +259,10 @@ public class BucketCache implements BlockCache, HeapSize {
persistencePath + ", bucketAllocator=" + this.bucketAllocator);
}
public String getIoEngine() {
return ioEngine.toString();
}
/**
* Get the IOEngine from the IO engine name
* @param ioEngineName

View File

@ -31,6 +31,8 @@ import org.apache.hadoop.hbase.util.ByteBufferArray;
@InterfaceAudience.Private
public class ByteBufferIOEngine implements IOEngine {
private ByteBufferArray bufferArray;
private final long capacity;
private final boolean direct;
/**
* Construct the ByteBufferIOEngine with the given capacity
@ -40,9 +42,17 @@ public class ByteBufferIOEngine implements IOEngine {
*/
public ByteBufferIOEngine(long capacity, boolean direct)
throws IOException {
this.capacity = capacity;
this.direct = direct;
bufferArray = new ByteBufferArray(capacity, direct);
}
@Override
public String toString() {
return "ioengine=" + this.getClass().getSimpleName() + ", capacity=" +
String.format("%,d", this.capacity) + ", direct=" + this.direct;
}
/**
* Memory IO engine is always unable to support persistent storage for the
* cache

View File

@ -36,8 +36,12 @@ public class FileIOEngine implements IOEngine {
private static final Log LOG = LogFactory.getLog(FileIOEngine.class);
private final RandomAccessFile raf;
private final FileChannel fileChannel;
private final String path;
private long size;
public FileIOEngine(String filePath, long fileSize) throws IOException {
this.path = filePath;
this.size = fileSize;
try {
raf = new RandomAccessFile(filePath, "rw");
} catch (java.io.FileNotFoundException fex) {
@ -58,6 +62,12 @@ public class FileIOEngine implements IOEngine {
LOG.info("Allocating " + StringUtils.byteDesc(fileSize) + ", on the path:" + filePath);
}
@Override
public String toString() {
return "ioengine=" + this.getClass().getSimpleName() + ", path=" + this.path +
", size=" + String.format("%,d", this.size);
}
/**
* File IO engine is always able to support persistent storage for the cache
* @return true