HBASE-10786 If snapshot verification fails with 'Regions moved', the message should contain the name of region causing the failure

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1579374 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2014-03-19 20:03:22 +00:00
parent 3eb0400a31
commit 1f5c0d14fc

View File

@ -156,24 +156,27 @@ public final class MasterSnapshotVerifier {
throw new CorruptedSnapshotException(msg);
}
String errorMsg = "";
if (snapshotRegions.size() != regions.size()) {
String msg = "Regions moved during the snapshot '" +
errorMsg = "Regions moved during the snapshot '" +
ClientSnapshotDescriptionUtils.toString(snapshot) + "'. expected=" +
regions.size() + " snapshotted=" + snapshotRegions.size();
LOG.error(msg);
throw new CorruptedSnapshotException(msg);
regions.size() + " snapshotted=" + snapshotRegions.size() + ".";
LOG.error(errorMsg);
}
for (HRegionInfo region : regions) {
if (!snapshotRegions.contains(region.getEncodedName())) {
// could happen due to a move or split race.
String msg = "No region directory found for region:" + region;
LOG.error(msg);
throw new CorruptedSnapshotException(msg, snapshot);
String mesg = " No snapshot region directory found for region:" + region;
if (errorMsg.isEmpty()) errorMsg = mesg;
LOG.error(mesg);
}
verifyRegion(fs, snapshotDir, region);
}
if (!errorMsg.isEmpty()) {
throw new CorruptedSnapshotException(errorMsg);
}
}
/**