Ver código fonte

Merging HDFS-1202 change r960816 from 0.20-append to 0.20-security.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security@1162212 13f79535-47bb-0310-9956-ffa450edef68
Jitendra Nath Pandey 14 anos atrás
pai
commit
932e411cbf

+ 3 - 0
CHANGES.txt

@@ -93,6 +93,9 @@ Release 0.20.205.0 - unreleased
 
     HDFS-1164. TestHdfsProxy is failing. (Todd Lipcon)
 
+    HDFS-1202. DataBlockScanner throws NPE when updated before initialized. 
+    (Todd Lipcon)
+
 Release 0.20.204.0 - 2011-8-25
 
   NEW FEATURES

+ 8 - 5
src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataBlockScanner.java

@@ -145,7 +145,7 @@ class DataBlockScanner implements Runnable {
     // initialized when the scanner thread is started.
   }
   
-  private synchronized boolean isInitiliazed() {
+  private synchronized boolean isInitialized() {
     return throttler != null;
   }
   
@@ -254,7 +254,7 @@ class DataBlockScanner implements Runnable {
 
   /** Adds block to list of blocks */
   synchronized void addBlock(Block block) {
-    if (!isInitiliazed()) {
+    if (!isInitialized()) {
       return;
     }
     
@@ -273,7 +273,7 @@ class DataBlockScanner implements Runnable {
   
   /** Deletes the block from internal structures */
   synchronized void deleteBlock(Block block) {
-    if (!isInitiliazed()) {
+    if (!isInitialized()) {
       return;
     }
     BlockScanInfo info = blockMap.get(block);
@@ -284,7 +284,7 @@ class DataBlockScanner implements Runnable {
 
   /** @return the last scan time */
   synchronized long getLastScanTime(Block block) {
-    if (!isInitiliazed()) {
+    if (!isInitialized()) {
       return 0;
     }
     BlockScanInfo info = blockMap.get(block);
@@ -305,6 +305,9 @@ class DataBlockScanner implements Runnable {
   private synchronized void updateScanStatus(Block block, 
                                              ScanType type,
                                              boolean scanOk) {
+    if (!isInitialized()) {
+      return;
+    }
     BlockScanInfo info = blockMap.get(block);
     
     if ( info != null ) {
@@ -955,7 +958,7 @@ class DataBlockScanner implements Runnable {
       if (blockScanner == null) {
         buffer.append("Periodic block scanner is not running. " +
                       "Please check the datanode log if this is unexpected.");
-      } else if (blockScanner.isInitiliazed()) {
+      } else if (blockScanner.isInitialized()) {
         blockScanner.printBlockReport(buffer, summary);
       } else {
         buffer.append("Periodic block scanner is not yet initialized. " +