Class BitRpcUtility

java.lang.Object
org.apache.drill.exec.rpc.BitRpcUtility

public final class BitRpcUtility extends Object
Utility class providing common methods shared between DataClient and ControlClient
  • 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 message
      remoteAuthMechs - - authentication mechanisms supported by server
      rpcVersion - - supported rpc version on client
      connection - - client connection
      config - - client connectin config
      client - - 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, HS extends com.google.protobuf.MessageLite, HR extends com.google.protobuf.MessageLite> void prepareSaslHandshake(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 from BasicClient.prepareSaslHandshake(RpcConnectionHandler, List) only for DataClient and ControlClient
      Parameters:
      connectionHandler - - Connection handler used by client's to know about success/failure conditions.
      serverAuthMechanisms - - List of auth mechanisms configured on server side
      connection - - ClientConnection used for authentication
      config - - ClientConnection config
      endpoint - - Remote DrillbitEndpoint
      client - - Either of DataClient/ControlClient instance
      saslRpcType - - 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 in CoordinationProtos.DrillbitEndpoint because DrillbitEndpoint stores state information in it. For local Drillbit a reference is stored in DrillbitContext as soon as Drillbit is started in ServiceEngine.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 bit
      remote - - DrillbitEndpoint instance for remote bit
      Returns:
      true if address and control port for local and remote are same. false - otherwise