diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index 0cc1e51..b9c3bdc 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -1734,13 +1734,16 @@ public class HRegionServer extends HasThread implements private int putUpWebUI() throws IOException { int port = this.conf.getInt(HConstants.REGIONSERVER_INFO_PORT, HConstants.DEFAULT_REGIONSERVER_INFOPORT); + String addr = this.conf.get("hbase.regionserver.info.bindAddress", "0.0.0.0"); + if(this instanceof HMaster) { port = conf.getInt(HConstants.MASTER_INFO_PORT, HConstants.DEFAULT_MASTER_INFOPORT); + addr = this.conf.get("hbase.master.info.bindAddress", "0.0.0.0"); } // -1 is for disabling info server if (port < 0) return port; - String addr = this.conf.get("hbase.regionserver.info.bindAddress", "0.0.0.0"); + if (!Addressing.isLocalAddress(InetAddress.getByName(addr))) { String msg = "Failed to start http info server. Address " + addr diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java index 15bf2cb..e23fd0e 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java @@ -798,17 +798,23 @@ public class RSRpcServices implements HBaseRPCErrorHandler, throw new IllegalArgumentException(e); } // Server to handle client requests. - String hostname = getHostname(rs.conf); - int port = rs.conf.getInt(HConstants.REGIONSERVER_PORT, - HConstants.DEFAULT_REGIONSERVER_PORT); + InetSocketAddress initialIsa; + InetSocketAddress bindAddress; if(this instanceof MasterRpcServices) { - port = rs.conf.getInt(HConstants.MASTER_PORT, - HConstants.DEFAULT_MASTER_PORT); + String hostname = getHostname(rs.conf, "master"); + int port = rs.conf.getInt(HConstants.MASTER_PORT, HConstants.DEFAULT_MASTER_PORT); + // Creation of a HSA will force a resolve. + initialIsa = new InetSocketAddress(hostname, port); + bindAddress = new InetSocketAddress(rs.conf.get("hbase.master.ipc.address", hostname), port); + } else { + String hostname = getHostname(rs.conf, "regionserver"); + int port = rs.conf.getInt(HConstants.REGIONSERVER_PORT, + HConstants.DEFAULT_REGIONSERVER_PORT); + // Creation of a HSA will force a resolve. + initialIsa = new InetSocketAddress(hostname, port); + bindAddress = new InetSocketAddress( + rs.conf.get("hbase.regionserver.ipc.address", hostname), port); } - // Creation of a HSA will force a resolve. - InetSocketAddress initialIsa = new InetSocketAddress(hostname, port); - InetSocketAddress bindAddress = new InetSocketAddress( - rs.conf.get("hbase.regionserver.ipc.address", hostname), port); if (initialIsa.getAddress() == null) { throw new IllegalArgumentException("Failed resolve of " + initialIsa); } @@ -834,12 +840,13 @@ public class RSRpcServices implements HBaseRPCErrorHandler, rs.setName(name); } - public static String getHostname(Configuration conf) throws UnknownHostException { + public static String getHostname(Configuration conf, String masterOrRS) + throws UnknownHostException { String hostname = conf.get(HRegionServer.HOSTNAME_KEY); if (hostname == null || hostname.isEmpty()) { return Strings.domainNamePointerToHostName(DNS.getDefaultHost( - conf.get("hbase.regionserver.dns.interface", "default"), - conf.get("hbase.regionserver.dns.nameserver", "default"))); + conf.get("hbase." + masterOrRS + ".dns.interface", "default"), + conf.get("hbase." + masterOrRS + ".dns.nameserver", "default"))); } else { LOG.info("hostname is configured to be " + hostname); return hostname; @@ -1463,6 +1470,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler, * @param request the request * @throws ServiceException */ + @Override public WarmupRegionResponse warmupRegion(final RpcController controller, final WarmupRegionRequest request) throws ServiceException { @@ -2286,7 +2294,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler, values.clear(); } - if (scannerContext.checkSizeLimit(LimitScope.BETWEEN_ROWS) || i >= rows || + if (scannerContext.checkSizeLimit(LimitScope.BETWEEN_ROWS) || i >= rows || moreRows) { // We stopped prematurely builder.setMoreResultsInRegion(true); diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/RatioBasedCompactionPolicy.java hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/RatioBasedCompactionPolicy.java index 0db5c00..049c15e 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/RatioBasedCompactionPolicy.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/RatioBasedCompactionPolicy.java @@ -277,6 +277,7 @@ public class RatioBasedCompactionPolicy extends CompactionPolicy { * @param filesToCompact Files to compact. Can be null. * @return True if we should run a major compaction. */ + @Override public boolean isMajorCompaction(final Collection filesToCompact) throws IOException { boolean result = false; @@ -300,7 +301,7 @@ public class RatioBasedCompactionPolicy extends CompactionPolicy { if (sf.isMajorCompaction() && (cfTtl == HConstants.FOREVER || oldest < cfTtl)) { float blockLocalityIndex = sf.getHDFSBlockDistribution().getBlockLocalityIndex( - RSRpcServices.getHostname(comConf.conf) + RSRpcServices.getHostname(comConf.conf, "regionserver") ); if (blockLocalityIndex < comConf.getMinLocalityToForceCompact()) { if (LOG.isDebugEnabled()) { @@ -375,6 +376,7 @@ public class RatioBasedCompactionPolicy extends CompactionPolicy { * @param compactionSize Total size of some compaction * @return whether this should be a large or small compaction */ + @Override public boolean throttleCompaction(long compactionSize) { return compactionSize > comConf.getThrottlePoint(); }