HBASE-25842 move regionserver http-related code into o.a.h.h.regionserver.http

Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
Nick Dimiduk 2021-05-03 15:41:36 -07:00 committed by Nick Dimiduk
parent 432d141474
commit 17193dae58
6 changed files with 37 additions and 26 deletions

View File

@ -33,7 +33,7 @@ import org.apache.hadoop.hbase.master.assignment.AssignmentManager;
import org.apache.hadoop.hbase.master.assignment.RegionStateNode;
import org.apache.hadoop.hbase.monitoring.StateDumpServlet;
import org.apache.hadoop.hbase.monitoring.TaskMonitor;
import org.apache.hadoop.hbase.regionserver.RSDumpServlet;
import org.apache.hadoop.hbase.regionserver.http.RSDumpServlet;
import org.apache.hadoop.hbase.util.LogMonitoring;
import org.apache.hadoop.hbase.util.Threads;
import org.apache.yetus.audience.InterfaceAudience;

View File

@ -24,6 +24,7 @@ import static org.apache.hadoop.hbase.HConstants.HBASE_SPLIT_WAL_MAX_SPLITTER;
import static org.apache.hadoop.hbase.util.DNS.UNSAFE_RS_HOSTNAME_KEY;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.management.MemoryType;
import java.lang.management.MemoryUsage;
import java.lang.reflect.Constructor;
@ -141,6 +142,8 @@ import org.apache.hadoop.hbase.regionserver.handler.CloseMetaHandler;
import org.apache.hadoop.hbase.regionserver.handler.CloseRegionHandler;
import org.apache.hadoop.hbase.regionserver.handler.RSProcedureHandler;
import org.apache.hadoop.hbase.regionserver.handler.RegionReplicaFlushHandler;
import org.apache.hadoop.hbase.regionserver.http.RSDumpServlet;
import org.apache.hadoop.hbase.regionserver.http.RSStatusServlet;
import org.apache.hadoop.hbase.regionserver.throttle.FlushThroughputControllerFactory;
import org.apache.hadoop.hbase.regionserver.throttle.ThroughputController;
import org.apache.hadoop.hbase.replication.regionserver.ReplicationLoad;
@ -818,6 +821,24 @@ public class HRegionServer extends Thread implements
return RSDumpServlet.class;
}
/**
* Used by {@link RSDumpServlet} to generate debugging information.
*/
public void dumpRowLocks(final PrintWriter out) {
StringBuilder sb = new StringBuilder();
for (HRegion region : getRegions()) {
if (region.getLockedRows().size() > 0) {
for (HRegion.RowLockContext rowLockContext : region.getLockedRows().values()) {
sb.setLength(0);
sb.append(region.getTableDescriptor().getTableName()).append(",")
.append(region.getRegionInfo().getEncodedName()).append(",");
sb.append(rowLockContext.toString());
out.println(sb);
}
}
}
}
@Override
public boolean registerService(Service instance) {
// No stacking of instances is allowed for a single executorService name
@ -3746,7 +3767,7 @@ public class HRegionServer extends Thread implements
return hMemManager;
}
MemStoreFlusher getMemStoreFlusher() {
public MemStoreFlusher getMemStoreFlusher() {
return cacheFlusher;
}

View File

@ -67,7 +67,7 @@ import org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFacto
* @see FlushRequester
*/
@InterfaceAudience.Private
class MemStoreFlusher implements FlushRequester {
public class MemStoreFlusher implements FlushRequester {
private static final Logger LOG = LoggerFactory.getLogger(MemStoreFlusher.class);
private Configuration conf;

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hbase.regionserver;
package org.apache.hadoop.hbase.regionserver.http;
import java.io.IOException;
import java.io.OutputStream;
@ -29,6 +29,9 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.ipc.CallQueueInfo;
import org.apache.hadoop.hbase.monitoring.StateDumpServlet;
import org.apache.hadoop.hbase.monitoring.TaskMonitor;
import org.apache.hadoop.hbase.regionserver.CompactSplit;
import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.hadoop.hbase.regionserver.MemStoreFlusher;
import org.apache.hadoop.hbase.util.LogMonitoring;
import org.apache.hadoop.hbase.util.Threads;
import org.apache.yetus.audience.InterfaceAudience;
@ -70,7 +73,7 @@ public class RSDumpServlet extends StateDumpServlet {
out.println("\n\nRowLocks:");
out.println(LINE);
dumpRowLock(hrs, out);
hrs.dumpRowLocks(out);
out.println("\n\nExecutors:");
out.println(LINE);
@ -108,22 +111,6 @@ public class RSDumpServlet extends StateDumpServlet {
}
}
public static void dumpRowLock(HRegionServer hrs, PrintWriter out) {
StringBuilder sb = new StringBuilder();
for (Region region : hrs.getRegions()) {
HRegion hRegion = (HRegion)region;
if (hRegion.getLockedRows().size() > 0) {
for (HRegion.RowLockContext rowLockContext : hRegion.getLockedRows().values()) {
sb.setLength(0);
sb.append(hRegion.getTableDescriptor().getTableName()).append(",")
.append(hRegion.getRegionInfo().getEncodedName()).append(",");
sb.append(rowLockContext.toString());
out.println(sb.toString());
}
}
}
}
public static void dumpQueue(HRegionServer hrs, PrintWriter out) {
final CompactSplit compactSplit = hrs.getCompactSplitThread();
if (compactSplit != null) {
@ -143,7 +130,7 @@ public class RSDumpServlet extends StateDumpServlet {
public static void dumpCallQueues(HRegionServer hrs, PrintWriter out) {
CallQueueInfo callQueueInfo = hrs.rpcServices.rpcServer.getScheduler().getCallQueueInfo();
CallQueueInfo callQueueInfo = hrs.getRpcServer().getScheduler().getCallQueueInfo();
for(String queueName: callQueueInfo.getCallQueueNames()) {
@ -165,7 +152,5 @@ public class RSDumpServlet extends StateDumpServlet {
out.println("Total call count for queue: "+totalCallCount);
out.println("Total call size for queue (bytes): "+totalCallSize);
}
}
}

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hbase.regionserver;
package org.apache.hadoop.hbase.regionserver.http;
import java.io.IOException;
@ -24,6 +24,7 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.tmpl.regionserver.RSStatusTmpl;

View File

@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hbase.regionserver;
package org.apache.hadoop.hbase.regionserver.http;
import java.io.IOException;
import java.io.StringWriter;
@ -34,6 +34,10 @@ import org.apache.hadoop.hbase.io.ByteBuffAllocator;
import org.apache.hadoop.hbase.ipc.MetricsHBaseServer;
import org.apache.hadoop.hbase.ipc.MetricsHBaseServerWrapperStub;
import org.apache.hadoop.hbase.ipc.RpcServerInterface;
import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.hadoop.hbase.regionserver.MetricsRegionServer;
import org.apache.hadoop.hbase.regionserver.MetricsRegionServerWrapperStub;
import org.apache.hadoop.hbase.regionserver.RSRpcServices;
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.tmpl.regionserver.RSStatusTmpl;