org.apache.hadoop.hbase.backup.example
Class TableHFileArchiveTracker

java.lang.Object
  extended by org.apache.hadoop.hbase.zookeeper.ZooKeeperListener
      extended by org.apache.hadoop.hbase.backup.example.TableHFileArchiveTracker

@InterfaceAudience.Private
public class TableHFileArchiveTracker
extends ZooKeeperListener

Track HFile archiving state changes in ZooKeeper. Keeps track of the tables whose HFiles should be kept in the archive.

start() needs to be called to start monitoring for tables to archive.


Field Summary
static String HFILE_ARCHIVE_ZNODE_PARENT
           
 
Fields inherited from class org.apache.hadoop.hbase.zookeeper.ZooKeeperListener
watcher
 
Method Summary
static TableHFileArchiveTracker create(org.apache.hadoop.conf.Configuration conf)
          Create an archive tracker for the passed in server
 HFileArchiveTableMonitor getMonitor()
           
 ZooKeeperWatcher getZooKeeperWatcher()
           
 boolean keepHFiles(String tableName)
          Determine if the given table should or should not allow its hfiles to be deleted
 void nodeChildrenChanged(String path)
          Called when an existing node has a child node added or removed.
 void nodeCreated(String path)
          Called when a new node has been created.
 void nodeDeleted(String path)
          Called when a node has been deleted
 void start()
          Start monitoring for archive updates
 void stop()
          Stop this tracker and the passed zookeeper
 
Methods inherited from class org.apache.hadoop.hbase.zookeeper.ZooKeeperListener
getWatcher, nodeDataChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HFILE_ARCHIVE_ZNODE_PARENT

public static final String HFILE_ARCHIVE_ZNODE_PARENT
See Also:
Constant Field Values
Method Detail

start

public void start()
           throws org.apache.zookeeper.KeeperException
Start monitoring for archive updates

Throws:
org.apache.zookeeper.KeeperException - on failure to find/create nodes

nodeCreated

public void nodeCreated(String path)
Description copied from class: ZooKeeperListener
Called when a new node has been created.

Overrides:
nodeCreated in class ZooKeeperListener
Parameters:
path - full path of the new node

nodeChildrenChanged

public void nodeChildrenChanged(String path)
Description copied from class: ZooKeeperListener
Called when an existing node has a child node added or removed.

Overrides:
nodeChildrenChanged in class ZooKeeperListener
Parameters:
path - full path of the node whose children have changed

nodeDeleted

public void nodeDeleted(String path)
Description copied from class: ZooKeeperListener
Called when a node has been deleted

Overrides:
nodeDeleted in class ZooKeeperListener
Parameters:
path - full path of the deleted node

keepHFiles

public boolean keepHFiles(String tableName)
Determine if the given table should or should not allow its hfiles to be deleted

Parameters:
tableName - name of the table to check
Returns:
true if its store files should be retained, false otherwise

getMonitor

public final HFileArchiveTableMonitor getMonitor()
Returns:
the tracker for which tables should be archived.

create

public static TableHFileArchiveTracker create(org.apache.hadoop.conf.Configuration conf)
                                       throws ZooKeeperConnectionException,
                                              IOException
Create an archive tracker for the passed in server

Parameters:
conf - to read for zookeeper connection information
Returns:
ZooKeeper tracker to monitor for this server if this server should archive hfiles for a given table
Throws:
IOException - If a unexpected exception occurs
ZooKeeperConnectionException - if we can't reach zookeeper

getZooKeeperWatcher

public ZooKeeperWatcher getZooKeeperWatcher()

stop

public void stop()
Stop this tracker and the passed zookeeper



Copyright © 2015 The Apache Software Foundation. All rights reserved.