Class MasterActiveTimeStore

java.lang.Object
org.apache.hadoop.hbase.master.MasterStateStore
org.apache.hadoop.hbase.master.MasterActiveTimeStore

@Private public class MasterActiveTimeStore extends MasterStateStore
Stores the active time of the last active master, so that a new active master can take an active time greater than that of every earlier one even if its clock is behind theirs.

Remote procedures send the active time of the master that started them, and a master rejects a report carrying an active time greater than its own, as it comes from a procedure started by a newer master. See MasterRpcServices#throwOnOldMaster.

As a result the active time can be ahead of the wall clock of the current master: if an earlier active master's clock was ahead, later active times follow the stored value until the clock catches up with it.

  • Field Details

  • Constructor Details

  • Method Details

    • advance

      public long advance(long now, long maxClockSkewMs) throws IOException
      Returns an active time for a master becoming active: the given time if it is greater than the last stored active time, or else the last stored active time plus one. The returned time is stored before returning.

      If the last stored active time is ahead of the given time by more than maxClockSkewMs, the clocks of the masters are too far apart to continue, and this throws ClockOutOfSyncException without storing anything.

      Must only be called by the active master, after the master local region has been opened, so that an earlier active master can no longer update the stored time.

      Parameters:
      now - the current time of this master
      maxClockSkewMs - how far the last stored active time may be ahead of now
      Returns:
      the active time of this master
      Throws:
      ClockOutOfSyncException - if the last stored active time is too far ahead of now
      IOException