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.DataChecksum;
|
||||||
import org.apache.hadoop.util.StringUtils;
|
import org.apache.hadoop.util.StringUtils;
|
||||||
import org.apache.hadoop.util.Time;
|
import org.apache.hadoop.util.Time;
|
||||||
|
import org.apache.hadoop.util.DiskChecker.DiskOutOfSpaceException;
|
||||||
import org.apache.hadoop.tracing.Span;
|
import org.apache.hadoop.tracing.Span;
|
||||||
import org.apache.hadoop.tracing.Tracer;
|
import org.apache.hadoop.tracing.Tracer;
|
||||||
|
|
||||||
@ -274,10 +275,9 @@ class BlockReceiver implements Closeable {
|
|||||||
if (isCreate) {
|
if (isCreate) {
|
||||||
BlockMetadataHeader.writeHeader(checksumOut, diskChecksum);
|
BlockMetadataHeader.writeHeader(checksumOut, diskChecksum);
|
||||||
}
|
}
|
||||||
} catch (ReplicaAlreadyExistsException bae) {
|
} catch (ReplicaAlreadyExistsException | ReplicaNotFoundException
|
||||||
throw bae;
|
| DiskOutOfSpaceException e) {
|
||||||
} catch (ReplicaNotFoundException bne) {
|
throw e;
|
||||||
throw bne;
|
|
||||||
} catch(IOException ioe) {
|
} catch(IOException ioe) {
|
||||||
if (replicaInfo != null) {
|
if (replicaInfo != null) {
|
||||||
replicaInfo.releaseAllBytesReserved();
|
replicaInfo.releaseAllBytesReserved();
|
||||||
|
@ -117,14 +117,13 @@ private V chooseVolume(final int curVolumeIndex, final List<V> volumes,
|
|||||||
maxAvailable = availableVolumeSize;
|
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) {
|
if (curVolume == startVolume) {
|
||||||
throw new DiskOutOfSpaceException("Out of space: "
|
throw new DiskOutOfSpaceException("Out of space: "
|
||||||
+ "The volume with the most available space (=" + maxAvailable
|
+ "The volume with the most available space (=" + maxAvailable
|
||||||
+ " B) is less than the block size (=" + blockSize + " B).");
|
+ " 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