org.apache.hadoop.hbase.snapshot
Class SnapshotManifest

java.lang.Object
  extended by org.apache.hadoop.hbase.snapshot.SnapshotManifest

@InterfaceAudience.Private
public class SnapshotManifest
extends Object

Utility class to help read/write the Snapshot Manifest. The snapshot format is transparent for the users of this class, once the snapshot is written, it will never be modified. On open() the snapshot will be loaded to the current in-memory format.


Field Summary
static String DATA_MANIFEST_NAME
           
static String SNAPSHOT_MANIFEST_SIZE_LIMIT_CONF_KEY
           
 
Method Summary
 void addRegion(HRegion region)
          Creates a 'manifest' for the specified region, by reading directly from the HRegion object.
 void addRegion(org.apache.hadoop.fs.Path tableDir, HRegionInfo regionInfo)
          Creates a 'manifest' for the specified region, by reading directly from the disk.
 void addTableDescriptor(HTableDescriptor htd)
          Add the table descriptor to the snapshot manifest
 void consolidate()
           
static SnapshotManifest create(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path workingDir, HBaseProtos.SnapshotDescription desc, ForeignExceptionSnare monitor)
          Return a SnapshotManifest instance, used for writing a snapshot.
static ThreadPoolExecutor createExecutor(org.apache.hadoop.conf.Configuration conf, String name)
           
 List<SnapshotProtos.SnapshotRegionManifest> getRegionManifests()
          Get all the Region Manifest from the snapshot
 Map<String,SnapshotProtos.SnapshotRegionManifest> getRegionManifestsMap()
          Get all the Region Manifest from the snapshot.
 HBaseProtos.SnapshotDescription getSnapshotDescription()
          Get the SnapshotDescription
 org.apache.hadoop.fs.Path getSnapshotDir()
          Get the current snapshot working dir
 HTableDescriptor getTableDescriptor()
          Get the table descriptor from the Snapshot
static SnapshotManifest open(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path workingDir, HBaseProtos.SnapshotDescription desc)
          Return a SnapshotManifest instance with the information already loaded in-memory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SNAPSHOT_MANIFEST_SIZE_LIMIT_CONF_KEY

public static final String SNAPSHOT_MANIFEST_SIZE_LIMIT_CONF_KEY
See Also:
Constant Field Values

DATA_MANIFEST_NAME

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

create

public static SnapshotManifest create(org.apache.hadoop.conf.Configuration conf,
                                      org.apache.hadoop.fs.FileSystem fs,
                                      org.apache.hadoop.fs.Path workingDir,
                                      HBaseProtos.SnapshotDescription desc,
                                      ForeignExceptionSnare monitor)
Return a SnapshotManifest instance, used for writing a snapshot. There are two usage pattern: - The Master will create a manifest, add the descriptor, offline regions and consolidate the snapshot by writing all the pending stuff on-disk. manifest = SnapshotManifest.create(...) manifest.addRegion(tableDir, hri) manifest.consolidate() - The RegionServer will create a single region manifest manifest = SnapshotManifest.create(...) manifest.addRegion(region)


open

public static SnapshotManifest open(org.apache.hadoop.conf.Configuration conf,
                                    org.apache.hadoop.fs.FileSystem fs,
                                    org.apache.hadoop.fs.Path workingDir,
                                    HBaseProtos.SnapshotDescription desc)
                             throws IOException
Return a SnapshotManifest instance with the information already loaded in-memory. SnapshotManifest manifest = SnapshotManifest.open(...) HTableDescriptor htd = manifest.getTableDescriptor() for (SnapshotRegionManifest regionManifest: manifest.getRegionManifests()) hri = regionManifest.getRegionInfo() for (regionManifest.getFamilyFiles()) ...

Throws:
IOException

addTableDescriptor

public void addTableDescriptor(HTableDescriptor htd)
                        throws IOException
Add the table descriptor to the snapshot manifest

Throws:
IOException

addRegion

public void addRegion(HRegion region)
               throws IOException
Creates a 'manifest' for the specified region, by reading directly from the HRegion object. This is used by the "online snapshot" when the table is enabled.

Throws:
IOException

addRegion

public void addRegion(org.apache.hadoop.fs.Path tableDir,
                      HRegionInfo regionInfo)
               throws IOException
Creates a 'manifest' for the specified region, by reading directly from the disk. This is used by the "offline snapshot" when the table is disabled.

Throws:
IOException

getSnapshotDir

public org.apache.hadoop.fs.Path getSnapshotDir()
Get the current snapshot working dir


getSnapshotDescription

public HBaseProtos.SnapshotDescription getSnapshotDescription()
Get the SnapshotDescription


getTableDescriptor

public HTableDescriptor getTableDescriptor()
Get the table descriptor from the Snapshot


getRegionManifests

public List<SnapshotProtos.SnapshotRegionManifest> getRegionManifests()
Get all the Region Manifest from the snapshot


getRegionManifestsMap

public Map<String,SnapshotProtos.SnapshotRegionManifest> getRegionManifestsMap()
Get all the Region Manifest from the snapshot. This is an helper to get a map with the region encoded name


consolidate

public void consolidate()
                 throws IOException
Throws:
IOException

createExecutor

public static ThreadPoolExecutor createExecutor(org.apache.hadoop.conf.Configuration conf,
                                                String name)


Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.