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 and the replication machinery.The Master 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 replication mechanism needs to know when a log is closed and can be forwarded to the destination table.
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 master 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.
Even when a log is UNREFERENCED by the tablet server, the replication mechanism may still need the log. The GC will defer log removal until replication is finished with it.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
WalStateManager.WalMarkerException
static class
WalStateManager.WalState
-
Constructor Summary
Constructors Constructor Description WalStateManager(Instance instance, ZooReaderWriter zoo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addNewWalMarker(TServerInstance tsi, org.apache.hadoop.fs.Path path)
void
closeWal(TServerInstance instance, org.apache.hadoop.fs.Path path)
void
forget(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)
void
initWalMarker(TServerInstance tsi)
void
removeWalMarker(TServerInstance instance, UUID uuid)
Pair<WalStateManager.WalState,org.apache.hadoop.fs.Path>
state(TServerInstance instance, UUID uuid)
void
walUnreferenced(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(Instance instance, ZooReaderWriter zoo)
-
-
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
-
-