Package org.apache.hadoop.hbase.client
Class AsyncTableRegionLocatorImpl
java.lang.Object
org.apache.hadoop.hbase.client.AsyncTableRegionLocatorImpl
- All Implemented Interfaces:
AsyncTableRegionLocator
The implementation of AsyncRegionLocator.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClear all the entries in the region location cache.Retrieves all of the regions associated with this table.getName()Gets the fully qualified table name instance of the table whose region we want to locate.getRegionLocation(byte[] row, int replicaId, boolean reload) Finds the region with the givenreplicaIdon which the given row is being served.getRegionLocations(byte[] row, boolean reload) Find all the replicas for the region on which the given row is being served.getRegionLocationsPage(byte[] startKey, int limit) Bulk lookup of region locations fromhbase:metain a single RPC, starting atstartKey(region start-key boundary, inclusive) and returning at mostlimitregions in start-key order.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.client.AsyncTableRegionLocator
getEndKeys, getRegionLocation, getRegionLocation, getRegionLocation, getRegionLocations, getStartEndKeys, getStartKeys
-
Field Details
-
tableName
-
conn
-
-
Constructor Details
-
AsyncTableRegionLocatorImpl
-
-
Method Details
-
getName
Description copied from interface:AsyncTableRegionLocatorGets the fully qualified table name instance of the table whose region we want to locate.- Specified by:
getNamein interfaceAsyncTableRegionLocator
-
getRegionLocation
public CompletableFuture<HRegionLocation> getRegionLocation(byte[] row, int replicaId, boolean reload) Description copied from interface:AsyncTableRegionLocatorFinds the region with the givenreplicaIdon which the given row is being served. Returns the location of the region with the givenreplicaIdto which the row belongs.- Specified by:
getRegionLocationin interfaceAsyncTableRegionLocator- Parameters:
row- Row to find.replicaId- the replica id of the regionreload- true to reload information or false to use cached information
-
getAllRegionLocations
Description copied from interface:AsyncTableRegionLocatorRetrieves all of the regions associated with this table. Usually we will go to meta table directly in this method so there is noreloadparameter. Notice that the location for region replicas other than the default replica are also returned.- Specified by:
getAllRegionLocationsin interfaceAsyncTableRegionLocator- Returns:
- a
Listof all regions associated with this table.
-
getRegionLocations
Description copied from interface:AsyncTableRegionLocatorFind all the replicas for the region on which the given row is being served.- Specified by:
getRegionLocationsin interfaceAsyncTableRegionLocator- Parameters:
row- Row to find.reload- true to reload information or false to use cached information- Returns:
- Locations for all the replicas of the row.
-
getRegionLocationsPage
Description copied from interface:AsyncTableRegionLocatorBulk lookup of region locations fromhbase:metain a single RPC, starting atstartKey(region start-key boundary, inclusive) and returning at mostlimitregions in start-key order. The returned list includes all replicas of each region (matchingAsyncTableRegionLocator.getAllRegionLocations()), and the result is also written to the connection's region location cache. Ordering: regions are returned in ascending region start-key order (the natural order ofhbase:metarows for a single table). Within each region, replicas are returned in ascending replica-id order (replica 0, then 1, then 2, ...). Split parents are filtered out, which may cause a page to contain fewer thanlimitregions but never disturbs ordering of the survivors. To page through all regions of a table, call repeatedly passinglast.getRegion().getEndKey()as the nextstartKey, wherelastis the final element of the previous response. All replicas of a region share the sameRegionInfo, so the last entry's end key is the correct cursor regardless of which replica it is. Passnullfor the first call. Stop paging when the returned list is empty or when the last region's end key isHConstants.EMPTY_END_ROW(zero-length) - that signals the end of the table; passing it back in would re-scan from the beginning since by convention an empty start key means "from the first region". UnlikeAsyncTableRegionLocator.getAllRegionLocations(), this method performs at most one RPC againsthbase:metaper invocation, so its latency is bounded bylimitrather than table size. The single-RPC behavior is best-effort: if the response would exceedhbase.client.scanner.max.result.size(default 2 MB), the server may split the slice across multipleScannerNextRPCs. For typical meta row sizes and default caching this rarely fires, but callers passing largelimitvalues against clusters with replicas or heavy meta rows should treat single-RPC as a soft guarantee, not absolute. Note that this method does not coordinate with other in-flight meta lookups on the connection - aggregate pacing across concurrent callers is the caller's responsibility. This method is optional. Implementations that cannot support paginated lookups will return a future that completes exceptionally withUnsupportedOperationException(the default behavior); callers should fall back toAsyncTableRegionLocator.getAllRegionLocations()in that case.- Specified by:
getRegionLocationsPagein interfaceAsyncTableRegionLocator- Parameters:
startKey- region start-key to begin scanning from (inclusive);nullor empty starts from the first regionlimit- maximum number of regions to return. If <= 0, falls back tohbase.meta.scanner.caching- this is a SOFT cap on a single page, NOT "all regions"; tables larger than the cap still require the caller to keep paging vialast.getRegion().getEndKey().- Returns:
- up to
limitHRegionLocations in start-key order, possibly empty when no more regions exist; errors are reported via the returned future
-
clearRegionLocationCache
Description copied from interface:AsyncTableRegionLocatorClear all the entries in the region location cache. This may cause performance issue so use it with caution.- Specified by:
clearRegionLocationCachein interfaceAsyncTableRegionLocator
-