From 87eeb26e7200fa3be0ca62ebf163985b58ad309e Mon Sep 17 00:00:00 2001 From: Xiao Chen Date: Thu, 12 Jul 2018 20:19:14 -0700 Subject: [PATCH] HDFS-13663. Should throw exception when incorrect block size is set. Contributed by Shweta. --- .../hadoop/hdfs/server/datanode/BlockRecoveryWorker.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockRecoveryWorker.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockRecoveryWorker.java index 94835e2208..34f6c33003 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockRecoveryWorker.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockRecoveryWorker.java @@ -275,7 +275,9 @@ void syncBlock(List syncList) throws IOException { } // recover() guarantees syncList will have at least one replica with RWR // or better state. - assert minLength != Long.MAX_VALUE : "wrong minLength"; + if (minLength == Long.MAX_VALUE) { + throw new IOException("Incorrect block size"); + } newBlock.setNumBytes(minLength); break; case RUR: