HDFS-17184. Improve BlockReceiver to throws DiskOutOfSpaceException when initialize. (#6044). Contributed by Haiyang Hu.
Signed-off-by: He Xiaoqiao <hexiaoqiao@apache.org>
This commit is contained in:
parent
27cb551821
commit
cc66683b1a
@ -57,6 +57,7 @@
|
||||
import org.apache.hadoop.util.DataChecksum;
|
||||
import org.apache.hadoop.util.StringUtils;
|
||||
import org.apache.hadoop.util.Time;
|
||||
import org.apache.hadoop.util.DiskChecker.DiskOutOfSpaceException;
|
||||
import org.apache.hadoop.tracing.Span;
|
||||
import org.apache.hadoop.tracing.Tracer;
|
||||
|
||||
@ -274,10 +275,9 @@ class BlockReceiver implements Closeable {
|
||||
if (isCreate) {
|
||||
BlockMetadataHeader.writeHeader(checksumOut, diskChecksum);
|
||||
}
|
||||
} catch (ReplicaAlreadyExistsException bae) {
|
||||
throw bae;
|
||||
} catch (ReplicaNotFoundException bne) {
|
||||
throw bne;
|
||||
} catch (ReplicaAlreadyExistsException | ReplicaNotFoundException
|
||||
| DiskOutOfSpaceException e) {
|
||||
throw e;
|
||||
} catch(IOException ioe) {
|
||||
if (replicaInfo != null) {
|
||||
replicaInfo.releaseAllBytesReserved();
|
||||
|
@ -117,14 +117,13 @@ private V chooseVolume(final int curVolumeIndex, final List<V> volumes,
|
||||
maxAvailable = availableVolumeSize;
|
||||
}
|
||||
|
||||
LOG.warn("The volume[{}] with the available space (={} B) is "
|
||||
+ "less than the block size (={} B).", volume.getBaseURI(),
|
||||
availableVolumeSize, blockSize);
|
||||
if (curVolume == startVolume) {
|
||||
throw new DiskOutOfSpaceException("Out of space: "
|
||||
+ "The volume with the most available space (=" + maxAvailable
|
||||
+ " B) is less than the block size (=" + blockSize + " B).");
|
||||
} else {
|
||||
LOG.warn("The volume[{}] with the available space (={} B) is "
|
||||
+ "less than the block size (={} B).", volume.getBaseURI(),
|
||||
availableVolumeSize, blockSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user