HDFS-7884. Fix NullPointerException in BlockSender when the generation stamp provided by the client is larger than the one stored in the datanode. Contributed by Brahma Reddy Battula

This commit is contained in:
Tsz-Wo Nicholas Sze 2015-03-24 13:49:17 +09:00
parent 9fae455e26
commit d7e3c3364e
2 changed files with 11 additions and 0 deletions

View File

@ -1237,6 +1237,10 @@ Release 2.7.0 - UNRELEASED
HDFS-7942. NFS: support regexp grouping in nfs.exports.allowed.hosts (brandonli) HDFS-7942. NFS: support regexp grouping in nfs.exports.allowed.hosts (brandonli)
HDFS-7884. Fix NullPointerException in BlockSender when the generation stamp
provided by the client is larger than the one stored in the datanode.
(Brahma Reddy Battula via szetszwo)
BREAKDOWN OF HDFS-7584 SUBTASKS AND RELATED JIRAS BREAKDOWN OF HDFS-7584 SUBTASKS AND RELATED JIRAS
HDFS-7720. Quota by Storage Type API, tools and ClientNameNode HDFS-7720. Quota by Storage Type API, tools and ClientNameNode

View File

@ -246,6 +246,13 @@ class BlockSender implements java.io.Closeable {
if (replica.getGenerationStamp() < block.getGenerationStamp()) { if (replica.getGenerationStamp() < block.getGenerationStamp()) {
throw new IOException("Replica gen stamp < block genstamp, block=" throw new IOException("Replica gen stamp < block genstamp, block="
+ block + ", replica=" + replica); + block + ", replica=" + replica);
} else if (replica.getGenerationStamp() > block.getGenerationStamp()) {
if (DataNode.LOG.isDebugEnabled()) {
DataNode.LOG.debug("Bumping up the client provided"
+ " block's genstamp to latest " + replica.getGenerationStamp()
+ " for block " + block);
}
block.setGenerationStamp(replica.getGenerationStamp());
} }
if (replicaVisibleLength < 0) { if (replicaVisibleLength < 0) {
throw new IOException("Replica is not readable, block=" throw new IOException("Replica is not readable, block="