@InterfaceAudience.Private @InterfaceStability.Unstable public final class MasterSnapshotVerifier extends Object
This is a light-weight verification mechanism for all the files in a snapshot. It doesn't attempt to verify that the files are exact copies (that would be paramount to taking the snapshot again!), but instead just attempts to ensure that the files match the expected files and are the same length.
Taking an online snapshots can race against other operations and this is an last line of defense. For example, if meta changes between when snapshots are taken not all regions of a table may be present. This can be caused by a region split (daughters present on this scan, but snapshot took parent), or move (snapshots only checks lists of region servers, a move could have caused a region to be skipped or done twice).
Current snapshot files checked:
RegionInfo
matches the current and stored regionsModifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
private MasterServices |
services |
private org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription |
snapshot |
private TableName |
tableName |
private org.apache.hadoop.fs.FileSystem |
workingDirFs |
Constructor and Description |
---|
MasterSnapshotVerifier(MasterServices services,
org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot,
org.apache.hadoop.fs.FileSystem workingDirFs) |
Modifier and Type | Method and Description |
---|---|
private void |
verifyRegionInfo(RegionInfo region,
org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotRegionManifest manifest)
Verify that the regionInfo is valid
|
private void |
verifyRegions(SnapshotManifest manifest)
Check that all the regions in the snapshot are valid, and accounted for.
|
void |
verifySnapshot(org.apache.hadoop.fs.Path snapshotDir,
Set<String> snapshotServers)
Verify that the snapshot in the directory is a valid snapshot
|
private void |
verifySnapshotDescription(org.apache.hadoop.fs.Path snapshotDir)
Check that the snapshot description written in the filesystem matches the current snapshot
|
private void |
verifyTableInfo(SnapshotManifest manifest)
Check that the table descriptor for the snapshot is a valid table descriptor
|
private static final org.slf4j.Logger LOG
private org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot
private org.apache.hadoop.fs.FileSystem workingDirFs
private MasterServices services
public MasterSnapshotVerifier(MasterServices services, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot, org.apache.hadoop.fs.FileSystem workingDirFs)
services
- services for the mastersnapshot
- snapshot to checkworkingDirFs
- the file system containing the temporary snapshot informationpublic void verifySnapshot(org.apache.hadoop.fs.Path snapshotDir, Set<String> snapshotServers) throws CorruptedSnapshotException, IOException
snapshotDir
- snapshot directory to checksnapshotServers
- ServerName
of the servers
that are involved in the snapshotCorruptedSnapshotException
- if the snapshot is invalidIOException
- if there is an unexpected connection issue to the filesystemprivate void verifySnapshotDescription(org.apache.hadoop.fs.Path snapshotDir) throws CorruptedSnapshotException
snapshotDir
- snapshot directory to checkCorruptedSnapshotException
private void verifyTableInfo(SnapshotManifest manifest) throws IOException
manifest
- snapshot manifest to inspectIOException
private void verifyRegions(SnapshotManifest manifest) throws IOException
manifest
- snapshot manifest to inspectIOException
- if we can't reach hbase:meta or read the files from the FSprivate void verifyRegionInfo(RegionInfo region, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotRegionManifest manifest) throws IOException
region
- the region to checkmanifest
- snapshot manifest to inspectIOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.