Class HFileArchiveManager
java.lang.Object
org.apache.hadoop.hbase.backup.example.HFileArchiveManager
Client-side manager for which table's hfiles should be preserved for long-term archive.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionHFileArchiveManager
(Connection connection, org.apache.hadoop.conf.Configuration conf) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
Disable all archiving of files for a given tableDisable long-term archival of all hfiles for all tables in the cluster.disableHFileBackup
(byte[] table) Stop retaining HFiles for the given table in the archive.private void
Perform a best effort enable of hfile retention, which relies on zookeeper communicating the change back to the hfile cleaner.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 tableboolean
isArchivingEnabled
(byte[] table) Check to see if the table is currently marked for archivingvoid
stop()
-
Field Details
-
archiveZnode
-
LOG
-
zooKeeper
-
stopped
-
-
Constructor Details
-
HFileArchiveManager
public HFileArchiveManager(Connection connection, org.apache.hadoop.conf.Configuration conf) throws ZooKeeperConnectionException, IOException
-
-
Method Details
-
enableHFileBackup
public HFileArchiveManager enableHFileBackup(byte[] table) throws org.apache.zookeeper.KeeperException Turn on auto-backups of HFiles on the specified table.When HFiles would be deleted from the hfile archive, they are instead preserved.
- Parameters:
table
- name of the table for which to preserve hfiles.- Returns:
- this for chaining.
- Throws:
org.apache.zookeeper.KeeperException
- if we can't reach zookeeper to update the hfile cleaner.
-
disableHFileBackup
public HFileArchiveManager disableHFileBackup(byte[] table) throws org.apache.zookeeper.KeeperException Stop retaining HFiles for the given table in the archive. HFiles will be cleaned up on the next pass of theHFileCleaner
, if the HFiles are retained by another cleaner.- Parameters:
table
- name of the table for which to disable hfile retention.- Returns:
- this for chaining.
- Throws:
org.apache.zookeeper.KeeperException
- if if we can't reach zookeeper to update the hfile cleaner.
-
disableHFileBackup
Disable long-term archival of all hfiles for all tables in the cluster.- Returns:
- this for chaining.
- Throws:
IOException
- if the number of attempts is exceeded
-
enable
Perform a best effort enable of hfile retention, which relies on zookeeper communicating the change back to the hfile cleaner.No attempt is made to make sure that backups are successfully created - it is inherently an asynchronous operation.
- Parameters:
zooKeeper
- watcher connection to zk clustertable
- table name on which to enable archiving- Throws:
org.apache.zookeeper.KeeperException
- if a ZooKeeper operation fails
-
disable
Disable all archiving of files for a given tableInherently an asynchronous operation.
- Parameters:
zooKeeper
- watcher for the ZK clustertable
- name of the table to disable- Throws:
org.apache.zookeeper.KeeperException
- if an unexpected ZK connection issues occurs
-
stop
-
isArchivingEnabled
Check to see if the table is currently marked for archiving- Parameters:
table
- name of the table to check- Returns:
- true if the archive znode for that table exists, false if not
- Throws:
org.apache.zookeeper.KeeperException
- if an unexpected zookeeper error occurs
-
getTableNode
Get the zookeeper node associated with archiving the given table- Parameters:
table
- name of the table to check- Returns:
- znode for the table's archive status
-