HBASE-1089 Add count of regions on filesystem to master UI; add percentage online as difference between whats open and whats on filesystem
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@735837 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
557f050021
commit
2a3f6a5c97
|
@ -6,6 +6,11 @@ Release 0.20.0 - Unreleased
|
|||
HBASE-1136 HashFunction inadvertently destroys some randomness
|
||||
(Jonathan Ellis via Stack)
|
||||
|
||||
IMPROVEMENTS
|
||||
HBASE-1089 Add count of regions on filesystem to master UI; add percentage
|
||||
online as difference between whats open and whats on filesystem
|
||||
(Samuel Guo via Stack)
|
||||
|
||||
Release 0.19.0 - Unreleased
|
||||
INCOMPATIBLE CHANGES
|
||||
HBASE-885 TableMap and TableReduce should be interfaces
|
||||
|
|
|
@ -111,6 +111,9 @@ public interface HConstants {
|
|||
/** Name of old log file for reconstruction */
|
||||
static final String HREGION_OLDLOGFILE_NAME = "oldlogfile.log";
|
||||
|
||||
/** Used to construct the name of the compaction directory during compaction */
|
||||
static final String HREGION_COMPACTIONDIR_NAME = "compaction.dir";
|
||||
|
||||
/** Default maximum file size */
|
||||
static final long DEFAULT_MAX_FILE_SIZE = 256 * 1024 * 1024;
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ import org.apache.hadoop.io.MapWritable;
|
|||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.io.Writable;
|
||||
import org.apache.hadoop.ipc.RemoteException;
|
||||
import org.apache.hadoop.util.StringUtils;
|
||||
|
||||
/**
|
||||
* HMaster is the "master server" for a HBase.
|
||||
|
@ -316,6 +317,17 @@ public class HMaster extends Thread implements HConstants, HMasterInterface,
|
|||
public double getAverageLoad() {
|
||||
return serverManager.getAverageLoad();
|
||||
}
|
||||
|
||||
/** @return the number of regions on filesystem */
|
||||
public int countRegionsOnFS() {
|
||||
try {
|
||||
return regionManager.countRegionsOnFS();
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Get count of Regions on FileSystem error : " +
|
||||
StringUtils.stringifyException(e));
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Location of the <code>-ROOT-</code> region.
|
||||
|
|
|
@ -38,6 +38,9 @@ import java.util.concurrent.ConcurrentSkipListMap;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.fs.FileStatus;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.fs.PathFilter;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.HServerAddress;
|
||||
import org.apache.hadoop.hbase.HServerInfo;
|
||||
|
@ -447,6 +450,51 @@ class RegionManager implements HConstants {
|
|||
LOG.info("Skipped " + skipped + " region(s) that are in transition states");
|
||||
}
|
||||
|
||||
static class TableDirFilter implements PathFilter {
|
||||
|
||||
@Override
|
||||
public boolean accept(Path path) {
|
||||
// skip the region servers' log dirs && version file
|
||||
// HBASE-1112 want to sperate the log dirs from table's data dirs by a special character.
|
||||
String pathname = path.getName();
|
||||
return !pathname.startsWith("log_") && !pathname.equals(VERSION_FILE_NAME);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static class RegionDirFilter implements PathFilter {
|
||||
|
||||
@Override
|
||||
public boolean accept(Path path) {
|
||||
return !path.getName().equals(HREGION_COMPACTIONDIR_NAME);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rough number of the regions on fs
|
||||
* Note: this method simply counts the regions on fs by accumulating all the dirs
|
||||
* in each table dir (${HBASE_ROOT}/$TABLE) and skipping logfiles, compaction dirs.
|
||||
* @throws IOException
|
||||
*/
|
||||
public int countRegionsOnFS() throws IOException {
|
||||
int regions = 0;
|
||||
|
||||
FileStatus[] tableDirs =
|
||||
master.fs.listStatus(master.rootdir, new TableDirFilter());
|
||||
|
||||
FileStatus[] regionDirs;
|
||||
RegionDirFilter rdf = new RegionDirFilter();
|
||||
for(FileStatus tabledir : tableDirs) {
|
||||
if(tabledir.isDir()) {
|
||||
regionDirs = master.fs.listStatus(tabledir.getPath(), rdf);
|
||||
regions += regionDirs.length;
|
||||
}
|
||||
}
|
||||
|
||||
return regions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Read-only map of online regions.
|
||||
*/
|
||||
|
|
|
@ -632,7 +632,7 @@ public class HRegion implements HConstants {
|
|||
* @return compaction directory for the passed in <code>dir</code>
|
||||
*/
|
||||
static Path getCompactionDir(final Path dir) {
|
||||
return new Path(dir, "compaction.dir");
|
||||
return new Path(dir, HREGION_COMPACTIONDIR_NAME);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
<tr><td>Hadoop Compiled</td><td><%= org.apache.hadoop.util.VersionInfo.getDate() %>, <%= org.apache.hadoop.util.VersionInfo.getUser() %></td><td>When Hadoop version was compiled and by whom</td></tr>
|
||||
<tr><td>HBase Root Directory</td><td><%= master.getRootDir().toString() %></td><td>Location of HBase home directory</td></tr>
|
||||
<tr><td>Load average</td><td><%= master.getAverageLoad() %></td><td>Average load across all region servers. Naive computation.</td></tr>
|
||||
<tr><td>Regions On FS</td><td><%= master.countRegionsOnFS() %></td><td>The Number of regions on FileSystem. Rough count.</td></tr>
|
||||
</table>
|
||||
|
||||
<h2>Catalog Tables</h2>
|
||||
|
|
Loading…
Reference in New Issue