Package org.apache.hadoop.hbase.master
Class MasterActiveTimeStore
java.lang.Object
org.apache.hadoop.hbase.master.MasterStateStore
org.apache.hadoop.hbase.master.MasterActiveTimeStore
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongadvance(long now, long maxClockSkewMs) 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.Methods inherited from class org.apache.hadoop.hbase.master.MasterStateStore
getState, setState
-
Field Details
-
LOG
-
STATE_NAME
- See Also:
-
-
Constructor Details
-
MasterActiveTimeStore
public MasterActiveTimeStore(MasterRegion masterRegion) throws IOException, org.apache.zookeeper.KeeperException - Throws:
IOExceptionorg.apache.zookeeper.KeeperException
-
-
Method Details
-
advance
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 thanmaxClockSkewMs, the clocks of the masters are too far apart to continue, and this throwsClockOutOfSyncExceptionwithout 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 mastermaxClockSkewMs- how far the last stored active time may be ahead ofnow- Returns:
- the active time of this master
- Throws:
ClockOutOfSyncException- if the last stored active time is too far ahead ofnowIOException
-