Package org.apache.hadoop.hbase.snapshot
Class SnapshotRegionLocator
java.lang.Object
org.apache.hadoop.hbase.snapshot.SnapshotRegionLocator
- All Implemented Interfaces:
Closeable
,AutoCloseable
,RegionLocator
RegionLocator
built using the most recent full backup's snapshot manifest for a given
table. Useful for aligning any subsequent incremental backups along the same splits as the full
backup-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ServerName
private final List<HRegionLocation>
private final TreeMap<byte[],
SnapshotRegionLocator.HRegionReplicas> private static final String
private final TableName
Fields inherited from interface org.apache.hadoop.hbase.client.RegionLocator
LOCATOR_META_REPLICAS_MODE, LOCATOR_META_REPLICAS_MODE_LOADBALANCE_SELECTOR
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
SnapshotRegionLocator
(TableName tableName, TreeMap<byte[], SnapshotRegionLocator.HRegionReplicas> regions, List<HRegionLocation> rawLocations) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear all the entries in the region location cache.void
close()
static SnapshotRegionLocator
Retrieves all of the regions associated with this table.getName()
Gets the fully qualified table name instance of this table.getRegionLocation
(byte[] row, int replicaId, boolean reload) Finds the region with the given replica id on 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.private static String
static void
setSnapshotManifestDir
(org.apache.hadoop.conf.Configuration conf, String dir, TableName table) static boolean
shouldUseSnapshotRegionLocator
(org.apache.hadoop.conf.Configuration conf, TableName table) private static SnapshotRegionLocator.SnapshotHRegionLocation
toLocation
(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionInfo ri, TableName tableName) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.hadoop.hbase.client.RegionLocator
getEndKeys, getRegionLocation, getRegionLocation, getRegionLocation, getRegionLocations, getStartEndKeys, getStartKeys
-
Field Details
-
SNAPSHOT_MANIFEST_DIR_PREFIX
- See Also:
-
FAKE_SERVER_NAME
-
tableName
-
regions
-
rawLocations
-
-
Constructor Details
-
SnapshotRegionLocator
private SnapshotRegionLocator(TableName tableName, TreeMap<byte[], SnapshotRegionLocator.HRegionReplicas> regions, List<HRegionLocation> rawLocations)
-
-
Method Details
-
create
public static SnapshotRegionLocator create(org.apache.hadoop.conf.Configuration conf, TableName table) throws IOException - Throws:
IOException
-
getRegionLocation
public HRegionLocation getRegionLocation(byte[] row, int replicaId, boolean reload) throws IOException Description copied from interface:RegionLocator
Finds the region with the given replica id on which the given row is being served.- Specified by:
getRegionLocation
in interfaceRegionLocator
- Parameters:
row
- Row to find.replicaId
- the replica idreload
- true to reload information or false to use cached information- Returns:
- Location of the row.
- Throws:
IOException
- if a remote or network exception occurs
-
getRegionLocations
Description copied from interface:RegionLocator
Find all the replicas for the region on which the given row is being served.- Specified by:
getRegionLocations
in interfaceRegionLocator
- 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.
- Throws:
IOException
- if a remote or network exception occurs
-
clearRegionLocationCache
Description copied from interface:RegionLocator
Clear all the entries in the region location cache. This may cause performance issue so use it with caution.- Specified by:
clearRegionLocationCache
in interfaceRegionLocator
-
getAllRegionLocations
Description copied from interface:RegionLocator
Retrieves all of the regions associated with this table. Usually we will go to meta table directly in this method so there is noreload
parameter. Notice that the location for region replicas other than the default replica are also returned.- Specified by:
getAllRegionLocations
in interfaceRegionLocator
- Returns:
- a
List
of all regions associated with this table. - Throws:
IOException
- if a remote or network exception occurs
-
getName
Description copied from interface:RegionLocator
Gets the fully qualified table name instance of this table.- Specified by:
getName
in interfaceRegionLocator
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
shouldUseSnapshotRegionLocator
public static boolean shouldUseSnapshotRegionLocator(org.apache.hadoop.conf.Configuration conf, TableName table) -
setSnapshotManifestDir
public static void setSnapshotManifestDir(org.apache.hadoop.conf.Configuration conf, String dir, TableName table) -
getSnapshotManifestDirKey
-
toLocation
private static SnapshotRegionLocator.SnapshotHRegionLocation toLocation(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionInfo ri, TableName tableName)
-