Skip to content

Commit

Permalink
HBASE-23230 Enforce member visibility in HRegionServer (#775) (#806)
Browse files Browse the repository at this point in the history
* Clean up a bunch of private variable leakage into other
   classes. Reduces visibility as much as possible, providing getters
   where access remains necessary or making use of getters that
   already exist. There remains an insidious relationship between
   `HRegionServer` and `RSRpcServices`.
 * Rename `fs` to `dataFs`, `rootDir` as `dataRootDir` so as to
   distinguish from the new `walFs`, `walRootDir` (and make it easier
   to spot bugs).
 * Cleanup or delete a bunch of lack-luster javadoc comments.
 * Delete a handful of methods that are unused according to static
   analysis.
 * Reduces the warning count as reported by IntelliJ from 100 to 7.

Signed-off-by: stack <stack@apache.org>
  • Loading branch information
ndimiduk committed Nov 8, 2019
1 parent 5dfa58b commit f42b2aa
Show file tree
Hide file tree
Showing 27 changed files with 441 additions and 544 deletions.
Expand Up @@ -133,7 +133,7 @@ org.apache.hadoop.hbase.zookeeper.MasterAddressTracker;

<section>
<h2>Server Metrics</h2>
<& ServerMetricsTmpl; mWrap = regionServer.getRegionServerMetrics().getRegionServerWrapper();
<& ServerMetricsTmpl; mWrap = regionServer.getMetrics().getRegionServerWrapper();
mServerWrap = regionServer.getRpcServer().getMetrics().getHBaseServerWrapper();
bbAllocator = regionServer.getRpcServer().getByteBuffAllocator(); &>
</section>
Expand Down
Expand Up @@ -78,8 +78,7 @@ public interface Server extends Abortable, Stoppable {
/**
* @return Return the FileSystem object used (can return null!).
*/
// TODO: On Master, return Master's. On RegionServer, return RegionServers. The FileSystems
// may differ. TODO.
// TODO: Distinguish between "dataFs" and "walFs".
default FileSystem getFileSystem() {
// This default is pretty dodgy!
Configuration c = getConfiguration();
Expand Down
Expand Up @@ -515,8 +515,8 @@ public HMaster(final Configuration conf)

this.rsFatals = new MemoryBoundedLogMessageBuffer(
conf.getLong("hbase.master.buffer.for.rs.fatals", 1 * 1024 * 1024));
LOG.info("hbase.rootdir=" + getRootDir() +
", hbase.cluster.distributed=" + this.conf.getBoolean(HConstants.CLUSTER_DISTRIBUTED, false));
LOG.info("hbase.rootdir={}, hbase.cluster.distributed={}", getDataRootDir(),
this.conf.getBoolean(HConstants.CLUSTER_DISTRIBUTED, false));

// Disable usage of meta replicas in the master
this.conf.setBoolean(HConstants.USE_META_REPLICAS, false);
Expand Down Expand Up @@ -3441,7 +3441,7 @@ public void reportMobCompactionEnd(TableName tableName) throws IOException {
*/
public void requestMobCompaction(TableName tableName,
List<ColumnFamilyDescriptor> columns, boolean allFiles) throws IOException {
mobCompactThread.requestMobCompaction(conf, fs, tableName, columns, allFiles);
mobCompactThread.requestMobCompaction(conf, getFileSystem(), tableName, columns, allFiles);
}

/**
Expand Down
Expand Up @@ -392,9 +392,10 @@ protected Class<?> getRpcSchedulerFactoryClass() {
}

@Override
protected RpcServerInterface createRpcServer(Server server, Configuration conf,
RpcSchedulerFactory rpcSchedulerFactory, InetSocketAddress bindAddress, String name)
throws IOException {
protected RpcServerInterface createRpcServer(final Server server,
final RpcSchedulerFactory rpcSchedulerFactory, final InetSocketAddress bindAddress,
final String name) throws IOException {
final Configuration conf = regionServer.getConfiguration();
// RpcServer at HM by default enable ByteBufferPool iff HM having user table region in it
boolean reservoirEnabled = conf.getBoolean(ByteBuffAllocator.ALLOCATOR_POOL_ENABLED_KEY,
LoadBalancer.isMasterCanHostUserRegions(conf));
Expand Down

0 comments on commit f42b2aa

Please sign in to comment.