public class WalStateManager extends Object
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.
| Modifier and Type | Class and Description |
|---|---|
class |
WalStateManager.WalMarkerException |
static class |
WalStateManager.WalState |
| Constructor and Description |
|---|
WalStateManager(Instance instance,
ZooReaderWriter zoo) |
| Modifier and Type | Method and 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) |
public static final String ZWALS
public WalStateManager(Instance instance, ZooReaderWriter zoo)
public void initWalMarker(TServerInstance tsi) throws WalStateManager.WalMarkerException
public void addNewWalMarker(TServerInstance tsi, org.apache.hadoop.fs.Path path) throws WalStateManager.WalMarkerException
public void walUnreferenced(TServerInstance tsi, org.apache.hadoop.fs.Path path) throws WalStateManager.WalMarkerException
public List<org.apache.hadoop.fs.Path> getWalsInUse(TServerInstance tsi) throws WalStateManager.WalMarkerException
public Map<TServerInstance,List<UUID>> getAllMarkers() throws WalStateManager.WalMarkerException
public Pair<WalStateManager.WalState,org.apache.hadoop.fs.Path> state(TServerInstance instance, UUID uuid) throws WalStateManager.WalMarkerException
public Map<org.apache.hadoop.fs.Path,WalStateManager.WalState> getAllState() throws WalStateManager.WalMarkerException
public void removeWalMarker(TServerInstance instance, UUID uuid) throws WalStateManager.WalMarkerException
public void forget(TServerInstance instance) throws WalStateManager.WalMarkerException
public void closeWal(TServerInstance instance, org.apache.hadoop.fs.Path path) throws WalStateManager.WalMarkerException
Copyright © 2011–2018 The Apache Software Foundation. All rights reserved.