public class MetaReader extends Object
.META.
.Modifier and Type | Class and Description |
---|---|
static interface |
MetaReader.Visitor
Implementations 'visit' a catalog table row.
|
Constructor and Description |
---|
MetaReader() |
Modifier and Type | Method and Description |
---|---|
static List<Result> |
fullScan(CatalogTracker catalogTracker)
Performs a full scan of
.META. . |
static void |
fullScan(CatalogTracker catalogTracker,
MetaReader.Visitor visitor)
Performs a full scan of
.META. . |
static void |
fullScan(CatalogTracker catalogTracker,
MetaReader.Visitor visitor,
byte[] startrow)
Performs a full scan of
.META. . |
static Map<HRegionInfo,ServerName> |
fullScan(CatalogTracker catalogTracker,
Set<String> disabledTables)
Performs a full scan of
.META. , skipping regions from any
tables in the specified set of disabled tables. |
static Map<HRegionInfo,ServerName> |
fullScan(CatalogTracker catalogTracker,
Set<String> disabledTables,
boolean excludeOfflinedSplitParents)
Performs a full scan of
.META. , skipping regions from any
tables in the specified set of disabled tables. |
static void |
fullScan(HRegionInterface hRegionInterface,
MetaReader.Visitor visitor,
byte[] regionName,
byte[] startrow)
Deprecated.
Does not retry; use fullScan xxx instead.
x
|
static void |
fullScanMetaAndPrint(CatalogTracker catalogTracker) |
static List<Result> |
fullScanOfRoot(CatalogTracker catalogTracker)
Performs a full scan of a
-ROOT- table. |
static PairOfSameType<HRegionInfo> |
getDaughterRegions(Result data)
Returns the daughter regions by reading the corresponding columns of the catalog table
Result.
|
static Pair<HRegionInfo,ServerName> |
getRegion(CatalogTracker catalogTracker,
byte[] regionName)
Gets the region info and assignment for the specified region.
|
static Scan |
getScanForTableName(byte[] tableName)
This method creates a Scan object that will only scan catalog rows that
belong to the specified table.
|
static ServerName |
getServerNameFromCatalogResult(Result r)
Extract a
ServerName
For use on catalog table Result . |
static NavigableMap<HRegionInfo,Result> |
getServerUserRegions(CatalogTracker catalogTracker,
ServerName serverName) |
static List<HRegionInfo> |
getTableRegions(CatalogTracker catalogTracker,
byte[] tableName)
Gets all of the regions of the specified table.
|
static List<HRegionInfo> |
getTableRegions(CatalogTracker catalogTracker,
byte[] tableName,
boolean excludeOfflinedSplitParents)
Gets all of the regions of the specified table.
|
static List<Pair<HRegionInfo,ServerName>> |
getTableRegionsAndLocations(CatalogTracker catalogTracker,
byte[] tableName,
boolean excludeOfflinedSplitParents) |
static List<Pair<HRegionInfo,ServerName>> |
getTableRegionsAndLocations(CatalogTracker catalogTracker,
String tableName) |
static Pair<HRegionInfo,ServerName> |
parseCatalogResult(Result r)
Extract a HRegionInfo and ServerName.
|
static HRegionInfo |
parseHRegionInfoFromCatalogResult(Result r,
byte[] qualifier)
Parse the content of the cell at
HConstants.CATALOG_FAMILY and
qualifier as an HRegionInfo and return it, or null. |
static ServerName |
readMetaLocation(HRegionInterface metaServer)
Deprecated.
Does not retry; use #getMetaRegionLocation(CatalogTracker)
|
static boolean |
tableExists(CatalogTracker catalogTracker,
String tableName)
Checks if the specified table exists.
|
public static Map<HRegionInfo,ServerName> fullScan(CatalogTracker catalogTracker, Set<String> disabledTables) throws IOException
.META.
, skipping regions from any
tables in the specified set of disabled tables.catalogTracker
- disabledTables
- set of disabled tables that will not be returnedIOException
public static Map<HRegionInfo,ServerName> fullScan(CatalogTracker catalogTracker, Set<String> disabledTables, boolean excludeOfflinedSplitParents) throws IOException
.META.
, skipping regions from any
tables in the specified set of disabled tables.catalogTracker
- disabledTables
- set of disabled tables that will not be returnedexcludeOfflinedSplitParents
- If true, do not include offlined split
parents in the return.IOException
public static List<Result> fullScan(CatalogTracker catalogTracker) throws IOException
.META.
.Result
IOException
public static List<Result> fullScanOfRoot(CatalogTracker catalogTracker) throws IOException
-ROOT-
table.Result
IOException
public static void fullScan(CatalogTracker catalogTracker, MetaReader.Visitor visitor) throws IOException
.META.
.catalogTracker
- visitor
- Visitor invoked against each row.IOException
public static void fullScan(CatalogTracker catalogTracker, MetaReader.Visitor visitor, byte[] startrow) throws IOException
.META.
.catalogTracker
- visitor
- Visitor invoked against each row.startrow
- Where to start the scan. Pass null if want to begin scan
at first row (The visitor will stop the Scan when its done so no need to
pass a stoprow).IOException
public static ServerName readMetaLocation(HRegionInterface metaServer) throws IOException
metaServer
- connection to server hosting ROOTIOException
public static Pair<HRegionInfo,ServerName> getRegion(CatalogTracker catalogTracker, byte[] regionName) throws IOException
catalogTracker
- regionName
- Region to lookup.regionName
IOException
public static ServerName getServerNameFromCatalogResult(Result r)
ServerName
For use on catalog table Result
.r
- Result to pull frompublic static Pair<HRegionInfo,ServerName> parseCatalogResult(Result r) throws IOException
Result
.r
- Result to pull fromHRegionInfo
and the ServerName
(or null for server address if no address set in .META.).IOException
public static HRegionInfo parseHRegionInfoFromCatalogResult(Result r, byte[] qualifier) throws IOException
HConstants.CATALOG_FAMILY
and
qualifier
as an HRegionInfo and return it, or null.
For use on catalog table Result
.r
- Result instance to pull from.qualifier
- Column family qualifier -- either
HConstants.SPLITA_QUALIFIER
, HConstants.SPLITB_QUALIFIER
or
HConstants.REGIONINFO_QUALIFIER
.IOException
public static boolean tableExists(CatalogTracker catalogTracker, String tableName) throws IOException
catalogTracker
- tableName
- table to checkIOException
public static PairOfSameType<HRegionInfo> getDaughterRegions(Result data) throws IOException
data
- a Result object from the catalog table scanIOException
public static List<HRegionInfo> getTableRegions(CatalogTracker catalogTracker, byte[] tableName) throws IOException
catalogTracker
- tableName
- HRegionInfo
.IOException
public static List<HRegionInfo> getTableRegions(CatalogTracker catalogTracker, byte[] tableName, boolean excludeOfflinedSplitParents) throws IOException
catalogTracker
- tableName
- excludeOfflinedSplitParents
- If true, do not include offlined split
parents in the return.HRegionInfo
.IOException
public static Scan getScanForTableName(byte[] tableName)
tableName
- bytes of table's namepublic static List<Pair<HRegionInfo,ServerName>> getTableRegionsAndLocations(CatalogTracker catalogTracker, String tableName) throws IOException, InterruptedException
catalogTracker
- tableName
- IOException
InterruptedException
public static List<Pair<HRegionInfo,ServerName>> getTableRegionsAndLocations(CatalogTracker catalogTracker, byte[] tableName, boolean excludeOfflinedSplitParents) throws IOException, InterruptedException
catalogTracker
- tableName
- IOException
InterruptedException
public static NavigableMap<HRegionInfo,Result> getServerUserRegions(CatalogTracker catalogTracker, ServerName serverName) throws IOException
catalogTracker
- serverName
- IOException
public static void fullScanMetaAndPrint(CatalogTracker catalogTracker) throws IOException
IOException
public static void fullScan(HRegionInterface hRegionInterface, MetaReader.Visitor visitor, byte[] regionName, byte[] startrow) throws IOException
hRegionInterface
- region servervisitor
- visitorregionName
- name of regionstartrow
- start rowIOException
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.