Explorar o código

svn merge -c 1489634 Merging from trunk to branch-2.1.0-beta to fix HDFS-4840.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2.1-beta@1489640 13f79535-47bb-0310-9956-ffa450edef68
Kihwal Lee %!s(int64=12) %!d(string=hai) anos
pai
achega
83aee67e5f

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

@@ -316,6 +316,8 @@ Release 2.1.0-beta - UNRELEASED
 
     HDFS-4382. Fix typo MAX_NOT_CHANGED_INTERATIONS. (Ted Yu via suresh)
 
+    HDFS-4840. ReplicationMonitor gets NPE during shutdown. (kihwal)
+
   BREAKDOWN OF HDFS-347 SUBTASKS AND RELATED JIRAS
 
     HDFS-4353. Encapsulate connections to peers in Peer and PeerServer classes.

+ 8 - 3
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java

@@ -3078,10 +3078,15 @@ assert storedBlock.findDatanode(dn) < 0 : "Block " + block
           computeDatanodeWork();
           processPendingReplications();
           Thread.sleep(replicationRecheckInterval);
-        } catch (InterruptedException ie) {
-          LOG.warn("ReplicationMonitor thread received InterruptedException.", ie);
-          break;
         } catch (Throwable t) {
+          if (!namesystem.isRunning()) {
+            LOG.info("Stopping ReplicationMonitor.");
+            if (!(t instanceof InterruptedException)) {
+              LOG.info("ReplicationMonitor received an exception"
+                  + " while shutting down.", t);
+            }
+            break;
+          }
           LOG.fatal("ReplicationMonitor thread received Runtime exception. ", t);
           terminate(1, t);
         }