Class ZKTableArchiveClient
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable
-
Field Summary
Modifier and TypeFieldDescriptionprivate ClusterConnection
private static final String
Configuration key for the archive node. -
Constructor Summary
ConstructorDescriptionZKTableArchiveClient
(org.apache.hadoop.conf.Configuration conf, ClusterConnection connection) -
Method Summary
Modifier and TypeMethodDescriptionprivate HFileArchiveManager
void
Disable hfile backups for all tables.void
disableHFileBackup
(byte[] table) Disable hfile backups for the given table.void
disableHFileBackup
(String table) Disable hfile backups for the given table.void
enableHFileBackupAsync
(byte[] table) Turn on backups for all HFiles for the given table.static String
getArchiveZNode
(org.apache.hadoop.conf.Configuration conf, ZKWatcher zooKeeper) boolean
getArchivingEnabled
(byte[] table) Determine if archiving is enabled (but not necessarily fully propagated) for a tableboolean
getArchivingEnabled
(String table) Determine if archiving is enabled (but not necessarily fully propagated) for a tableMethods inherited from class org.apache.hadoop.conf.Configured
getConf, setConf
-
Field Details
-
ZOOKEEPER_ZNODE_HFILE_ARCHIVE_KEY
Configuration key for the archive node.- See Also:
-
connection
-
-
Constructor Details
-
ZKTableArchiveClient
public ZKTableArchiveClient(org.apache.hadoop.conf.Configuration conf, ClusterConnection connection)
-
-
Method Details
-
enableHFileBackupAsync
public void enableHFileBackupAsync(byte[] table) throws IOException, org.apache.zookeeper.KeeperException Turn on backups for all HFiles for the given table.All deleted hfiles are moved to the archive directory under the table directory, rather than being deleted.
If backups are already enabled for this table, does nothing.
If the table does not exist, the archiving the table's hfiles is still enabled as a future table with that name may be created shortly.
- Parameters:
table
- name of the table to start backing up- Throws:
IOException
- if an unexpected exception occursorg.apache.zookeeper.KeeperException
- if zookeeper can't be reached
-
disableHFileBackup
public void disableHFileBackup(String table) throws IOException, org.apache.zookeeper.KeeperException Disable hfile backups for the given table.Previously backed up files are still retained (if present).
Asynchronous operation - some extra HFiles may be retained, in the archive directory after disable is called, dependent on the latency in zookeeper to the servers.
- Parameters:
table
- name of the table stop backing up- Throws:
IOException
- if an unexpected exception occursorg.apache.zookeeper.KeeperException
- if zookeeper can't be reached
-
disableHFileBackup
public void disableHFileBackup(byte[] table) throws IOException, org.apache.zookeeper.KeeperException Disable hfile backups for the given table.Previously backed up files are still retained (if present).
Asynchronous operation - some extra HFiles may be retained, in the archive directory after disable is called, dependent on the latency in zookeeper to the servers.
- Parameters:
table
- name of the table stop backing up- Throws:
IOException
- if an unexpected exception occursorg.apache.zookeeper.KeeperException
- if zookeeper can't be reached
-
disableHFileBackup
Disable hfile backups for all tables.Previously backed up files are still retained (if present).
Asynchronous operation - some extra HFiles may be retained, in the archive directory after disable is called, dependent on the latency in zookeeper to the servers.
- Throws:
IOException
- if an unexpected exception occursorg.apache.zookeeper.KeeperException
- if zookeeper can't be reached
-
getArchivingEnabled
public boolean getArchivingEnabled(byte[] table) throws IOException, org.apache.zookeeper.KeeperException Determine if archiving is enabled (but not necessarily fully propagated) for a table- Parameters:
table
- name of the table to check- Returns:
- true if it is, false otherwise
- Throws:
IOException
- if a connection to ZooKeeper cannot be establishedorg.apache.zookeeper.KeeperException
- if a ZooKeeper operation fails
-
getArchivingEnabled
public boolean getArchivingEnabled(String table) throws IOException, org.apache.zookeeper.KeeperException Determine if archiving is enabled (but not necessarily fully propagated) for a table- Parameters:
table
- name of the table to check- Returns:
- true if it is, false otherwise
- Throws:
IOException
- if an unexpected network issue occursorg.apache.zookeeper.KeeperException
- if zookeeper can't be reached
-
createHFileArchiveManager
private HFileArchiveManager createHFileArchiveManager() throws org.apache.zookeeper.KeeperException, IOException- Returns:
- A new
HFileArchiveManager
to manage which tables' hfiles should be archived rather than deleted. - Throws:
org.apache.zookeeper.KeeperException
- if we can't reach zookeeperIOException
- if an unexpected network issue occurs
-
getArchiveZNode
public static String getArchiveZNode(org.apache.hadoop.conf.Configuration conf, ZKWatcher zooKeeper) - Parameters:
conf
- conf to read for the base archive nodezooKeeper
- zookeeper to used for building the full path- Returns:
- get the znode for long-term archival of a table for
-