@InterfaceAudience.Private public abstract class RpcServer extends Object implements RpcServerInterface, ConfigurationObserver
| Modifier and Type | Class and Description |
|---|---|
static class |
RpcServer.BlockingServiceAndInterface
Datastructure for passing a
BlockingService and its associated class of protobuf
service interface. |
protected static interface |
RpcServer.CallCleanup |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
allowFallbackToSimpleAuth |
protected static org.slf4j.Logger |
AUDITLOG |
protected static String |
AUTH_FAILED_FOR |
protected static String |
AUTH_SUCCESSFUL_FOR |
protected org.apache.hadoop.security.authorize.ServiceAuthorizationManager |
authManager |
protected AuthenticationTokenSecretManager |
authTokenSecretMgr |
protected ByteBuffAllocator |
bbAllocator |
protected InetSocketAddress |
bindAddress |
protected static CallQueueTooBigException |
CALL_QUEUE_TOO_BIG_EXCEPTION |
protected LongAdder |
callQueueSizeInBytes
This is a running count of the size in bytes of all outstanding calls whether currently
executing or queued waiting to be run.
|
protected org.apache.hadoop.hbase.ipc.CellBlockBuilder |
cellBlockBuilder |
protected org.apache.hadoop.conf.Configuration |
conf |
protected static ThreadLocal<RpcCall> |
CurCall
This is set to Call object before Handler invokes an RPC and ybdie after the call returns.
|
static byte |
CURRENT_VERSION |
protected static int |
DEFAULT_MAX_CALLQUEUE_LENGTH_PER_HANDLER
How many calls/handler are allowed in the queue.
|
protected static int |
DEFAULT_MAX_CALLQUEUE_SIZE |
static int |
DEFAULT_MAX_REQUEST_SIZE
Default value for above params
|
protected static int |
DEFAULT_MIN_CLIENT_REQUEST_TIMEOUT |
protected static int |
DEFAULT_TRACE_LOG_MAX_LENGTH |
protected static int |
DEFAULT_WARN_RESPONSE_SIZE |
protected static int |
DEFAULT_WARN_RESPONSE_TIME |
protected HBaseRPCErrorHandler |
errorHandler |
static String |
FALLBACK_TO_INSECURE_CLIENT_AUTH
Whether we allow a fallback to SIMPLE auth for insecure clients when security is enabled.
|
protected static org.apache.hbase.thirdparty.com.google.gson.Gson |
GSON |
protected boolean |
isSecurityEnabled |
protected static String |
KEY_WORD_TRUNCATED |
static org.slf4j.Logger |
LOG |
static String |
MAX_REQUEST_SIZE |
protected long |
maxQueueSizeInBytes
Maximum size in bytes of the currently queued and running Calls.
|
protected int |
maxRequestSize |
protected MetricsHBaseServer |
metrics |
protected static String |
MIN_CLIENT_REQUEST_TIMEOUT
Minimum allowable timeout (in milliseconds) in rpc request's header.
|
protected int |
minClientRequestTimeout |
protected static ThreadLocal<MonitoredRPCHandler> |
MONITORED_RPC
Keeps MonitoredRPCHandler per handler thread.
|
protected static int |
NIO_BUFFER_LIMIT
When the read or write buffer size is larger than this limit, i/o will be done in chunks of
this size.
|
protected Map<String,String> |
saslProps |
protected RpcScheduler |
scheduler |
protected org.apache.hadoop.security.token.SecretManager<org.apache.hadoop.security.token.TokenIdentifier> |
secretManager |
protected Server |
server |
protected List<RpcServer.BlockingServiceAndInterface> |
services |
protected boolean |
tcpKeepAlive |
protected boolean |
tcpNoDelay |
protected static String |
TRACE_LOG_MAX_LENGTH |
protected UserProvider |
userProvider |
protected static String |
WARN_RESPONSE_SIZE |
protected static String |
WARN_RESPONSE_TIME |
protected int |
warnResponseSize |
protected int |
warnResponseTime |
| Constructor and Description |
|---|
RpcServer(Server server,
String name,
List<RpcServer.BlockingServiceAndInterface> services,
InetSocketAddress bindAddress,
org.apache.hadoop.conf.Configuration conf,
RpcScheduler scheduler,
boolean reservoirEnabled)
Constructs a server listening on the named port and address.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCallSize(long diff)
Add/subtract from the current size of all outstanding calls.
|
void |
authorize(org.apache.hadoop.security.UserGroupInformation user,
org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.ConnectionHeader connection,
InetAddress addr)
Authorize the incoming client connection.
|
Pair<org.apache.hbase.thirdparty.com.google.protobuf.Message,CellScanner> |
call(RpcCall call,
MonitoredRPCHandler status)
This is a server side method, which is invoked over RPC.
|
protected int |
channelRead(ReadableByteChannel channel,
ByteBuffer buffer)
This is a wrapper around
ReadableByteChannel.read(java.nio.ByteBuffer). |
protected AuthenticationTokenSecretManager |
createSecretManager() |
ByteBuffAllocator |
getByteBuffAllocator()
Allocator to allocate/free the ByteBuffers, those ByteBuffers can be on-heap or off-heap.
|
static Optional<RpcCall> |
getCurrentCall()
Needed for features such as delayed calls.
|
HBaseRPCErrorHandler |
getErrorHandler() |
MetricsHBaseServer |
getMetrics()
Returns the metrics instance for reporting RPC call statistics
|
abstract int |
getNumOpenConnections()
The number of open RPC conections
|
static Optional<InetAddress> |
getRemoteAddress()
Returns Address of remote client if a request is ongoing, else null
|
static InetAddress |
getRemoteIp()
Returns the remote side ip address when invoked inside an RPC Returns null incase of an error.
|
static Optional<User> |
getRequestUser()
Returns the user credentials associated with the current RPC request or not present if no
credentials were provided.
|
static Optional<String> |
getRequestUserName()
Returns the username for any user associated with the current RPC request or not present if no
user is set.
|
RpcScheduler |
getScheduler() |
org.apache.hadoop.security.token.SecretManager<? extends org.apache.hadoop.security.token.TokenIdentifier> |
getSecretManager() |
protected static org.apache.hbase.thirdparty.com.google.protobuf.BlockingService |
getService(List<RpcServer.BlockingServiceAndInterface> services,
String serviceName) |
protected static RpcServer.BlockingServiceAndInterface |
getServiceAndInterface(List<RpcServer.BlockingServiceAndInterface> services,
String serviceName) |
protected static Class<?> |
getServiceInterface(List<RpcServer.BlockingServiceAndInterface> services,
String serviceName) |
protected static MonitoredRPCHandler |
getStatus() |
protected void |
initReconfigurable(org.apache.hadoop.conf.Configuration confToLoad) |
static boolean |
isInRpcCallContext() |
boolean |
isStarted() |
protected boolean |
needAuthorization() |
void |
onConfigurationChange(org.apache.hadoop.conf.Configuration newConf) |
void |
refreshAuthManager(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.security.authorize.PolicyProvider pp)
Refresh authentication manager policy.
|
static void |
setCurrentCall(RpcCall rpcCall)
Used by
RegionProcedureStore. |
void |
setErrorHandler(HBaseRPCErrorHandler handler)
Set the handler for calling out of RPC for error conditions.
|
void |
setNamedQueueRecorder(NamedQueueRecorder namedQueueRecorder)
Set Online SlowLog Provider
|
void |
setRsRpcServices(RSRpcServices rsRpcServices) |
void |
setSecretManager(org.apache.hadoop.security.token.SecretManager<? extends org.apache.hadoop.security.token.TokenIdentifier> secretManager) |
static Optional<RpcCall> |
unsetCurrentCall()
Used by
RegionProcedureStore. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcall, call, getListenerAddress, join, setSocketSendBufSize, start, stoppublic static final org.slf4j.Logger LOG
protected static final CallQueueTooBigException CALL_QUEUE_TOO_BIG_EXCEPTION
protected boolean isSecurityEnabled
public static final byte CURRENT_VERSION
public static final String FALLBACK_TO_INSECURE_CLIENT_AUTH
protected static final int DEFAULT_MAX_CALLQUEUE_LENGTH_PER_HANDLER
protected final org.apache.hadoop.hbase.ipc.CellBlockBuilder cellBlockBuilder
protected static final String AUTH_FAILED_FOR
protected static final String AUTH_SUCCESSFUL_FOR
protected static final org.slf4j.Logger AUDITLOG
protected org.apache.hadoop.security.token.SecretManager<org.apache.hadoop.security.token.TokenIdentifier> secretManager
protected org.apache.hadoop.security.authorize.ServiceAuthorizationManager authManager
protected static final ThreadLocal<RpcCall> CurCall
protected static final ThreadLocal<MonitoredRPCHandler> MONITORED_RPC
protected final InetSocketAddress bindAddress
protected MetricsHBaseServer metrics
protected final org.apache.hadoop.conf.Configuration conf
protected final long maxQueueSizeInBytes
callQueueSizeInBytes.callQueueSizeInBytes,
DEFAULT_MAX_CALLQUEUE_SIZEprotected static final int DEFAULT_MAX_CALLQUEUE_SIZE
protected final LongAdder callQueueSizeInBytes
protected final boolean tcpNoDelay
protected final boolean tcpKeepAlive
protected AuthenticationTokenSecretManager authTokenSecretMgr
protected HBaseRPCErrorHandler errorHandler
public static final String MAX_REQUEST_SIZE
protected static final String WARN_RESPONSE_TIME
protected static final String WARN_RESPONSE_SIZE
protected static final String MIN_CLIENT_REQUEST_TIMEOUT
protected static final int DEFAULT_MIN_CLIENT_REQUEST_TIMEOUT
public static final int DEFAULT_MAX_REQUEST_SIZE
protected static final int DEFAULT_WARN_RESPONSE_TIME
protected static final int DEFAULT_WARN_RESPONSE_SIZE
protected static final int DEFAULT_TRACE_LOG_MAX_LENGTH
protected static final String TRACE_LOG_MAX_LENGTH
protected static final String KEY_WORD_TRUNCATED
protected static final org.apache.hbase.thirdparty.com.google.gson.Gson GSON
protected final int maxRequestSize
protected volatile int warnResponseTime
protected volatile int warnResponseSize
protected final int minClientRequestTimeout
protected final Server server
protected final List<RpcServer.BlockingServiceAndInterface> services
protected final RpcScheduler scheduler
protected UserProvider userProvider
protected final ByteBuffAllocator bbAllocator
protected volatile boolean allowFallbackToSimpleAuth
protected static final int NIO_BUFFER_LIMIT
public RpcServer(Server server, String name, List<RpcServer.BlockingServiceAndInterface> services, InetSocketAddress bindAddress, org.apache.hadoop.conf.Configuration conf, RpcScheduler scheduler, boolean reservoirEnabled) throws IOException
server - hosting instance of Server. We will do authentications if an
instance else pass null for no authentication check.name - Used keying this rpc servers' metrics and for naming the Listener
thread.services - A list of services.bindAddress - Where to listenreservoirEnabled - Enable ByteBufferPool or not.IOExceptionpublic void onConfigurationChange(org.apache.hadoop.conf.Configuration newConf)
onConfigurationChange in interface ConfigurationObserverprotected void initReconfigurable(org.apache.hadoop.conf.Configuration confToLoad)
public boolean isStarted()
isStarted in interface RpcServerInterfacepublic void refreshAuthManager(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.security.authorize.PolicyProvider pp)
RpcServerInterfacerefreshAuthManager in interface RpcServerInterfaceprotected AuthenticationTokenSecretManager createSecretManager()
public org.apache.hadoop.security.token.SecretManager<? extends org.apache.hadoop.security.token.TokenIdentifier> getSecretManager()
public void setSecretManager(org.apache.hadoop.security.token.SecretManager<? extends org.apache.hadoop.security.token.TokenIdentifier> secretManager)
public Pair<org.apache.hbase.thirdparty.com.google.protobuf.Message,CellScanner> call(RpcCall call, MonitoredRPCHandler status) throws IOException
call in interface RpcServerInterfaceIOExceptionpublic void setErrorHandler(HBaseRPCErrorHandler handler)
setErrorHandler in interface RpcServerInterfacehandler - the handler implementationpublic HBaseRPCErrorHandler getErrorHandler()
getErrorHandler in interface RpcServerInterfacepublic MetricsHBaseServer getMetrics()
getMetrics in interface RpcServerInterfacepublic void addCallSize(long diff)
RpcServerInterfaceaddCallSize in interface RpcServerInterfacediff - Change (plus or minus)public void authorize(org.apache.hadoop.security.UserGroupInformation user,
org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.ConnectionHeader connection,
InetAddress addr)
throws org.apache.hadoop.security.authorize.AuthorizationException
user - client userconnection - incoming connectionaddr - InetAddress of incoming connectionorg.apache.hadoop.security.authorize.AuthorizationException - when the client isn't authorized to talk the protocolprotected int channelRead(ReadableByteChannel channel, ByteBuffer buffer) throws IOException
ReadableByteChannel.read(java.nio.ByteBuffer). If the amount of data
is large, it writes to channel in smaller chunks. This is to avoid jdk from creating many
direct buffers as the size of ByteBuffer increases. There should not be any performance
degredation.channel - writable byte channel to write onbuffer - buffer to writeIOException - eReadableByteChannel.read(java.nio.ByteBuffer)public static Optional<RpcCall> getCurrentCall()
public static boolean isInRpcCallContext()
public static Optional<RpcCall> unsetCurrentCall()
RegionProcedureStore. For
master's rpc call, it may generate new procedure and mutate the region which store procedure.
There are some check about rpc when mutate region, such as rpc timeout check. So unset the rpc
call to avoid the rpc check.public static void setCurrentCall(RpcCall rpcCall)
RegionProcedureStore. Set the
rpc call back after mutate region.public static Optional<User> getRequestUser()
public abstract int getNumOpenConnections()
public static Optional<String> getRequestUserName()
public static Optional<InetAddress> getRemoteAddress()
protected static RpcServer.BlockingServiceAndInterface getServiceAndInterface(List<RpcServer.BlockingServiceAndInterface> services, String serviceName)
serviceName - Some arbitrary string that represents a 'service'.services - Available service instancesprotected static Class<?> getServiceInterface(List<RpcServer.BlockingServiceAndInterface> services, String serviceName)
serviceName - Some arbitrary string that represents a 'service'.services - Available services and their service interfaces.serviceNameprotected static org.apache.hbase.thirdparty.com.google.protobuf.BlockingService getService(List<RpcServer.BlockingServiceAndInterface> services, String serviceName)
serviceName - Some arbitrary string that represents a 'service'.services - Available services and their service interfaces.serviceNameprotected static MonitoredRPCHandler getStatus()
public static InetAddress getRemoteIp()
public RpcScheduler getScheduler()
getScheduler in interface RpcServerInterfacepublic ByteBuffAllocator getByteBuffAllocator()
RpcServerInterfacegetByteBuffAllocator in interface RpcServerInterfacepublic void setRsRpcServices(RSRpcServices rsRpcServices)
setRsRpcServices in interface RpcServerInterfacepublic void setNamedQueueRecorder(NamedQueueRecorder namedQueueRecorder)
RpcServerInterfacesetNamedQueueRecorder in interface RpcServerInterfacenamedQueueRecorder - instance of NamedQueueRecorderprotected boolean needAuthorization()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.