Package org.apache.hadoop.hbase
Class ClientMetaTableAccessor
java.lang.Object
org.apache.hadoop.hbase.ClientMetaTableAccessor
The (asynchronous) meta table accessor used at client side. Used to read/write region and
assignment information store in
hbase:meta.- Since:
- 2.0.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceImplementations 'visit' a catalog table row but with close() at the end.(package private) static classCollects all returned.private static classAClientMetaTableAccessor.Visitorthat collects content out of passedResult.(package private) static classprivate static final classstatic enumstatic interfaceImplementations 'visit' a catalog table row. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static ScangetMetaScan(AsyncTable<?> metaTable, int rowUpperLimit) static CompletableFuture<Optional<HRegionLocation>>getRegionLocation(AsyncTable<?> metaTable, byte[] regionName) Returns the HRegionLocation from meta for the given regionprivate static Optional<RegionLocations>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 namestatic CompletableFuture<List<HRegionLocation>>getTableHRegionLocations(AsyncTable<AdvancedScanResultConsumer> metaTable, TableName tableName) Used to get all region locations for the specific tableprivate static CompletableFuture<List<Pair<RegionInfo,ServerName>>> getTableRegionsAndLocations(AsyncTable<AdvancedScanResultConsumer> metaTable, TableName tableName, boolean excludeOfflinedSplitParents) Used to get table regions' info and server.static byte[]getTableStartRowForMeta(TableName tableName, ClientMetaTableAccessor.QueryType type) Returns start row for scanning META according to query typestatic CompletableFuture<Optional<TableState>>getTableState(AsyncTable<?> metaTable, TableName tableName) private static Optional<TableState>static byte[]getTableStopRowForMeta(TableName tableName, ClientMetaTableAccessor.QueryType type) Returns stop row for scanning META according to query typeprivate static CompletableFuture<Void>scanMeta(AsyncTable<AdvancedScanResultConsumer> metaTable, byte[] startRow, byte[] stopRow, ClientMetaTableAccessor.QueryType type, int maxRows, ClientMetaTableAccessor.Visitor visitor) Performs a scan of META table for given table.private static CompletableFuture<Void>scanMeta(AsyncTable<AdvancedScanResultConsumer> metaTable, TableName tableName, ClientMetaTableAccessor.QueryType type, ClientMetaTableAccessor.Visitor visitor) Performs a scan of META table for given table.static CompletableFuture<Boolean>tableExists(AsyncTable<?> metaTable, TableName tableName)
-
Field Details
-
LOG
-
-
Constructor Details
-
ClientMetaTableAccessor
private ClientMetaTableAccessor()
-
-
Method Details
-
tableExists
-
getTableState
public static CompletableFuture<Optional<TableState>> getTableState(AsyncTable<?> metaTable, TableName tableName) -
getRegionLocation
public static CompletableFuture<Optional<HRegionLocation>> getRegionLocation(AsyncTable<?> metaTable, byte[] regionName) Returns the HRegionLocation from meta for the given region -
getRegionLocationWithEncodedName
public static CompletableFuture<Optional<HRegionLocation>> getRegionLocationWithEncodedName(AsyncTable<?> metaTable, byte[] encodedRegionName) Returns the HRegionLocation from meta for the given encoded region name -
getTableState
- Throws:
IOException
-
getTableHRegionLocations
public static CompletableFuture<List<HRegionLocation>> getTableHRegionLocations(AsyncTable<AdvancedScanResultConsumer> metaTable, TableName tableName) Used to get all region locations for the specific table- Parameters:
metaTable- scanner over meta tabletableName- table we're looking for, can be null for getting all regions- Returns:
- the list of region locations. The return value will be wrapped by a
CompletableFuture.
-
getTableRegionsAndLocations
private static CompletableFuture<List<Pair<RegionInfo,ServerName>>> getTableRegionsAndLocations(AsyncTable<AdvancedScanResultConsumer> metaTable, TableName tableName, boolean excludeOfflinedSplitParents) Used to get table regions' info and server.- Parameters:
metaTable- scanner over meta tabletableName- table we're looking for, can be null for getting all regionsexcludeOfflinedSplitParents- don't return split parents- Returns:
- the list of regioninfos and server. The return value will be wrapped by a
CompletableFuture.
-
scanMeta
private static CompletableFuture<Void> scanMeta(AsyncTable<AdvancedScanResultConsumer> metaTable, TableName tableName, ClientMetaTableAccessor.QueryType type, ClientMetaTableAccessor.Visitor visitor) Performs a scan of META table for given table.- Parameters:
metaTable- scanner over meta tabletableName- table within we scantype- scanned part of metavisitor- Visitor invoked against each row
-
scanMeta
private static CompletableFuture<Void> scanMeta(AsyncTable<AdvancedScanResultConsumer> metaTable, byte[] startRow, byte[] stopRow, ClientMetaTableAccessor.QueryType type, int maxRows, ClientMetaTableAccessor.Visitor visitor) Performs a scan of META table for given table.- Parameters:
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 row
-
getMetaScan
-
getRegionLocations
Returns an HRegionLocationList extracted from the result. -
getTableStartRowForMeta
public static byte[] getTableStartRowForMeta(TableName tableName, ClientMetaTableAccessor.QueryType type) Returns start row for scanning META according to query type -
getTableStopRowForMeta
public static byte[] getTableStopRowForMeta(TableName tableName, ClientMetaTableAccessor.QueryType type) Returns stop row for scanning META according to query type
-