@InterfaceAudience.Private class HFileArchiveManager extends Object
Modifier and Type | Field and Description |
---|---|
private String |
archiveZnode |
private static org.slf4j.Logger |
LOG |
private boolean |
stopped |
private ZKWatcher |
zooKeeper |
Constructor and Description |
---|
HFileArchiveManager(Connection connection,
org.apache.hadoop.conf.Configuration conf) |
Modifier and Type | Method and Description |
---|---|
private void |
disable(ZKWatcher zooKeeper,
byte[] table)
Disable all archiving of files for a given table
|
HFileArchiveManager |
disableHFileBackup()
Disable long-term archival of all hfiles for all tables in the cluster.
|
HFileArchiveManager |
disableHFileBackup(byte[] table)
Stop retaining HFiles for the given table in the archive.
|
private void |
enable(ZKWatcher zooKeeper,
byte[] table)
Perform a best effort enable of hfile retention, which relies on zookeeper communicating the
change back to the hfile cleaner.
|
HFileArchiveManager |
enableHFileBackup(byte[] table)
Turn on auto-backups of HFiles on the specified table.
|
private String |
getTableNode(byte[] table)
Get the zookeeper node associated with archiving the given table
|
boolean |
isArchivingEnabled(byte[] table)
Check to see if the table is currently marked for archiving
|
void |
stop() |
private final String archiveZnode
private static final org.slf4j.Logger LOG
private volatile boolean stopped
public HFileArchiveManager(Connection connection, org.apache.hadoop.conf.Configuration conf) throws ZooKeeperConnectionException, IOException
public HFileArchiveManager enableHFileBackup(byte[] table) throws org.apache.zookeeper.KeeperException
When HFiles would be deleted from the hfile archive, they are instead preserved.
table
- name of the table for which to preserve hfiles.org.apache.zookeeper.KeeperException
- if we can't reach zookeeper to update the hfile cleaner.public HFileArchiveManager disableHFileBackup(byte[] table) throws org.apache.zookeeper.KeeperException
HFileCleaner
, if the HFiles are
retained by another cleaner.table
- name of the table for which to disable hfile retention.org.apache.zookeeper.KeeperException
- if if we can't reach zookeeper to update the hfile cleaner.public HFileArchiveManager disableHFileBackup() throws IOException
IOException
- if the number of attempts is exceededprivate void enable(ZKWatcher zooKeeper, byte[] table) throws org.apache.zookeeper.KeeperException
No attempt is made to make sure that backups are successfully created - it is inherently an asynchronous operation.
zooKeeper
- watcher connection to zk clustertable
- table name on which to enable archivingorg.apache.zookeeper.KeeperException
- if a ZooKeeper operation failsprivate void disable(ZKWatcher zooKeeper, byte[] table) throws org.apache.zookeeper.KeeperException
Inherently an asynchronous operation.
zooKeeper
- watcher for the ZK clustertable
- name of the table to disableorg.apache.zookeeper.KeeperException
- if an unexpected ZK connection issues occurspublic void stop()
public boolean isArchivingEnabled(byte[] table) throws org.apache.zookeeper.KeeperException
table
- name of the table to checkorg.apache.zookeeper.KeeperException
- if an unexpected zookeeper error occursprivate String getTableNode(byte[] table)
table
- name of the table to checkCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.