Package org.apache.drill.exec.rpc
Class BitRpcUtility
java.lang.Object
org.apache.drill.exec.rpc.BitRpcUtility
Utility class providing common methods shared between
DataClient
and
ControlClient
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
isLocalControlServer
(CoordinationProtos.DrillbitEndpoint local, CoordinationProtos.DrillbitEndpoint remote) Verifies if local and remote Drillbit Endpoint has same control server by using address and control port information.static <T extends com.google.protobuf.Internal.EnumLite,
CC extends ClientConnection, HS extends com.google.protobuf.MessageLite, HR extends com.google.protobuf.MessageLite>
voidprepareSaslHandshake
(RpcConnectionHandler<CC> connectionHandler, List<String> serverAuthMechanisms, CC connection, BitConnectionConfig config, CoordinationProtos.DrillbitEndpoint endpoint, BasicClient<T, CC, HS, HR> client, T saslRpcType) Creates various instances needed to start the SASL handshake.validateHandshake
(int handshakeRpcVersion, List<String> remoteAuthMechs, int rpcVersion, ClientConnection connection, BitConnectionConfig config, BasicClient client) Method to do validation on the handshake message received from server side.
-
Method Details
-
validateHandshake
public static List<String> validateHandshake(int handshakeRpcVersion, List<String> remoteAuthMechs, int rpcVersion, ClientConnection connection, BitConnectionConfig config, BasicClient client) throws RpcException Method to do validation on the handshake message received from server side. Only used by BitClients NOT UserClient. Verify if rpc version of handshake message matches the supported RpcVersion and also validates the security configuration between client and server- Parameters:
handshakeRpcVersion
- - rpc version received in handshake messageremoteAuthMechs
- - authentication mechanisms supported by serverrpcVersion
- - supported rpc version on clientconnection
- - client connectionconfig
- - client connectin configclient
- - data client or control client- Returns:
- - Immutable list of authentication mechanisms supported by server or null
- Throws:
RpcException
- - exception is thrown if rpc version or authentication configuration mismatch is found
-
prepareSaslHandshake
public static <T extends com.google.protobuf.Internal.EnumLite,CC extends ClientConnection, void prepareSaslHandshakeHS extends com.google.protobuf.MessageLite, HR extends com.google.protobuf.MessageLite> (RpcConnectionHandler<CC> connectionHandler, List<String> serverAuthMechanisms, CC connection, BitConnectionConfig config, CoordinationProtos.DrillbitEndpoint endpoint, BasicClient<T, CC, HS, HR> client, T saslRpcType) Creates various instances needed to start the SASL handshake. This is called fromBasicClient.prepareSaslHandshake(RpcConnectionHandler, List)
only forDataClient
andControlClient
- Parameters:
connectionHandler
- - Connection handler used by client's to know about success/failure conditions.serverAuthMechanisms
- - List of auth mechanisms configured on server sideconnection
- - ClientConnection used for authenticationconfig
- - ClientConnection configendpoint
- - Remote DrillbitEndpointclient
- - Either of DataClient/ControlClient instancesaslRpcType
- - SASL_MESSAGE RpcType for Data and Control channel
-
isLocalControlServer
public static boolean isLocalControlServer(CoordinationProtos.DrillbitEndpoint local, CoordinationProtos.DrillbitEndpoint remote) Verifies if local and remote Drillbit Endpoint has same control server by using address and control port information. This method is used instead of equals inCoordinationProtos.DrillbitEndpoint
because DrillbitEndpoint stores state information in it. For local Drillbit a reference is stored inDrillbitContext
as soon as Drillbit is started inServiceEngine.start()
with state as STARTUP, but while planning minor fragment the assignment list is used from active list of Drillbits in which state for local Drillbit will not be STARTUP- Parameters:
local
- - DrillbitEndpoint instance for local bitremote
- - DrillbitEndpoint instance for remote bit- Returns:
- true if address and control port for local and remote are same. false - otherwise
-