Class WalStateManager
- java.lang.Object
-
- org.apache.accumulo.server.log.WalStateManager
-
public class WalStateManager extends Object
This class governs the space in Zookeeper that advertises the status of Write-Ahead Logs in use by tablet servers.The Accumulo Manager needs to know the state of the WALs to mark tablets during recovery. The GC needs to know when a log is no longer needed so it can be removed.
The state of the WALs is kept in Zookeeper under /accumulo/<instanceid>/wals. For each server, there is a znode formatted like the TServerInstance.toString(): "host:port[sessionid]". Under the server znode, is a node for each log, using the UUID for the log. In each of the WAL znodes, is the current state of the log, and the full path to the log.
The state [OPEN, CLOSED, UNREFERENCED] is what the tablet server believes to be the state of the file.
In the event of a recovery, the log is identified as belonging to a dead server. The manager will update the tablets assigned to that server with log references. Once all tablets have been reassigned and the log references are removed, the log will be eligible for deletion.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWalStateManager.WalMarkerExceptionstatic classWalStateManager.WalState
-
Constructor Summary
Constructors Constructor Description WalStateManager(ServerContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddNewWalMarker(TServerInstance tsi, org.apache.hadoop.fs.Path path)voidcloseWal(TServerInstance instance, org.apache.hadoop.fs.Path path)voidforget(TServerInstance instance)Map<TServerInstance,List<UUID>>getAllMarkers()Map<org.apache.hadoop.fs.Path,WalStateManager.WalState>getAllState()List<org.apache.hadoop.fs.Path>getWalsInUse(TServerInstance tsi)voidinitWalMarker(TServerInstance tsi)voidremoveWalMarker(TServerInstance instance, UUID uuid)Pair<WalStateManager.WalState,org.apache.hadoop.fs.Path>state(TServerInstance instance, UUID uuid)voidwalUnreferenced(TServerInstance tsi, org.apache.hadoop.fs.Path path)
-
-
-
Field Detail
-
ZWALS
public static final String ZWALS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
WalStateManager
public WalStateManager(ServerContext context)
-
-
Method Detail
-
initWalMarker
public void initWalMarker(TServerInstance tsi) throws WalStateManager.WalMarkerException
-
addNewWalMarker
public void addNewWalMarker(TServerInstance tsi, org.apache.hadoop.fs.Path path) throws WalStateManager.WalMarkerException
-
walUnreferenced
public void walUnreferenced(TServerInstance tsi, org.apache.hadoop.fs.Path path) throws WalStateManager.WalMarkerException
-
getWalsInUse
public List<org.apache.hadoop.fs.Path> getWalsInUse(TServerInstance tsi) throws WalStateManager.WalMarkerException
-
getAllMarkers
public Map<TServerInstance,List<UUID>> getAllMarkers() throws WalStateManager.WalMarkerException
-
state
public Pair<WalStateManager.WalState,org.apache.hadoop.fs.Path> state(TServerInstance instance, UUID uuid) throws WalStateManager.WalMarkerException
-
getAllState
public Map<org.apache.hadoop.fs.Path,WalStateManager.WalState> getAllState() throws WalStateManager.WalMarkerException
-
removeWalMarker
public void removeWalMarker(TServerInstance instance, UUID uuid) throws WalStateManager.WalMarkerException
-
forget
public void forget(TServerInstance instance) throws WalStateManager.WalMarkerException
-
closeWal
public void closeWal(TServerInstance instance, org.apache.hadoop.fs.Path path) throws WalStateManager.WalMarkerException
-
-