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 36994a2c5e
commit 3f8d3ba6d9
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.master.assignment.RegionStateNode;
import org.apache.hadoop.hbase.monitoring.StateDumpServlet; import org.apache.hadoop.hbase.monitoring.StateDumpServlet;
import org.apache.hadoop.hbase.monitoring.TaskMonitor; 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.LogMonitoring;
import org.apache.hadoop.hbase.util.Threads; import org.apache.hadoop.hbase.util.Threads;
import org.apache.yetus.audience.InterfaceAudience; 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 static org.apache.hadoop.hbase.util.DNS.UNSAFE_RS_HOSTNAME_KEY;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter;
import java.lang.management.MemoryType; import java.lang.management.MemoryType;
import java.lang.management.MemoryUsage; import java.lang.management.MemoryUsage;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
@ -144,6 +145,8 @@ import org.apache.hadoop.hbase.regionserver.handler.CloseMetaHandler;
import org.apache.hadoop.hbase.regionserver.handler.CloseRegionHandler; import org.apache.hadoop.hbase.regionserver.handler.CloseRegionHandler;
import org.apache.hadoop.hbase.regionserver.handler.RSProcedureHandler; import org.apache.hadoop.hbase.regionserver.handler.RSProcedureHandler;
import org.apache.hadoop.hbase.regionserver.handler.RegionReplicaFlushHandler; 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.FlushThroughputControllerFactory;
import org.apache.hadoop.hbase.regionserver.throttle.ThroughputController; import org.apache.hadoop.hbase.regionserver.throttle.ThroughputController;
import org.apache.hadoop.hbase.replication.regionserver.ReplicationLoad; import org.apache.hadoop.hbase.replication.regionserver.ReplicationLoad;
@ -828,6 +831,24 @@ public class HRegionServer extends Thread implements
return RSDumpServlet.class; 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 @Override
public boolean registerService(com.google.protobuf.Service instance) { public boolean registerService(com.google.protobuf.Service instance) {
/* /*
@ -3737,7 +3758,7 @@ public class HRegionServer extends Thread implements
return hMemManager; return hMemManager;
} }
MemStoreFlusher getMemStoreFlusher() { public MemStoreFlusher getMemStoreFlusher() {
return cacheFlusher; return cacheFlusher;
} }

View File

@ -65,7 +65,7 @@ import org.slf4j.LoggerFactory;
* @see FlushRequester * @see FlushRequester
*/ */
@InterfaceAudience.Private @InterfaceAudience.Private
class MemStoreFlusher implements FlushRequester { public class MemStoreFlusher implements FlushRequester {
private static final Logger LOG = LoggerFactory.getLogger(MemStoreFlusher.class); private static final Logger LOG = LoggerFactory.getLogger(MemStoreFlusher.class);
private Configuration conf; private Configuration conf;

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.hadoop.hbase.regionserver; package org.apache.hadoop.hbase.regionserver.http;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; 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.ipc.CallQueueInfo;
import org.apache.hadoop.hbase.monitoring.StateDumpServlet; import org.apache.hadoop.hbase.monitoring.StateDumpServlet;
import org.apache.hadoop.hbase.monitoring.TaskMonitor; 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.LogMonitoring;
import org.apache.hadoop.hbase.util.Threads; import org.apache.hadoop.hbase.util.Threads;
import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceAudience;
@ -70,7 +73,7 @@ public class RSDumpServlet extends StateDumpServlet {
out.println("\n\nRowLocks:"); out.println("\n\nRowLocks:");
out.println(LINE); out.println(LINE);
dumpRowLock(hrs, out); hrs.dumpRowLocks(out);
out.println("\n\nExecutors:"); out.println("\n\nExecutors:");
out.println(LINE); 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) { public static void dumpQueue(HRegionServer hrs, PrintWriter out) {
final CompactSplit compactSplit = hrs.getCompactSplitThread(); final CompactSplit compactSplit = hrs.getCompactSplitThread();
if (compactSplit != null) { if (compactSplit != null) {
@ -143,7 +130,7 @@ public class RSDumpServlet extends StateDumpServlet {
public static void dumpCallQueues(HRegionServer hrs, PrintWriter out) { 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()) { 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 count for queue: "+totalCallCount);
out.println("Total call size for queue (bytes): "+totalCallSize); 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 * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.hadoop.hbase.regionserver; package org.apache.hadoop.hbase.regionserver.http;
import java.io.IOException; import java.io.IOException;
@ -24,6 +24,7 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.tmpl.regionserver.RSStatusTmpl; import org.apache.hadoop.hbase.tmpl.regionserver.RSStatusTmpl;

View File

@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.hadoop.hbase.regionserver; package org.apache.hadoop.hbase.regionserver.http;
import java.io.IOException; import java.io.IOException;
import java.io.StringWriter; 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.MetricsHBaseServer;
import org.apache.hadoop.hbase.ipc.MetricsHBaseServerWrapperStub; import org.apache.hadoop.hbase.ipc.MetricsHBaseServerWrapperStub;
import org.apache.hadoop.hbase.ipc.RpcServerInterface; 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.RegionServerTests;
import org.apache.hadoop.hbase.testclassification.SmallTests; import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.tmpl.regionserver.RSStatusTmpl; import org.apache.hadoop.hbase.tmpl.regionserver.RSStatusTmpl;