Package org.apache.hadoop.hbase.ipc
Class ServerCall<T extends ServerRpcConnection>
java.lang.Object
org.apache.hadoop.hbase.ipc.ServerCall<T>
- All Implemented Interfaces:
RpcCall
,RpcCallContext
,RpcResponse
- Direct Known Subclasses:
NettyServerCall
,SimpleServerCall
@Private
public abstract class ServerCall<T extends ServerRpcConnection>
extends Object
implements RpcCall, RpcResponse
Datastructure that holds all necessary to a method invocation and then afterward, carries the
result.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final ByteBuffAllocator
protected final CellBlockBuilder
protected ByteBufferListOutputStream
protected final CellScanner
protected final X509Certificate[]
protected final T
protected final long
private long
private long
protected final org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.RequestHeader
protected final int
protected boolean
protected final org.apache.hbase.thirdparty.com.google.protobuf.Descriptors.MethodDescriptor
protected org.apache.hbase.thirdparty.com.google.protobuf.Message
protected final long
private final AtomicInteger
protected final InetAddress
protected RpcServer.CallCleanup
protected BufferChain
Chain of buffers to send as response.private long
private long
private final boolean
protected RpcCallback
protected final org.apache.hbase.thirdparty.com.google.protobuf.BlockingService
protected final long
private final io.opentelemetry.api.trace.Span
protected long
protected final int
protected final User
-
Constructor Summary
ConstructorDescriptionServerCall
(int id, org.apache.hbase.thirdparty.com.google.protobuf.BlockingService service, org.apache.hbase.thirdparty.com.google.protobuf.Descriptors.MethodDescriptor md, org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.RequestHeader header, org.apache.hbase.thirdparty.com.google.protobuf.Message param, CellScanner cellScanner, T connection, long size, InetAddress remoteAddress, long receiveTime, int timeout, ByteBuffAllocator byteBuffAllocator, CellBlockBuilder cellBlockBuilder, RpcServer.CallCleanup reqCleanup) -
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanup()
Do the necessary cleanup after the call if needed.private static ByteBuffer
createHeaderAndMessageBytes
(org.apache.hbase.thirdparty.com.google.protobuf.Message result, org.apache.hbase.thirdparty.com.google.protobuf.Message header, int totalSize, int totalPBSize) (package private) static ByteBuffer
createHeaderAndMessageBytes
(org.apache.hbase.thirdparty.com.google.protobuf.Message result, org.apache.hbase.thirdparty.com.google.protobuf.Message header, int cellBlockSize, List<ByteBuffer> cellBlock) long
Check if the caller who made this IPC call has disconnected.void
done()
Call is done.long
Get the number of block bytes scanned by the current call.Returns The CellScanner that can carry input and result payload.Returns the TLS certificate(s) that the client presented to this HBase server when making its connection.org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.VersionInfo
Returns the client version info, or null if the information is not presentReturns the map of attributes specified when building the Connection.long
Return the deadline of this call.long
org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.RequestHeader
Returns The request header of this call.org.apache.hbase.thirdparty.com.google.protobuf.Descriptors.MethodDescriptor
Returns The service method.org.apache.hbase.thirdparty.com.google.protobuf.Message
getParam()
Returns The call parameter message.int
Returns The Priority of this call.long
Returns The timestamp when the call is constructed.Returns Address of remote client in this callint
Returns Port of remote address in this callbyte[]
Returns a single request attribute value, or null if no value is present.Returns the map of attributes specified when building the request.Returns the user credentials associated with the current RPC request or not present if no credentials were provided.long
The size of response cells that have been accumulated so far.long
org.apache.hbase.thirdparty.com.google.protobuf.BlockingService
Returns The service of this call.long
getSize()
Used to calculate the request call queue size.long
Returns The time when the call starts to be executed.int
Returns The timeout of this call.void
incrementBlockBytesScanned
(long blockSize) Increment the number of block bytes scanned by the current call.void
incrementResponseCellSize
(long cellSize) Add on the given amount to the retained cell size.void
incrementResponseExceptionSize
(long exSize) boolean
If the client connected and specified a codec to use, then we will use this codec making cellblocks to return.boolean
void
void
void
setCallBack
(RpcCallback callback) Sets a callback which has to be executed at the end of this RPC call.(package private) static void
setExceptionResponse
(Throwable t, String errorMsg, org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.ResponseHeader.Builder headerBuilder) void
setResponse
(org.apache.hbase.thirdparty.com.google.protobuf.Message m, CellScanner cells, Throwable t, String errorMsg) Set the response resulting from this RPC call.void
setStartTime
(long t) Set the time when the call starts to be executed.Returns A short string format of this call without possibly lengthy paramstoString()
void
updateFsReadTime
(long latencyMillis) private static void
writeToCOS
(org.apache.hbase.thirdparty.com.google.protobuf.Message result, org.apache.hbase.thirdparty.com.google.protobuf.Message header, int totalSize, ByteBuffer pbBuf) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.hadoop.hbase.ipc.RpcCall
sendResponseIfReady
Methods inherited from interface org.apache.hadoop.hbase.ipc.RpcCallContext
getRequestUserName
-
Field Details
-
id
-
service
-
md
-
header
-
param
-
cellScanner
-
connection
-
receiveTime
-
timeout
-
startTime
-
deadline
-
bbAllocator
-
cellBlockBuilder
-
response
Chain of buffers to send as response. -
size
-
isError
-
cellBlockStream
-
reqCleanup
-
user
-
remoteAddress
-
clientCertificateChain
-
rpcCallback
-
responseCellSize
-
responseBlockSize
-
fsReadTimeMillis
-
exceptionSize
-
retryImmediatelySupported
-
requestAttributes
-
reference
-
span
-
-
Constructor Details
-
ServerCall
ServerCall(int id, org.apache.hbase.thirdparty.com.google.protobuf.BlockingService service, org.apache.hbase.thirdparty.com.google.protobuf.Descriptors.MethodDescriptor md, org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.RequestHeader header, org.apache.hbase.thirdparty.com.google.protobuf.Message param, CellScanner cellScanner, T connection, long size, InetAddress remoteAddress, long receiveTime, int timeout, ByteBuffAllocator byteBuffAllocator, CellBlockBuilder cellBlockBuilder, RpcServer.CallCleanup reqCleanup)
-
-
Method Details
-
done
Call is done. Execution happened and we returned results to client. It is now safe to cleanup.- Specified by:
done
in interfaceRpcResponse
-
cleanup
Description copied from interface:RpcCall
Do the necessary cleanup after the call if needed. -
retainByWAL
-
releaseByWAL
-
toString
-
getHeader
Description copied from interface:RpcCall
Returns The request header of this call. -
getConnectionAttributes
Description copied from interface:RpcCall
Returns the map of attributes specified when building the Connection.- Specified by:
getConnectionAttributes
in interfaceRpcCall
- See Also:
-
getRequestAttributes
Description copied from interface:RpcCall
Returns the map of attributes specified when building the request. This map is lazily evaluated so if you only need a single attribute then it may be cheaper to useRpcCall.getRequestAttribute(String)
- Specified by:
getRequestAttributes
in interfaceRpcCall
- See Also:
-
getRequestAttribute
Description copied from interface:RpcCall
Returns a single request attribute value, or null if no value is present. If you need many request attributes then you should fetch the lazily evaluated map viaRpcCall.getRequestAttributes()
- Specified by:
getRequestAttribute
in interfaceRpcCall
- See Also:
-
getPriority
Description copied from interface:RpcCall
Returns The Priority of this call.- Specified by:
getPriority
in interfaceRpcCall
-
toShortString
Description copied from interface:RpcCall
Returns A short string format of this call without possibly lengthy params- Specified by:
toShortString
in interfaceRpcCall
-
setResponse
public void setResponse(org.apache.hbase.thirdparty.com.google.protobuf.Message m, CellScanner cells, Throwable t, String errorMsg) Description copied from interface:RpcCall
Set the response resulting from this RPC call.- Specified by:
setResponse
in interfaceRpcCall
- Parameters:
m
- The result message as response.cells
- The CellScanner that possibly carries the payload.t
- The error Throwable resulting from the call.errorMsg
- Extra error message.
-
setExceptionResponse
static void setExceptionResponse(Throwable t, String errorMsg, org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.ResponseHeader.Builder headerBuilder) -
createHeaderAndMessageBytes
static ByteBuffer createHeaderAndMessageBytes(org.apache.hbase.thirdparty.com.google.protobuf.Message result, org.apache.hbase.thirdparty.com.google.protobuf.Message header, int cellBlockSize, List<ByteBuffer> cellBlock) throws IOException - Throws:
IOException
-
writeToCOS
private static void writeToCOS(org.apache.hbase.thirdparty.com.google.protobuf.Message result, org.apache.hbase.thirdparty.com.google.protobuf.Message header, int totalSize, ByteBuffer pbBuf) throws IOException - Throws:
IOException
-
createHeaderAndMessageBytes
private static ByteBuffer createHeaderAndMessageBytes(org.apache.hbase.thirdparty.com.google.protobuf.Message result, org.apache.hbase.thirdparty.com.google.protobuf.Message header, int totalSize, int totalPBSize) throws IOException - Throws:
IOException
-
disconnectSince
Description copied from interface:RpcCallContext
Check if the caller who made this IPC call has disconnected. If called from outside the context of IPC, this does nothing.- Specified by:
disconnectSince
in interfaceRpcCallContext
- Returns:
- < 0 if the caller is still connected. The time in ms since the disconnection otherwise
-
isClientCellBlockSupported
Description copied from interface:RpcCallContext
If the client connected and specified a codec to use, then we will use this codec making cellblocks to return. If the client did not specify a codec, we assume it does not support cellblocks and will return all content protobuf'd (though it makes our serving slower). We need to ask this question per call because a server could be hosting both clients that support cellblocks while fielding requests from clients that do not.- Specified by:
isClientCellBlockSupported
in interfaceRpcCallContext
- Returns:
- True if the client supports cellblocks, else return all content in pb
-
getResponseCellSize
Description copied from interface:RpcCallContext
The size of response cells that have been accumulated so far. This along with the corresponding increment call is used to ensure that multi's or scans dont get too excessively large- Specified by:
getResponseCellSize
in interfaceRpcCallContext
-
incrementResponseCellSize
Description copied from interface:RpcCallContext
Add on the given amount to the retained cell size. This is not thread safe and not synchronized at all. If this is used by more than one thread then everything will break. Since this is called for every row synchronization would be too onerous.- Specified by:
incrementResponseCellSize
in interfaceRpcCallContext
-
getBlockBytesScanned
Description copied from interface:RpcCallContext
Get the number of block bytes scanned by the current call. In order to serve a response, 1 or more lower level blocks must be loaded (from disk or cache) and scanned for the requested cells. This value includes the total block size for each block loaded for the request.- Specified by:
getBlockBytesScanned
in interfaceRpcCallContext
-
incrementBlockBytesScanned
Description copied from interface:RpcCallContext
Increment the number of block bytes scanned by the current call. SeeRpcCallContext.getBlockBytesScanned()
for details.- Specified by:
incrementBlockBytesScanned
in interfaceRpcCallContext
-
getResponseExceptionSize
- Specified by:
getResponseExceptionSize
in interfaceRpcCallContext
-
incrementResponseExceptionSize
- Specified by:
incrementResponseExceptionSize
in interfaceRpcCallContext
-
getSize
Description copied from interface:RpcCall
Used to calculate the request call queue size. If the total request call size exceeds a limit, the call will be rejected. -
getDeadline
Description copied from interface:RpcCall
Return the deadline of this call. If we can not complete this call in time, we can throw a TimeoutIOException and RPCServer will drop it.- Specified by:
getDeadline
in interfaceRpcCall
- Returns:
- The system timestamp of deadline.
-
getRequestUser
Description copied from interface:RpcCallContext
Returns the user credentials associated with the current RPC request or not present if no credentials were provided.- Specified by:
getRequestUser
in interfaceRpcCallContext
- Returns:
- A User
-
getClientCertificateChain
Description copied from interface:RpcCallContext
Returns the TLS certificate(s) that the client presented to this HBase server when making its connection. TLS is orthogonal to Kerberos, so this is unrelated toRpcCallContext.getRequestUser()
. Both, one, or neither may be present.- Specified by:
getClientCertificateChain
in interfaceRpcCallContext
-
getRemoteAddress
Description copied from interface:RpcCallContext
Returns Address of remote client in this call- Specified by:
getRemoteAddress
in interfaceRpcCallContext
-
getClientVersionInfo
public org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.VersionInfo getClientVersionInfo()Description copied from interface:RpcCallContext
Returns the client version info, or null if the information is not present- Specified by:
getClientVersionInfo
in interfaceRpcCallContext
-
setCallBack
Description copied from interface:RpcCallContext
Sets a callback which has to be executed at the end of this RPC call. Such a callback is an optional one for any Rpc call.- Specified by:
setCallBack
in interfaceRpcCallContext
-
isRetryImmediatelySupported
- Specified by:
isRetryImmediatelySupported
in interfaceRpcCallContext
-
getService
Description copied from interface:RpcCall
Returns The service of this call.- Specified by:
getService
in interfaceRpcCall
-
getMethod
Description copied from interface:RpcCall
Returns The service method. -
getParam
Description copied from interface:RpcCall
Returns The call parameter message. -
getCellScanner
Description copied from interface:RpcCall
Returns The CellScanner that can carry input and result payload.- Specified by:
getCellScanner
in interfaceRpcCall
-
getReceiveTime
Description copied from interface:RpcCall
Returns The timestamp when the call is constructed.- Specified by:
getReceiveTime
in interfaceRpcCall
-
getStartTime
Description copied from interface:RpcCall
Returns The time when the call starts to be executed.- Specified by:
getStartTime
in interfaceRpcCall
-
setStartTime
Description copied from interface:RpcCall
Set the time when the call starts to be executed.- Specified by:
setStartTime
in interfaceRpcCall
-
getTimeout
Description copied from interface:RpcCall
Returns The timeout of this call.- Specified by:
getTimeout
in interfaceRpcCall
-
getRemotePort
Description copied from interface:RpcCall
Returns Port of remote address in this call- Specified by:
getRemotePort
in interfaceRpcCall
-
getResponse
- Specified by:
getResponse
in interfaceRpcResponse
-
getCallBack
-
updateFsReadTime
- Specified by:
updateFsReadTime
in interfaceRpcCall
-
getFsReadTime
- Specified by:
getFsReadTime
in interfaceRpcCall
-