Class MembershipStore

All Implemented Interfaces:
StateStoreCache
Direct Known Subclasses:
MembershipStoreImpl

@Private @Evolving public abstract class MembershipStore extends CachedRecordStore<MembershipState>
Management API for NameNode registrations stored in MembershipState records. The RouterHeartbeatService periodically polls each NN to update the NameNode metadata(addresses, operational) and HA state(active, standby). Each NameNode may be polled by multiple Router instances.

Once fetched from the StateStoreDriver, NameNode registrations are cached until the next query. The fetched registration data is aggregated using a quorum to determine the best/most accurate state for each NameNode. The cache is periodically updated by the StateStoreCacheUpdateService.

  • Constructor Details

  • Method Details

    • namenodeHeartbeat

      public abstract NamenodeHeartbeatResponse namenodeHeartbeat(NamenodeHeartbeatRequest request) throws IOException
      Inserts or updates a namenode membership entry into the table.
      Parameters:
      request - Fully populated NamenodeHeartbeatRequest request.
      Returns:
      True if successful, false otherwise.
      Throws:
      StateStoreUnavailableException - Throws exception if the data store is not initialized.
      IOException - if the data store could not be queried or the query is invalid.
    • getNamenodeRegistrations

      public abstract GetNamenodeRegistrationsResponse getNamenodeRegistrations(GetNamenodeRegistrationsRequest request) throws IOException
      Queries for a single cached registration entry matching the given parameters. Possible keys are the names of data structure elements Possible values are matching SQL "LIKE" targets.
      Parameters:
      request - Fully populated GetNamenodeRegistrationsRequest request.
      Returns:
      Single matching FederationMembershipStateEntry or null if not found or more than one entry matches.
      Throws:
      StateStoreUnavailableException - Throws exception if the data store is not initialized.
      IOException - if the data store could not be queried or the query is invalid.
    • getExpiredNamenodeRegistrations

      public abstract GetNamenodeRegistrationsResponse getExpiredNamenodeRegistrations(GetNamenodeRegistrationsRequest request) throws IOException
      Get the expired registrations from the registration cache.
      Parameters:
      request - Request to get the expired registrations.
      Returns:
      Expired registrations or zero-length list if none are found.
      Throws:
      StateStoreUnavailableException - Throws exception if the data store is not initialized.
      IOException - if the data store could not be queried or the query is invalid.
    • getNamespaceInfo

      public abstract GetNamespaceInfoResponse getNamespaceInfo(GetNamespaceInfoRequest request) throws IOException
      Retrieves a list of registered nameservices and their associated info.
      Parameters:
      request - Request to get the name spaces.
      Returns:
      Collection of information for each registered nameservice.
      Throws:
      IOException - if the data store could not be queried or the query is invalid.
    • updateNamenodeRegistration

      public abstract UpdateNamenodeRegistrationResponse updateNamenodeRegistration(UpdateNamenodeRegistrationRequest request) throws IOException
      Overrides a cached namenode state with an updated state.
      Parameters:
      request - Fully populated OverrideNamenodeRegistrationRequest request.
      Returns:
      OverrideNamenodeRegistrationResponse
      Throws:
      StateStoreUnavailableException - if the data store is not initialized.
      IOException - if the data store could not be queried or the query is invalid.