HDFS-11018. Incorrect check and message in FsDatasetImpl#invalidate. Contributed by Yiqun Lin.
This commit is contained in:
parent
f872c6bc03
commit
6d2da38d16
|
@ -786,8 +786,14 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
|
|||
throws ReplicaNotFoundException {
|
||||
ReplicaInfo info = volumeMap.get(b.getBlockPoolId(), b.getLocalBlock());
|
||||
if (info == null) {
|
||||
throw new ReplicaNotFoundException(
|
||||
ReplicaNotFoundException.NON_EXISTENT_REPLICA + b);
|
||||
if (volumeMap.get(b.getBlockPoolId(), b.getLocalBlock().getBlockId())
|
||||
== null) {
|
||||
throw new ReplicaNotFoundException(
|
||||
ReplicaNotFoundException.NON_EXISTENT_REPLICA + b);
|
||||
} else {
|
||||
throw new ReplicaNotFoundException(
|
||||
ReplicaNotFoundException.UNEXPECTED_GS_REPLICA + b);
|
||||
}
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
@ -1878,16 +1884,21 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
|
|||
try (AutoCloseableLock lock = datasetLock.acquire()) {
|
||||
final ReplicaInfo info = volumeMap.get(bpid, invalidBlks[i]);
|
||||
if (info == null) {
|
||||
// It is okay if the block is not found -- it may be deleted earlier.
|
||||
LOG.info("Failed to delete replica " + invalidBlks[i]
|
||||
+ ": ReplicaInfo not found.");
|
||||
continue;
|
||||
}
|
||||
if (info.getGenerationStamp() != invalidBlks[i].getGenerationStamp()) {
|
||||
errors.add("Failed to delete replica " + invalidBlks[i]
|
||||
+ ": GenerationStamp not matched, info=" + info);
|
||||
ReplicaInfo infoByBlockId =
|
||||
volumeMap.get(bpid, invalidBlks[i].getBlockId());
|
||||
if (infoByBlockId == null) {
|
||||
// It is okay if the block is not found -- it
|
||||
// may be deleted earlier.
|
||||
LOG.info("Failed to delete replica " + invalidBlks[i]
|
||||
+ ": ReplicaInfo not found.");
|
||||
} else {
|
||||
errors.add("Failed to delete replica " + invalidBlks[i]
|
||||
+ ": GenerationStamp not matched, existing replica is "
|
||||
+ Block.toString(infoByBlockId));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
v = (FsVolumeImpl)info.getVolume();
|
||||
if (v == null) {
|
||||
errors.add("Failed to delete replica " + invalidBlks[i]
|
||||
|
|
Loading…
Reference in New Issue