Class MasterHistoryService

java.lang.Object
org.elasticsearch.cluster.coordination.MasterHistoryService

public class MasterHistoryService extends Object
This service provides access to this node's view of the master history, as well as access to other nodes' view of master stability.
  • Field Details

    • REMOTE_HISTORY_TIME_TO_LIVE_SETTING

      public static final Setting<TimeValue> REMOTE_HISTORY_TIME_TO_LIVE_SETTING
      This is the amount of time that can pass after a RemoteHistoryOrException is returned from the remote master until it is considered stale and not usable.
  • Constructor Details

  • Method Details

    • getLocalMasterHistory

      public MasterHistory getLocalMasterHistory()
      This returns the MasterHistory as seen from this node. The returned MasterHistory will be automatically updated whenever the ClusterState on this node is updated with new information about the master.
      Returns:
      The MasterHistory from this node's point of view. This MasterHistory object will be updated whenever the ClusterState changes
    • getRemoteMasterHistory

      @Nullable public List<DiscoveryNode> getRemoteMasterHistory() throws Exception
      This method returns a static view of the MasterHistory on a remote node. This MasterHistory is static in that it will not be updated even if the ClusterState is updated on this node or the remote node. The history is retrieved asynchronously, and only if refreshRemoteMasterHistory has been called for this node. If anything has gone wrong fetching it, the exception returned by the remote machine will be thrown here. If the remote history has not been fetched or if something went wrong and there was no exception, the returned value will be null. If the remote history is old enough to be considered stale (that is, older than MAX_USABLE_REMOTE_HISTORY_AGE_SETTING), then the returned value will be null.
      Returns:
      The MasterHistory from a remote node's point of view. This MasterHistory object will not be updated with future changes
      Throws:
      Exception - the exception (if any) returned by the remote machine when fetching the history
    • refreshRemoteMasterHistory

      public void refreshRemoteMasterHistory(DiscoveryNode node)
      This method attempts to fetch the master history from the requested node. If we are able to successfully fetch it, it will be available in a later call to getRemoteMasterHistory. The client is not notified if or when the remote history is successfully retrieved. This method only fetches the remote master history once, and it is never updated unless this method is called again. If two calls are made to this method, the response of one will overwrite the response of the other (with no guarantee of the ordering of responses). This is a remote call, so clients should avoid calling it any more often than necessary.
      Parameters:
      node - The node whose view of the master history we want to fetch