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
FieldsModifier and TypeFieldDescriptionprotected final ByteBuffAllocatorprotected final CellBlockBuilderprotected ByteBufferListOutputStreamprotected final ExtendedCellScannerprotected final X509Certificate[]protected final Tprotected final longprivate longprotected final org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.RequestHeaderprotected final intprotected booleanprotected final org.apache.hbase.thirdparty.com.google.protobuf.Descriptors.MethodDescriptorprotected org.apache.hbase.thirdparty.com.google.protobuf.Messageprotected final longprivate final AtomicIntegerprotected final InetAddressprotected RpcServer.CallCleanupprotected BufferChainChain of buffers to send as response.private longprivate longprivate final booleanprotected RpcCallbackprotected final org.apache.hbase.thirdparty.com.google.protobuf.BlockingServiceprotected final longprivate final io.opentelemetry.api.trace.Spanprotected longprotected final intprotected final User -
Constructor Summary
ConstructorsConstructorDescriptionServerCall(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, ExtendedCellScanner cellScanner, T connection, long size, InetAddress remoteAddress, long receiveTime, int timeout, ByteBuffAllocator byteBuffAllocator, CellBlockBuilder cellBlockBuilder, RpcServer.CallCleanup reqCleanup) -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()Do the necessary cleanup after the call if needed.private BufferChaincreateFallbackErrorResponse(IOException originalException) private static ByteBuffercreateHeaderAndMessageBytes(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 ByteBuffercreateHeaderAndMessageBytes(org.apache.hbase.thirdparty.com.google.protobuf.Message result, org.apache.hbase.thirdparty.com.google.protobuf.Message header, int cellBlockSize, List<ByteBuffer> cellBlock) longCheck if the caller who made this IPC call has disconnected.voiddone()Call is done.longGet 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.VersionInfoReturns the client version info, or null if the information is not presentReturns the map of attributes specified when building the Connection.longReturn the deadline of this call.org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.RequestHeaderReturns The request header of this call.org.apache.hbase.thirdparty.com.google.protobuf.Descriptors.MethodDescriptorReturns The service method.org.apache.hbase.thirdparty.com.google.protobuf.MessagegetParam()Returns The call parameter message.intReturns The Priority of this call.longReturns The timestamp when the call is constructed.Returns Address of remote client in this callintReturns 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.longThe size of response cells that have been accumulated so far.longorg.apache.hbase.thirdparty.com.google.protobuf.BlockingServiceReturns The service of this call.longgetSize()Used to calculate the request call queue size.longReturns The time when the call starts to be executed.intReturns The timeout of this call.voidincrementBlockBytesScanned(long blockSize) Increment the number of block bytes scanned by the current call.voidincrementResponseCellSize(long cellSize) Add on the given amount to the retained cell size.voidincrementResponseExceptionSize(long exSize) booleanIf the client connected and specified a codec to use, then we will use this codec making cellblocks to return.booleanvoidvoidvoidsetCallBack(RpcCallback callback) Sets a callback which has to be executed at the end of this RPC call.(package private) static voidsetExceptionResponse(Throwable t, String errorMsg, org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.ResponseHeader.Builder headerBuilder) voidsetResponse(org.apache.hbase.thirdparty.com.google.protobuf.Message m, ExtendedCellScanner cells, Throwable t, String errorMsg) Set the response resulting from this RPC call.voidsetStartTime(long t) Set the time when the call starts to be executed.Returns A short string format of this call without possibly lengthy paramstoString()private static voidwriteToCOS(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, waitMethods inherited from interface org.apache.hadoop.hbase.ipc.RpcCall
sendResponseIfReadyMethods 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
-
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, ExtendedCellScanner 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:
donein interfaceRpcResponse
-
cleanup
Description copied from interface:RpcCallDo the necessary cleanup after the call if needed. -
retainByWAL
-
releaseByWAL
-
toString
-
getHeader
Description copied from interface:RpcCallReturns The request header of this call. -
getConnectionAttributes
Description copied from interface:RpcCallReturns the map of attributes specified when building the Connection.- Specified by:
getConnectionAttributesin interfaceRpcCall- See Also:
-
getRequestAttributes
Description copied from interface:RpcCallReturns 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:
getRequestAttributesin interfaceRpcCall- See Also:
-
getRequestAttribute
Description copied from interface:RpcCallReturns 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:
getRequestAttributein interfaceRpcCall- See Also:
-
getPriority
Description copied from interface:RpcCallReturns The Priority of this call.- Specified by:
getPriorityin interfaceRpcCall
-
toShortString
Description copied from interface:RpcCallReturns A short string format of this call without possibly lengthy params- Specified by:
toShortStringin interfaceRpcCall
-
setResponse
public void setResponse(org.apache.hbase.thirdparty.com.google.protobuf.Message m, ExtendedCellScanner cells, Throwable t, String errorMsg) Description copied from interface:RpcCallSet the response resulting from this RPC call.- Specified by:
setResponsein 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) -
createFallbackErrorResponse
-
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:RpcCallContextCheck if the caller who made this IPC call has disconnected. If called from outside the context of IPC, this does nothing.- Specified by:
disconnectSincein interfaceRpcCallContext- Returns:
- < 0 if the caller is still connected. The time in ms since the disconnection otherwise
-
isClientCellBlockSupported
Description copied from interface:RpcCallContextIf 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:
isClientCellBlockSupportedin interfaceRpcCallContext- Returns:
- True if the client supports cellblocks, else return all content in pb
-
getResponseCellSize
Description copied from interface:RpcCallContextThe 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:
getResponseCellSizein interfaceRpcCallContext
-
incrementResponseCellSize
Description copied from interface:RpcCallContextAdd 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:
incrementResponseCellSizein interfaceRpcCallContext
-
getBlockBytesScanned
Description copied from interface:RpcCallContextGet 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:
getBlockBytesScannedin interfaceRpcCallContext
-
incrementBlockBytesScanned
Description copied from interface:RpcCallContextIncrement the number of block bytes scanned by the current call. SeeRpcCallContext.getBlockBytesScanned()for details.- Specified by:
incrementBlockBytesScannedin interfaceRpcCallContext
-
getResponseExceptionSize
- Specified by:
getResponseExceptionSizein interfaceRpcCallContext
-
incrementResponseExceptionSize
- Specified by:
incrementResponseExceptionSizein interfaceRpcCallContext
-
getSize
Description copied from interface:RpcCallUsed 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:RpcCallReturn 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:
getDeadlinein interfaceRpcCall- Returns:
- The system timestamp of deadline.
-
getRequestUser
Description copied from interface:RpcCallContextReturns the user credentials associated with the current RPC request or not present if no credentials were provided.- Specified by:
getRequestUserin interfaceRpcCallContext- Returns:
- A User
-
getClientCertificateChain
Description copied from interface:RpcCallContextReturns 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:
getClientCertificateChainin interfaceRpcCallContext
-
getRemoteAddress
Description copied from interface:RpcCallContextReturns Address of remote client in this call- Specified by:
getRemoteAddressin interfaceRpcCallContext
-
getClientVersionInfo
public org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.VersionInfo getClientVersionInfo()Description copied from interface:RpcCallContextReturns the client version info, or null if the information is not present- Specified by:
getClientVersionInfoin interfaceRpcCallContext
-
setCallBack
Description copied from interface:RpcCallContextSets 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:
setCallBackin interfaceRpcCallContext
-
isRetryImmediatelySupported
- Specified by:
isRetryImmediatelySupportedin interfaceRpcCallContext
-
getService
Description copied from interface:RpcCallReturns The service of this call.- Specified by:
getServicein interfaceRpcCall
-
getMethod
Description copied from interface:RpcCallReturns The service method. -
getParam
Description copied from interface:RpcCallReturns The call parameter message. -
getCellScanner
Description copied from interface:RpcCallReturns The CellScanner that can carry input and result payload.- Specified by:
getCellScannerin interfaceRpcCall
-
getReceiveTime
Description copied from interface:RpcCallReturns The timestamp when the call is constructed.- Specified by:
getReceiveTimein interfaceRpcCall
-
getStartTime
Description copied from interface:RpcCallReturns The time when the call starts to be executed.- Specified by:
getStartTimein interfaceRpcCall
-
setStartTime
Description copied from interface:RpcCallSet the time when the call starts to be executed.- Specified by:
setStartTimein interfaceRpcCall
-
getTimeout
Description copied from interface:RpcCallReturns The timeout of this call.- Specified by:
getTimeoutin interfaceRpcCall
-
getRemotePort
Description copied from interface:RpcCallReturns Port of remote address in this call- Specified by:
getRemotePortin interfaceRpcCall
-
getResponse
- Specified by:
getResponsein interfaceRpcResponse
-