Browse Source

HDFS-8850. VolumeScanner thread exits with exception if there is no block pool to be scanned but there are suspicious blocks. (Colin Patrick McCabe via yliu)

yliu 10 năm trước cách đây
mục cha
commit
d2b941f94a

+ 4 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -767,6 +767,10 @@ Release 2.8.0 - UNRELEASED
     HDFS-8847. change TestHDFSContractAppend to not override
     testRenameFileBeingAppended method. (Zhihai Xu)
 
+    HDFS-8850. VolumeScanner thread exits with exception if there is no block
+    pool to be scanned but there are suspicious blocks. (Colin Patrick McCabe
+    via yliu)
+
 Release 2.7.2 - UNRELEASED
 
   INCOMPATIBLE CHANGES

+ 7 - 5
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/VolumeScanner.java

@@ -536,11 +536,13 @@ public class VolumeScanner extends Thread {
           return 0;
         }
       }
-      long saveDelta = monotonicMs - curBlockIter.getLastSavedMs();
-      if (saveDelta >= conf.cursorSaveMs) {
-        LOG.debug("{}: saving block iterator {} after {} ms.",
-            this, curBlockIter, saveDelta);
-        saveBlockIterator(curBlockIter);
+      if (curBlockIter != null) {
+        long saveDelta = monotonicMs - curBlockIter.getLastSavedMs();
+        if (saveDelta >= conf.cursorSaveMs) {
+          LOG.debug("{}: saving block iterator {} after {} ms.",
+              this, curBlockIter, saveDelta);
+          saveBlockIterator(curBlockIter);
+        }
       }
       bytesScanned = scanBlock(block, conf.targetBytesPerSec);
       if (bytesScanned >= 0) {