@InterfaceAudience.Private public class AsyncMetaTableAccessor extends Object
hbase:meta
.Modifier and Type | Class and Description |
---|---|
private static class |
AsyncMetaTableAccessor.MetaTableScanResultConsumer |
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
private static char |
META_REPLICA_ID_DELIMITER
The delimiter for meta columns for replicaIds > 0
|
private static Pattern |
SERVER_COLUMN_PATTERN
A regex for parsing server columns from meta.
|
Constructor and Description |
---|
AsyncMetaTableAccessor() |
Modifier and Type | Method and Description |
---|---|
private static byte[] |
getCatalogFamily()
Returns the column family used for meta columns.
|
private static Optional<RegionInfo> |
getHRegionInfo(Result r,
byte[] qualifier)
Returns the RegionInfo object from the column
HConstants.CATALOG_FAMILY and
qualifier of the catalog table result. |
private static Scan |
getMetaScan(AsyncTable<?> metaTable,
int rowUpperLimit) |
private static byte[] |
getRegionInfoColumn()
Returns the column qualifier for serialized region info
|
static CompletableFuture<Optional<HRegionLocation>> |
getRegionLocation(AsyncTable<?> metaTable,
byte[] regionName)
Returns the HRegionLocation from meta for the given region
|
private static HRegionLocation |
getRegionLocation(Result r,
RegionInfo regionInfo,
int replicaId)
Returns the HRegionLocation parsed from the given meta row Result for the given regionInfo and
replicaId.
|
private static Optional<RegionLocations> |
getRegionLocations(Result r)
Returns an HRegionLocationList extracted from the result.
|
static CompletableFuture<Optional<HRegionLocation>> |
getRegionLocationWithEncodedName(AsyncTable<?> metaTable,
byte[] encodedRegionName)
Returns the HRegionLocation from meta for the given encoded region name
|
private static byte[] |
getSeqNumColumn(int replicaId)
Returns the column qualifier for seqNum column for replicaId
|
private static long |
getSeqNumDuringOpen(Result r,
int replicaId)
The latest seqnum that the server writing to meta observed when opening the region.
|
private static byte[] |
getServerColumn(int replicaId)
Returns the column qualifier for server column for replicaId
|
private static Optional<ServerName> |
getServerName(Result r,
int replicaId)
Returns a
ServerName from catalog table Result . |
private static byte[] |
getStartCodeColumn(int replicaId)
Returns the column qualifier for server start code column for replicaId
|
private static byte[] |
getStateColumn()
Returns the column qualifier for serialized table state
|
private static byte[] |
getTableFamily()
Returns the column family used for table columns.
|
static CompletableFuture<List<HRegionLocation>> |
getTableHRegionLocations(AsyncTable<AdvancedScanResultConsumer> metaTable,
TableName tableName)
Used to get all region locations for the specific table
|
private static CompletableFuture<List<Pair<RegionInfo,ServerName>>> |
getTableRegionsAndLocations(AsyncTable<AdvancedScanResultConsumer> metaTable,
TableName tableName,
boolean excludeOfflinedSplitParents)
Used to get table regions' info and server.
|
private static byte[] |
getTableStartRowForMeta(TableName tableName,
MetaTableAccessor.QueryType type) |
static CompletableFuture<Optional<TableState>> |
getTableState(AsyncTable<?> metaTable,
TableName tableName) |
private static Optional<TableState> |
getTableState(Result r) |
private static byte[] |
getTableStopRowForMeta(TableName tableName,
MetaTableAccessor.QueryType type) |
private static int |
parseReplicaIdFromServerColumn(byte[] serverColumn)
Parses the replicaId from the server column qualifier.
|
private static CompletableFuture<Void> |
scanMeta(AsyncTable<AdvancedScanResultConsumer> metaTable,
byte[] startRow,
byte[] stopRow,
MetaTableAccessor.QueryType type,
int maxRows,
MetaTableAccessor.Visitor visitor)
Performs a scan of META table for given table.
|
private static CompletableFuture<Void> |
scanMeta(AsyncTable<AdvancedScanResultConsumer> metaTable,
TableName tableName,
MetaTableAccessor.QueryType type,
MetaTableAccessor.Visitor visitor)
Performs a scan of META table for given table.
|
static CompletableFuture<Boolean> |
tableExists(AsyncTable<?> metaTable,
TableName tableName) |
private static final org.slf4j.Logger LOG
private static final char META_REPLICA_ID_DELIMITER
private static final Pattern SERVER_COLUMN_PATTERN
public AsyncMetaTableAccessor()
public static CompletableFuture<Boolean> tableExists(AsyncTable<?> metaTable, TableName tableName)
public static CompletableFuture<Optional<TableState>> getTableState(AsyncTable<?> metaTable, TableName tableName)
public static CompletableFuture<Optional<HRegionLocation>> getRegionLocation(AsyncTable<?> metaTable, byte[] regionName)
public static CompletableFuture<Optional<HRegionLocation>> getRegionLocationWithEncodedName(AsyncTable<?> metaTable, byte[] encodedRegionName)
private static Optional<TableState> getTableState(Result r) throws IOException
IOException
public static CompletableFuture<List<HRegionLocation>> getTableHRegionLocations(AsyncTable<AdvancedScanResultConsumer> metaTable, TableName tableName)
metaTable
- scanner over meta tabletableName
- table we're looking for, can be null for getting all regionsCompletableFuture
.private static CompletableFuture<List<Pair<RegionInfo,ServerName>>> getTableRegionsAndLocations(AsyncTable<AdvancedScanResultConsumer> metaTable, TableName tableName, boolean excludeOfflinedSplitParents)
metaTable
- scanner over meta tabletableName
- table we're looking for, can be null for getting all regionsexcludeOfflinedSplitParents
- don't return split parentsCompletableFuture
.private static CompletableFuture<Void> scanMeta(AsyncTable<AdvancedScanResultConsumer> metaTable, TableName tableName, MetaTableAccessor.QueryType type, MetaTableAccessor.Visitor visitor)
metaTable
- scanner over meta tabletableName
- table within we scantype
- scanned part of metavisitor
- Visitor invoked against each rowprivate static CompletableFuture<Void> scanMeta(AsyncTable<AdvancedScanResultConsumer> metaTable, byte[] startRow, byte[] stopRow, MetaTableAccessor.QueryType type, int maxRows, MetaTableAccessor.Visitor visitor)
metaTable
- scanner over meta tablestartRow
- Where to start the scanstopRow
- Where to stop the scantype
- scanned part of metamaxRows
- maximum rows to returnvisitor
- Visitor invoked against each rowprivate static Scan getMetaScan(AsyncTable<?> metaTable, int rowUpperLimit)
private static Optional<RegionLocations> getRegionLocations(Result r)
private static HRegionLocation getRegionLocation(Result r, RegionInfo regionInfo, int replicaId)
r
- the meta row resultregionInfo
- RegionInfo for default replicareplicaId
- the replicaId for the HRegionLocationprivate static Optional<ServerName> getServerName(Result r, int replicaId)
ServerName
from catalog table Result
.r
- Result to pull fromprivate static long getSeqNumDuringOpen(Result r, int replicaId)
getServerName(Result, int)
was written.r
- Result to pull the seqNum fromprivate static byte[] getTableStartRowForMeta(TableName tableName, MetaTableAccessor.QueryType type)
tableName
- table we're working withprivate static byte[] getTableStopRowForMeta(TableName tableName, MetaTableAccessor.QueryType type)
tableName
- table we're working withprivate static Optional<RegionInfo> getHRegionInfo(Result r, byte[] qualifier)
HConstants.CATALOG_FAMILY
and
qualifier
of the catalog table result.r
- a Result object from the catalog table scanqualifier
- Column family qualifierprivate static byte[] getCatalogFamily()
private static byte[] getTableFamily()
private static byte[] getRegionInfoColumn()
private static byte[] getStateColumn()
private static byte[] getServerColumn(int replicaId)
replicaId
- the replicaId of the regionprivate static byte[] getStartCodeColumn(int replicaId)
replicaId
- the replicaId of the regionprivate static byte[] getSeqNumColumn(int replicaId)
replicaId
- the replicaId of the regionprivate static int parseReplicaIdFromServerColumn(byte[] serverColumn)
serverColumn
- the column qualifierCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.