HBASE-12683 Compilation with hadoop-2.7.0-SNAPSHOT is broken
This commit is contained in:
parent
f7f7d37ada
commit
afb753ecc3
|
@ -18,8 +18,11 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.hbase.util;
|
package org.apache.hadoop.hbase.util;
|
||||||
|
|
||||||
|
import java.io.PrintStream;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.lang.Thread.UncaughtExceptionHandler;
|
import java.lang.Thread.UncaughtExceptionHandler;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
import java.util.concurrent.ThreadFactory;
|
import java.util.concurrent.ThreadFactory;
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
@ -127,7 +130,7 @@ public class Threads {
|
||||||
while (t.isAlive()) {
|
while (t.isAlive()) {
|
||||||
t.join(60 * 1000);
|
t.join(60 * 1000);
|
||||||
if (t.isAlive()) {
|
if (t.isAlive()) {
|
||||||
ReflectionUtils.printThreadInfo(new PrintWriter(System.out),
|
printThreadInfo(System.out,
|
||||||
"Automatic Stack Trace every 60 seconds waiting on " +
|
"Automatic Stack Trace every 60 seconds waiting on " +
|
||||||
t.getName());
|
t.getName());
|
||||||
}
|
}
|
||||||
|
@ -262,4 +265,44 @@ public class Threads {
|
||||||
public static void setLoggingUncaughtExceptionHandler(Thread t) {
|
public static void setLoggingUncaughtExceptionHandler(Thread t) {
|
||||||
t.setUncaughtExceptionHandler(LOGGING_EXCEPTION_HANDLER);
|
t.setUncaughtExceptionHandler(LOGGING_EXCEPTION_HANDLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Method printThreadInfoMethod = null;
|
||||||
|
private static boolean printThreadInfoMethodWithPrintStream = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print all of the thread's information and stack traces. Wrapper around Hadoop's method.
|
||||||
|
*
|
||||||
|
* @param stream the stream to
|
||||||
|
* @param title a string title for the stack trace
|
||||||
|
*/
|
||||||
|
public static void printThreadInfo(PrintStream stream, String title) {
|
||||||
|
|
||||||
|
if (printThreadInfoMethod == null) {
|
||||||
|
try {
|
||||||
|
// Hadoop 2.7+ declares printThreadInfo(PrintStream, String)
|
||||||
|
printThreadInfoMethod = ReflectionUtils.class.getMethod("printThreadInfo",
|
||||||
|
PrintStream.class, String.class);
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
// Hadoop 2.6 and earlier declares printThreadInfo(PrintWriter, String)
|
||||||
|
printThreadInfoMethodWithPrintStream = false;
|
||||||
|
try {
|
||||||
|
printThreadInfoMethod = ReflectionUtils.class.getMethod("printThreadInfo",
|
||||||
|
PrintWriter.class, String.class);
|
||||||
|
} catch (NoSuchMethodException e1) {
|
||||||
|
throw new RuntimeException("Cannot find method. Check hadoop jars linked", e1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printThreadInfoMethod.setAccessible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (printThreadInfoMethodWithPrintStream) {
|
||||||
|
printThreadInfoMethod.invoke(null, stream, title);
|
||||||
|
} else {
|
||||||
|
printThreadInfoMethod.invoke(null, new PrintWriter(stream), title);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
||||||
|
throw new RuntimeException(e.getCause());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.http;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InterruptedIOException;
|
import java.io.InterruptedIOException;
|
||||||
|
import java.io.PrintStream;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.net.BindException;
|
import java.net.BindException;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
@ -56,6 +57,7 @@ import org.apache.hadoop.hbase.HBaseInterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.http.conf.ConfServlet;
|
import org.apache.hadoop.hbase.http.conf.ConfServlet;
|
||||||
import org.apache.hadoop.hbase.http.jmx.JMXJsonServlet;
|
import org.apache.hadoop.hbase.http.jmx.JMXJsonServlet;
|
||||||
import org.apache.hadoop.hbase.http.log.LogLevel;
|
import org.apache.hadoop.hbase.http.log.LogLevel;
|
||||||
|
import org.apache.hadoop.hbase.util.Threads;
|
||||||
import org.apache.hadoop.metrics.MetricsServlet;
|
import org.apache.hadoop.metrics.MetricsServlet;
|
||||||
import org.apache.hadoop.security.SecurityUtil;
|
import org.apache.hadoop.security.SecurityUtil;
|
||||||
import org.apache.hadoop.security.UserGroupInformation;
|
import org.apache.hadoop.security.UserGroupInformation;
|
||||||
|
@ -205,7 +207,7 @@ public class HttpServer implements FilterContainer {
|
||||||
this.hostName = hostName;
|
this.hostName = hostName;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder trustStore(String location, String password, String type) {
|
public Builder trustStore(String location, String password, String type) {
|
||||||
this.trustStore = location;
|
this.trustStore = location;
|
||||||
this.trustStorePassword = password;
|
this.trustStorePassword = password;
|
||||||
|
@ -260,37 +262,37 @@ public class HttpServer implements FilterContainer {
|
||||||
this.port = port;
|
this.port = port;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setFindPort(boolean findPort) {
|
public Builder setFindPort(boolean findPort) {
|
||||||
this.findPort = findPort;
|
this.findPort = findPort;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setConf(Configuration conf) {
|
public Builder setConf(Configuration conf) {
|
||||||
this.conf = conf;
|
this.conf = conf;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setConnector(Connector connector) {
|
public Builder setConnector(Connector connector) {
|
||||||
this.connector = connector;
|
this.connector = connector;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setPathSpec(String[] pathSpec) {
|
public Builder setPathSpec(String[] pathSpec) {
|
||||||
this.pathSpecs = pathSpec;
|
this.pathSpecs = pathSpec;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setACL(AccessControlList acl) {
|
public Builder setACL(AccessControlList acl) {
|
||||||
this.adminsAcl = acl;
|
this.adminsAcl = acl;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setSecurityEnabled(boolean securityEnabled) {
|
public Builder setSecurityEnabled(boolean securityEnabled) {
|
||||||
this.securityEnabled = securityEnabled;
|
this.securityEnabled = securityEnabled;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setUsernameConfKey(String usernameConfKey) {
|
public Builder setUsernameConfKey(String usernameConfKey) {
|
||||||
this.usernameConfKey = usernameConfKey;
|
this.usernameConfKey = usernameConfKey;
|
||||||
return this;
|
return this;
|
||||||
|
@ -335,7 +337,7 @@ public class HttpServer implements FilterContainer {
|
||||||
hostName = endpoints.size() == 0 ? connector.getHost() : endpoints.get(
|
hostName = endpoints.size() == 0 ? connector.getHost() : endpoints.get(
|
||||||
0).getHost();
|
0).getHost();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.conf == null) {
|
if (this.conf == null) {
|
||||||
conf = new Configuration();
|
conf = new Configuration();
|
||||||
}
|
}
|
||||||
|
@ -388,7 +390,7 @@ public class HttpServer implements FilterContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Same as this(name, bindAddress, port, findPort, null); */
|
/** Same as this(name, bindAddress, port, findPort, null); */
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public HttpServer(String name, String bindAddress, int port, boolean findPort
|
public HttpServer(String name, String bindAddress, int port, boolean findPort
|
||||||
|
@ -405,15 +407,15 @@ public class HttpServer implements FilterContainer {
|
||||||
/**
|
/**
|
||||||
* Create a status server on the given port. Allows you to specify the
|
* Create a status server on the given port. Allows you to specify the
|
||||||
* path specifications that this server will be serving so that they will be
|
* path specifications that this server will be serving so that they will be
|
||||||
* added to the filters properly.
|
* added to the filters properly.
|
||||||
*
|
*
|
||||||
* @param name The name of the server
|
* @param name The name of the server
|
||||||
* @param bindAddress The address for this server
|
* @param bindAddress The address for this server
|
||||||
* @param port The port to use on the server
|
* @param port The port to use on the server
|
||||||
* @param findPort whether the server should start at the given port and
|
* @param findPort whether the server should start at the given port and
|
||||||
* increment by 1 until it finds a free port.
|
* increment by 1 until it finds a free port.
|
||||||
* @param conf Configuration
|
* @param conf Configuration
|
||||||
* @param pathSpecs Path specifications that this httpserver will be serving.
|
* @param pathSpecs Path specifications that this httpserver will be serving.
|
||||||
* These will be added to any filters.
|
* These will be added to any filters.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -421,15 +423,15 @@ public class HttpServer implements FilterContainer {
|
||||||
boolean findPort, Configuration conf, String[] pathSpecs) throws IOException {
|
boolean findPort, Configuration conf, String[] pathSpecs) throws IOException {
|
||||||
this(name, bindAddress, port, findPort, conf, null, null, pathSpecs);
|
this(name, bindAddress, port, findPort, conf, null, null, pathSpecs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a status server on the given port.
|
* Create a status server on the given port.
|
||||||
* The jsp scripts are taken from src/webapps/<name>.
|
* The jsp scripts are taken from src/webapps/<name>.
|
||||||
* @param name The name of the server
|
* @param name The name of the server
|
||||||
* @param port The port to use on the server
|
* @param port The port to use on the server
|
||||||
* @param findPort whether the server should start at the given port and
|
* @param findPort whether the server should start at the given port and
|
||||||
* increment by 1 until it finds a free port.
|
* increment by 1 until it finds a free port.
|
||||||
* @param conf Configuration
|
* @param conf Configuration
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public HttpServer(String name, String bindAddress, int port,
|
public HttpServer(String name, String bindAddress, int port,
|
||||||
|
@ -439,7 +441,7 @@ public class HttpServer implements FilterContainer {
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public HttpServer(String name, String bindAddress, int port,
|
public HttpServer(String name, String bindAddress, int port,
|
||||||
boolean findPort, Configuration conf, AccessControlList adminsAcl)
|
boolean findPort, Configuration conf, AccessControlList adminsAcl)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
this(name, bindAddress, port, findPort, conf, adminsAcl, null, null);
|
this(name, bindAddress, port, findPort, conf, adminsAcl, null, null);
|
||||||
}
|
}
|
||||||
|
@ -450,15 +452,15 @@ public class HttpServer implements FilterContainer {
|
||||||
* @param name The name of the server
|
* @param name The name of the server
|
||||||
* @param bindAddress The address for this server
|
* @param bindAddress The address for this server
|
||||||
* @param port The port to use on the server
|
* @param port The port to use on the server
|
||||||
* @param findPort whether the server should start at the given port and
|
* @param findPort whether the server should start at the given port and
|
||||||
* increment by 1 until it finds a free port.
|
* increment by 1 until it finds a free port.
|
||||||
* @param conf Configuration
|
* @param conf Configuration
|
||||||
* @param adminsAcl {@link AccessControlList} of the admins
|
* @param adminsAcl {@link AccessControlList} of the admins
|
||||||
* @param connector The jetty {@link Connector} to use
|
* @param connector The jetty {@link Connector} to use
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public HttpServer(String name, String bindAddress, int port,
|
public HttpServer(String name, String bindAddress, int port,
|
||||||
boolean findPort, Configuration conf, AccessControlList adminsAcl,
|
boolean findPort, Configuration conf, AccessControlList adminsAcl,
|
||||||
Connector connector) throws IOException {
|
Connector connector) throws IOException {
|
||||||
this(name, bindAddress, port, findPort, conf, adminsAcl, connector, null);
|
this(name, bindAddress, port, findPort, conf, adminsAcl, connector, null);
|
||||||
}
|
}
|
||||||
|
@ -469,17 +471,17 @@ public class HttpServer implements FilterContainer {
|
||||||
* @param name The name of the server
|
* @param name The name of the server
|
||||||
* @param bindAddress The address for this server
|
* @param bindAddress The address for this server
|
||||||
* @param port The port to use on the server
|
* @param port The port to use on the server
|
||||||
* @param findPort whether the server should start at the given port and
|
* @param findPort whether the server should start at the given port and
|
||||||
* increment by 1 until it finds a free port.
|
* increment by 1 until it finds a free port.
|
||||||
* @param conf Configuration
|
* @param conf Configuration
|
||||||
* @param adminsAcl {@link AccessControlList} of the admins
|
* @param adminsAcl {@link AccessControlList} of the admins
|
||||||
* @param connector A jetty connection listener
|
* @param connector A jetty connection listener
|
||||||
* @param pathSpecs Path specifications that this httpserver will be serving.
|
* @param pathSpecs Path specifications that this httpserver will be serving.
|
||||||
* These will be added to any filters.
|
* These will be added to any filters.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public HttpServer(String name, String bindAddress, int port,
|
public HttpServer(String name, String bindAddress, int port,
|
||||||
boolean findPort, Configuration conf, AccessControlList adminsAcl,
|
boolean findPort, Configuration conf, AccessControlList adminsAcl,
|
||||||
Connector connector, String[] pathSpecs) throws IOException {
|
Connector connector, String[] pathSpecs) throws IOException {
|
||||||
this(new Builder().setName(name)
|
this(new Builder().setName(name)
|
||||||
.addEndpoint(URI.create("http://" + bindAddress + ":" + port))
|
.addEndpoint(URI.create("http://" + bindAddress + ":" + port))
|
||||||
|
@ -584,7 +586,7 @@ public class HttpServer implements FilterContainer {
|
||||||
public Connector createBaseListener(Configuration conf) throws IOException {
|
public Connector createBaseListener(Configuration conf) throws IOException {
|
||||||
return HttpServer.createDefaultChannelConnector();
|
return HttpServer.createDefaultChannelConnector();
|
||||||
}
|
}
|
||||||
|
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
public static Connector createDefaultChannelConnector() {
|
public static Connector createDefaultChannelConnector() {
|
||||||
SelectChannelConnector ret = new SelectChannelConnector();
|
SelectChannelConnector ret = new SelectChannelConnector();
|
||||||
|
@ -595,7 +597,7 @@ public class HttpServer implements FilterContainer {
|
||||||
if(Shell.WINDOWS) {
|
if(Shell.WINDOWS) {
|
||||||
// result of setting the SO_REUSEADDR flag is different on Windows
|
// result of setting the SO_REUSEADDR flag is different on Windows
|
||||||
// http://msdn.microsoft.com/en-us/library/ms740621(v=vs.85).aspx
|
// http://msdn.microsoft.com/en-us/library/ms740621(v=vs.85).aspx
|
||||||
// without this 2 NN's can start on the same machine and listen on
|
// without this 2 NN's can start on the same machine and listen on
|
||||||
// the same port with indeterminate routing of incoming requests to them
|
// the same port with indeterminate routing of incoming requests to them
|
||||||
ret.setReuseAddress(false);
|
ret.setReuseAddress(false);
|
||||||
}
|
}
|
||||||
|
@ -629,7 +631,7 @@ public class HttpServer implements FilterContainer {
|
||||||
*/
|
*/
|
||||||
protected void addDefaultApps(ContextHandlerCollection parent,
|
protected void addDefaultApps(ContextHandlerCollection parent,
|
||||||
final String appDir, Configuration conf) throws IOException {
|
final String appDir, Configuration conf) throws IOException {
|
||||||
// set up the context for "/logs/" if "hadoop.log.dir" property is defined.
|
// set up the context for "/logs/" if "hadoop.log.dir" property is defined.
|
||||||
String logDir = this.logDir;
|
String logDir = this.logDir;
|
||||||
if (logDir == null) {
|
if (logDir == null) {
|
||||||
logDir = System.getProperty("hadoop.log.dir");
|
logDir = System.getProperty("hadoop.log.dir");
|
||||||
|
@ -659,7 +661,7 @@ public class HttpServer implements FilterContainer {
|
||||||
setContextAttributes(staticContext, conf);
|
setContextAttributes(staticContext, conf);
|
||||||
defaultContexts.put(staticContext, true);
|
defaultContexts.put(staticContext, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setContextAttributes(Context context, Configuration conf) {
|
private void setContextAttributes(Context context, Configuration conf) {
|
||||||
context.getServletContext().setAttribute(CONF_CONTEXT_ATTRIBUTE, conf);
|
context.getServletContext().setAttribute(CONF_CONTEXT_ATTRIBUTE, conf);
|
||||||
context.getServletContext().setAttribute(ADMINS_ACL, adminsAcl);
|
context.getServletContext().setAttribute(ADMINS_ACL, adminsAcl);
|
||||||
|
@ -685,10 +687,10 @@ public class HttpServer implements FilterContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a context
|
* Add a context
|
||||||
* @param pathSpec The path spec for the context
|
* @param pathSpec The path spec for the context
|
||||||
* @param dir The directory containing the context
|
* @param dir The directory containing the context
|
||||||
* @param isFiltered if true, the servlet is added to the filter path mapping
|
* @param isFiltered if true, the servlet is added to the filter path mapping
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
protected void addContext(String pathSpec, String dir, boolean isFiltered) throws IOException {
|
protected void addContext(String pathSpec, String dir, boolean isFiltered) throws IOException {
|
||||||
|
@ -711,7 +713,7 @@ public class HttpServer implements FilterContainer {
|
||||||
webAppContext.setAttribute(name, value);
|
webAppContext.setAttribute(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a Jersey resource package.
|
* Add a Jersey resource package.
|
||||||
* @param packageName The Java package name containing the Jersey resource.
|
* @param packageName The Java package name containing the Jersey resource.
|
||||||
* @param pathSpec The path spec for the servlet
|
* @param pathSpec The path spec for the servlet
|
||||||
|
@ -740,11 +742,11 @@ public class HttpServer implements FilterContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an internal servlet in the server.
|
* Add an internal servlet in the server.
|
||||||
* Note: This method is to be used for adding servlets that facilitate
|
* Note: This method is to be used for adding servlets that facilitate
|
||||||
* internal communication and not for user facing functionality. For
|
* internal communication and not for user facing functionality. For
|
||||||
* servlets added using this method, filters are not enabled.
|
* servlets added using this method, filters are not enabled.
|
||||||
*
|
*
|
||||||
* @param name The name of the servlet (can be passed as null)
|
* @param name The name of the servlet (can be passed as null)
|
||||||
* @param pathSpec The path spec for the servlet
|
* @param pathSpec The path spec for the servlet
|
||||||
* @param clazz The servlet class
|
* @param clazz The servlet class
|
||||||
|
@ -756,18 +758,18 @@ public class HttpServer implements FilterContainer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an internal servlet in the server, specifying whether or not to
|
* Add an internal servlet in the server, specifying whether or not to
|
||||||
* protect with Kerberos authentication.
|
* protect with Kerberos authentication.
|
||||||
* Note: This method is to be used for adding servlets that facilitate
|
* Note: This method is to be used for adding servlets that facilitate
|
||||||
* internal communication and not for user facing functionality. For
|
* internal communication and not for user facing functionality. For
|
||||||
+ * servlets added using this method, filters (except internal Kerberos
|
+ * servlets added using this method, filters (except internal Kerberos
|
||||||
* filters) are not enabled.
|
* filters) are not enabled.
|
||||||
*
|
*
|
||||||
* @param name The name of the servlet (can be passed as null)
|
* @param name The name of the servlet (can be passed as null)
|
||||||
* @param pathSpec The path spec for the servlet
|
* @param pathSpec The path spec for the servlet
|
||||||
* @param clazz The servlet class
|
* @param clazz The servlet class
|
||||||
* @param requireAuth Require Kerberos authenticate to access servlet
|
* @param requireAuth Require Kerberos authenticate to access servlet
|
||||||
*/
|
*/
|
||||||
public void addInternalServlet(String name, String pathSpec,
|
public void addInternalServlet(String name, String pathSpec,
|
||||||
Class<? extends HttpServlet> clazz, boolean requireAuth) {
|
Class<? extends HttpServlet> clazz, boolean requireAuth) {
|
||||||
ServletHolder holder = new ServletHolder(clazz);
|
ServletHolder holder = new ServletHolder(clazz);
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
|
@ -851,7 +853,7 @@ public class HttpServer implements FilterContainer {
|
||||||
handler.addFilterMapping(fmap);
|
handler.addFilterMapping(fmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value in the webapp context.
|
* Get the value in the webapp context.
|
||||||
* @param name The name of the attribute
|
* @param name The name of the attribute
|
||||||
|
@ -860,7 +862,7 @@ public class HttpServer implements FilterContainer {
|
||||||
public Object getAttribute(String name) {
|
public Object getAttribute(String name) {
|
||||||
return webAppContext.getAttribute(name);
|
return webAppContext.getAttribute(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WebAppContext getWebAppContext(){
|
public WebAppContext getWebAppContext(){
|
||||||
return this.webAppContext;
|
return this.webAppContext;
|
||||||
}
|
}
|
||||||
|
@ -877,7 +879,7 @@ public class HttpServer implements FilterContainer {
|
||||||
*/
|
*/
|
||||||
protected String getWebAppsPath(String webapps, String appName) throws FileNotFoundException {
|
protected String getWebAppsPath(String webapps, String appName) throws FileNotFoundException {
|
||||||
URL url = getClass().getClassLoader().getResource(webapps + "/" + appName);
|
URL url = getClass().getClassLoader().getResource(webapps + "/" + appName);
|
||||||
if (url == null)
|
if (url == null)
|
||||||
throw new FileNotFoundException(webapps + "/" + appName
|
throw new FileNotFoundException(webapps + "/" + appName
|
||||||
+ " not found in CLASSPATH");
|
+ " not found in CLASSPATH");
|
||||||
String urlString = url.toString();
|
String urlString = url.toString();
|
||||||
|
@ -935,7 +937,7 @@ public class HttpServer implements FilterContainer {
|
||||||
params.put("kerberos.keytab", httpKeytab);
|
params.put("kerberos.keytab", httpKeytab);
|
||||||
}
|
}
|
||||||
params.put(AuthenticationFilter.AUTH_TYPE, "kerberos");
|
params.put(AuthenticationFilter.AUTH_TYPE, "kerberos");
|
||||||
|
|
||||||
defineFilter(webAppContext, SPNEGO_FILTER,
|
defineFilter(webAppContext, SPNEGO_FILTER,
|
||||||
AuthenticationFilter.class.getName(), params, null);
|
AuthenticationFilter.class.getName(), params, null);
|
||||||
}
|
}
|
||||||
|
@ -1022,7 +1024,7 @@ public class HttpServer implements FilterContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stop the server
|
* stop the server
|
||||||
*/
|
*/
|
||||||
|
@ -1140,7 +1142,7 @@ public class HttpServer implements FilterContainer {
|
||||||
/**
|
/**
|
||||||
* Does the user sending the HttpServletRequest has the administrator ACLs? If
|
* Does the user sending the HttpServletRequest has the administrator ACLs? If
|
||||||
* it isn't the case, response will be modified to send an error to the user.
|
* it isn't the case, response will be modified to send an error to the user.
|
||||||
*
|
*
|
||||||
* @param servletContext
|
* @param servletContext
|
||||||
* @param request
|
* @param request
|
||||||
* @param response used to send the error response if user does not have admin access.
|
* @param response used to send the error response if user does not have admin access.
|
||||||
|
@ -1165,7 +1167,7 @@ public class HttpServer implements FilterContainer {
|
||||||
"authorized to access this page.");
|
"authorized to access this page.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (servletContext.getAttribute(ADMINS_ACL) != null &&
|
if (servletContext.getAttribute(ADMINS_ACL) != null &&
|
||||||
!userHasAdministratorAccess(servletContext, remoteUser)) {
|
!userHasAdministratorAccess(servletContext, remoteUser)) {
|
||||||
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "User "
|
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "User "
|
||||||
|
@ -1179,7 +1181,7 @@ public class HttpServer implements FilterContainer {
|
||||||
/**
|
/**
|
||||||
* Get the admin ACLs from the given ServletContext and check if the given
|
* Get the admin ACLs from the given ServletContext and check if the given
|
||||||
* user is in the ACL.
|
* user is in the ACL.
|
||||||
*
|
*
|
||||||
* @param servletContext the context containing the admin ACL.
|
* @param servletContext the context containing the admin ACL.
|
||||||
* @param remoteUser the remote user to check for.
|
* @param remoteUser the remote user to check for.
|
||||||
* @return true if the user is present in the ACL, false if no ACL is set or
|
* @return true if the user is present in the ACL, false if no ACL is set or
|
||||||
|
@ -1212,12 +1214,14 @@ public class HttpServer implements FilterContainer {
|
||||||
}
|
}
|
||||||
response.setContentType("text/plain; charset=UTF-8");
|
response.setContentType("text/plain; charset=UTF-8");
|
||||||
PrintWriter out = response.getWriter();
|
PrintWriter out = response.getWriter();
|
||||||
ReflectionUtils.printThreadInfo(out, "");
|
PrintStream ps = new PrintStream(response.getOutputStream(), false, "UTF-8");
|
||||||
|
Threads.printThreadInfo(ps, "");
|
||||||
|
ps.flush();
|
||||||
out.close();
|
out.close();
|
||||||
ReflectionUtils.logThreadInfo(LOG, "jsp requested", 1);
|
ReflectionUtils.logThreadInfo(LOG, "jsp requested", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Servlet input filter that quotes all HTML active characters in the
|
* A Servlet input filter that quotes all HTML active characters in the
|
||||||
* parameter names and values. The goal is to quote the characters to make
|
* parameter names and values. The goal is to quote the characters to make
|
||||||
|
@ -1233,7 +1237,7 @@ public class HttpServer implements FilterContainer {
|
||||||
super(rawRequest);
|
super(rawRequest);
|
||||||
this.rawRequest = rawRequest;
|
this.rawRequest = rawRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the set of parameter names, quoting each name.
|
* Return the set of parameter names, quoting each name.
|
||||||
*/
|
*/
|
||||||
|
@ -1254,7 +1258,7 @@ public class HttpServer implements FilterContainer {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unquote the name and quote the value.
|
* Unquote the name and quote the value.
|
||||||
*/
|
*/
|
||||||
|
@ -1263,7 +1267,7 @@ public class HttpServer implements FilterContainer {
|
||||||
return HtmlQuoting.quoteHtmlChars(rawRequest.getParameter
|
return HtmlQuoting.quoteHtmlChars(rawRequest.getParameter
|
||||||
(HtmlQuoting.unquoteHtmlChars(name)));
|
(HtmlQuoting.unquoteHtmlChars(name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getParameterValues(String name) {
|
public String[] getParameterValues(String name) {
|
||||||
String unquoteName = HtmlQuoting.unquoteHtmlChars(name);
|
String unquoteName = HtmlQuoting.unquoteHtmlChars(name);
|
||||||
|
@ -1293,7 +1297,7 @@ public class HttpServer implements FilterContainer {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Quote the url so that users specifying the HOST HTTP header
|
* Quote the url so that users specifying the HOST HTTP header
|
||||||
* can't inject attacks.
|
* can't inject attacks.
|
||||||
|
@ -1303,7 +1307,7 @@ public class HttpServer implements FilterContainer {
|
||||||
String url = rawRequest.getRequestURL().toString();
|
String url = rawRequest.getRequestURL().toString();
|
||||||
return new StringBuffer(HtmlQuoting.quoteHtmlChars(url));
|
return new StringBuffer(HtmlQuoting.quoteHtmlChars(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Quote the server name so that users specifying the HOST HTTP header
|
* Quote the server name so that users specifying the HOST HTTP header
|
||||||
* can't inject attacks.
|
* can't inject attacks.
|
||||||
|
@ -1324,11 +1328,11 @@ public class HttpServer implements FilterContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doFilter(ServletRequest request,
|
public void doFilter(ServletRequest request,
|
||||||
ServletResponse response,
|
ServletResponse response,
|
||||||
FilterChain chain
|
FilterChain chain
|
||||||
) throws IOException, ServletException {
|
) throws IOException, ServletException {
|
||||||
HttpServletRequestWrapper quoted =
|
HttpServletRequestWrapper quoted =
|
||||||
new RequestQuoter((HttpServletRequest) request);
|
new RequestQuoter((HttpServletRequest) request);
|
||||||
HttpServletResponse httpResponse = (HttpServletResponse) response;
|
HttpServletResponse httpResponse = (HttpServletResponse) response;
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.master;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.io.PrintStream;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -35,14 +36,14 @@ import org.apache.hadoop.hbase.monitoring.LogMonitoring;
|
||||||
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.RSDumpServlet;
|
||||||
import org.apache.hadoop.util.ReflectionUtils;
|
import org.apache.hadoop.hbase.util.Threads;
|
||||||
|
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
public class MasterDumpServlet extends StateDumpServlet {
|
public class MasterDumpServlet extends StateDumpServlet {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private static final String LINE =
|
private static final String LINE =
|
||||||
"===========================================================";
|
"===========================================================";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
@ -52,10 +53,10 @@ public class MasterDumpServlet extends StateDumpServlet {
|
||||||
response.setContentType("text/plain");
|
response.setContentType("text/plain");
|
||||||
OutputStream os = response.getOutputStream();
|
OutputStream os = response.getOutputStream();
|
||||||
PrintWriter out = new PrintWriter(os);
|
PrintWriter out = new PrintWriter(os);
|
||||||
|
|
||||||
out.println("Master status for " + master.getServerName()
|
out.println("Master status for " + master.getServerName()
|
||||||
+ " as of " + new Date());
|
+ " as of " + new Date());
|
||||||
|
|
||||||
out.println("\n\nVersion Info:");
|
out.println("\n\nVersion Info:");
|
||||||
out.println(LINE);
|
out.println(LINE);
|
||||||
dumpVersionInfo(out);
|
dumpVersionInfo(out);
|
||||||
|
@ -63,34 +64,36 @@ public class MasterDumpServlet extends StateDumpServlet {
|
||||||
out.println("\n\nTasks:");
|
out.println("\n\nTasks:");
|
||||||
out.println(LINE);
|
out.println(LINE);
|
||||||
TaskMonitor.get().dumpAsText(out);
|
TaskMonitor.get().dumpAsText(out);
|
||||||
|
|
||||||
out.println("\n\nServers:");
|
out.println("\n\nServers:");
|
||||||
out.println(LINE);
|
out.println(LINE);
|
||||||
dumpServers(master, out);
|
dumpServers(master, out);
|
||||||
|
|
||||||
out.println("\n\nRegions-in-transition:");
|
out.println("\n\nRegions-in-transition:");
|
||||||
out.println(LINE);
|
out.println(LINE);
|
||||||
dumpRIT(master, out);
|
dumpRIT(master, out);
|
||||||
|
|
||||||
out.println("\n\nExecutors:");
|
out.println("\n\nExecutors:");
|
||||||
out.println(LINE);
|
out.println(LINE);
|
||||||
dumpExecutors(master.getExecutorService(), out);
|
dumpExecutors(master.getExecutorService(), out);
|
||||||
|
|
||||||
out.println("\n\nStacks:");
|
out.println("\n\nStacks:");
|
||||||
out.println(LINE);
|
out.println(LINE);
|
||||||
ReflectionUtils.printThreadInfo(out, "");
|
PrintStream ps = new PrintStream(response.getOutputStream(), false, "UTF-8");
|
||||||
|
Threads.printThreadInfo(ps, "");
|
||||||
|
ps.flush();
|
||||||
|
|
||||||
out.println("\n\nMaster configuration:");
|
out.println("\n\nMaster configuration:");
|
||||||
out.println(LINE);
|
out.println(LINE);
|
||||||
Configuration conf = master.getConfiguration();
|
Configuration conf = master.getConfiguration();
|
||||||
out.flush();
|
out.flush();
|
||||||
conf.writeXml(os);
|
conf.writeXml(os);
|
||||||
os.flush();
|
os.flush();
|
||||||
|
|
||||||
out.println("\n\nRecent regionserver aborts:");
|
out.println("\n\nRecent regionserver aborts:");
|
||||||
out.println(LINE);
|
out.println(LINE);
|
||||||
master.getRegionServerFatalLogBuffer().dumpTo(out);
|
master.getRegionServerFatalLogBuffer().dumpTo(out);
|
||||||
|
|
||||||
out.println("\n\nLogs");
|
out.println("\n\nLogs");
|
||||||
out.println(LINE);
|
out.println(LINE);
|
||||||
long tailKb = getTailKbParam(request);
|
long tailKb = getTailKbParam(request);
|
||||||
|
@ -103,7 +106,7 @@ public class MasterDumpServlet extends StateDumpServlet {
|
||||||
}
|
}
|
||||||
out.flush();
|
out.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void dumpRIT(HMaster master, PrintWriter out) {
|
private void dumpRIT(HMaster master, PrintWriter out) {
|
||||||
AssignmentManager am = master.getAssignmentManager();
|
AssignmentManager am = master.getAssignmentManager();
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.regionserver;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.io.PrintStream;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@ -31,14 +32,14 @@ import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.hbase.monitoring.LogMonitoring;
|
import org.apache.hadoop.hbase.monitoring.LogMonitoring;
|
||||||
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.util.ReflectionUtils;
|
import org.apache.hadoop.hbase.util.Threads;
|
||||||
|
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
public class RSDumpServlet extends StateDumpServlet {
|
public class RSDumpServlet extends StateDumpServlet {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private static final String LINE =
|
private static final String LINE =
|
||||||
"===========================================================";
|
"===========================================================";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
@ -47,7 +48,7 @@ public class RSDumpServlet extends StateDumpServlet {
|
||||||
assert hrs != null : "No RS in context!";
|
assert hrs != null : "No RS in context!";
|
||||||
|
|
||||||
response.setContentType("text/plain");
|
response.setContentType("text/plain");
|
||||||
|
|
||||||
if (!hrs.isOnline()) {
|
if (!hrs.isOnline()) {
|
||||||
response.getWriter().write("The RegionServer is initializing!");
|
response.getWriter().write("The RegionServer is initializing!");
|
||||||
response.getWriter().close();
|
response.getWriter().close();
|
||||||
|
@ -56,10 +57,10 @@ public class RSDumpServlet extends StateDumpServlet {
|
||||||
|
|
||||||
OutputStream os = response.getOutputStream();
|
OutputStream os = response.getOutputStream();
|
||||||
PrintWriter out = new PrintWriter(os);
|
PrintWriter out = new PrintWriter(os);
|
||||||
|
|
||||||
out.println("RegionServer status for " + hrs.getServerName()
|
out.println("RegionServer status for " + hrs.getServerName()
|
||||||
+ " as of " + new Date());
|
+ " as of " + new Date());
|
||||||
|
|
||||||
out.println("\n\nVersion Info:");
|
out.println("\n\nVersion Info:");
|
||||||
out.println(LINE);
|
out.println(LINE);
|
||||||
dumpVersionInfo(out);
|
dumpVersionInfo(out);
|
||||||
|
@ -67,40 +68,42 @@ public class RSDumpServlet extends StateDumpServlet {
|
||||||
out.println("\n\nTasks:");
|
out.println("\n\nTasks:");
|
||||||
out.println(LINE);
|
out.println(LINE);
|
||||||
TaskMonitor.get().dumpAsText(out);
|
TaskMonitor.get().dumpAsText(out);
|
||||||
|
|
||||||
out.println("\n\nExecutors:");
|
out.println("\n\nExecutors:");
|
||||||
out.println(LINE);
|
out.println(LINE);
|
||||||
dumpExecutors(hrs.getExecutorService(), out);
|
dumpExecutors(hrs.getExecutorService(), out);
|
||||||
|
|
||||||
out.println("\n\nStacks:");
|
out.println("\n\nStacks:");
|
||||||
out.println(LINE);
|
out.println(LINE);
|
||||||
ReflectionUtils.printThreadInfo(out, "");
|
PrintStream ps = new PrintStream(response.getOutputStream(), false, "UTF-8");
|
||||||
|
Threads.printThreadInfo(ps, "");
|
||||||
|
ps.flush();
|
||||||
|
|
||||||
out.println("\n\nRS Configuration:");
|
out.println("\n\nRS Configuration:");
|
||||||
out.println(LINE);
|
out.println(LINE);
|
||||||
Configuration conf = hrs.getConfiguration();
|
Configuration conf = hrs.getConfiguration();
|
||||||
out.flush();
|
out.flush();
|
||||||
conf.writeXml(os);
|
conf.writeXml(os);
|
||||||
os.flush();
|
os.flush();
|
||||||
|
|
||||||
out.println("\n\nLogs");
|
out.println("\n\nLogs");
|
||||||
out.println(LINE);
|
out.println(LINE);
|
||||||
long tailKb = getTailKbParam(request);
|
long tailKb = getTailKbParam(request);
|
||||||
LogMonitoring.dumpTailOfLogs(out, tailKb);
|
LogMonitoring.dumpTailOfLogs(out, tailKb);
|
||||||
|
|
||||||
out.println("\n\nRS Queue:");
|
out.println("\n\nRS Queue:");
|
||||||
out.println(LINE);
|
out.println(LINE);
|
||||||
if(isShowQueueDump(conf)) {
|
if(isShowQueueDump(conf)) {
|
||||||
dumpQueue(hrs, out);
|
dumpQueue(hrs, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
out.flush();
|
out.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void dumpQueue(HRegionServer hrs, PrintWriter out)
|
public static void dumpQueue(HRegionServer hrs, PrintWriter out)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
// 1. Print out Compaction/Split Queue
|
// 1. Print out Compaction/Split Queue
|
||||||
out.println("Compaction/Split Queue summary: "
|
out.println("Compaction/Split Queue summary: "
|
||||||
+ hrs.compactSplitThread.toString() );
|
+ hrs.compactSplitThread.toString() );
|
||||||
out.println(hrs.compactSplitThread.dumpQueue());
|
out.println(hrs.compactSplitThread.dumpQueue());
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ package org.apache.hadoop.hbase.util;
|
||||||
|
|
||||||
import java.io.InterruptedIOException;
|
import java.io.InterruptedIOException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -32,7 +31,6 @@ import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.hbase.CoordinatedStateManager;
|
import org.apache.hadoop.hbase.CoordinatedStateManager;
|
||||||
import org.apache.hadoop.hbase.master.HMaster;
|
import org.apache.hadoop.hbase.master.HMaster;
|
||||||
import org.apache.hadoop.hbase.regionserver.HRegionServer;
|
import org.apache.hadoop.hbase.regionserver.HRegionServer;
|
||||||
import org.apache.hadoop.util.ReflectionUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility used running a cluster all in the one JVM.
|
* Utility used running a cluster all in the one JVM.
|
||||||
|
@ -86,7 +84,7 @@ public class JVMClusterUtil {
|
||||||
throws IOException {
|
throws IOException {
|
||||||
HRegionServer server;
|
HRegionServer server;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
Constructor<? extends HRegionServer> ctor = hrsc.getConstructor(Configuration.class,
|
Constructor<? extends HRegionServer> ctor = hrsc.getConstructor(Configuration.class,
|
||||||
CoordinatedStateManager.class);
|
CoordinatedStateManager.class);
|
||||||
ctor.setAccessible(true);
|
ctor.setAccessible(true);
|
||||||
|
@ -222,7 +220,7 @@ public class JVMClusterUtil {
|
||||||
}
|
}
|
||||||
if (System.currentTimeMillis() > startTime + maxwait) {
|
if (System.currentTimeMillis() > startTime + maxwait) {
|
||||||
String msg = "Master not initialized after " + maxwait + "ms seconds";
|
String msg = "Master not initialized after " + maxwait + "ms seconds";
|
||||||
ReflectionUtils.printThreadInfo(new PrintWriter(System.out),
|
Threads.printThreadInfo(System.out,
|
||||||
"Thread dump because: " + msg);
|
"Thread dump because: " + msg);
|
||||||
throw new RuntimeException(msg);
|
throw new RuntimeException(msg);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue