You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by bo...@apache.org on 2011/02/25 23:19:30 UTC
svn commit: r1074719 - in /hadoop/hdfs/branches/HDFS-1052: CHANGES.txt
src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
Author: boryas
Date: Fri Feb 25 22:19:30 2011
New Revision: 1074719
URL: http://svn.apache.org/viewvc?rev=1074719&view=rev
Log:
HDFS-1638.DataNode.handleDiskError needs to inform ALL namenodes if a disk failed
Modified:
hadoop/hdfs/branches/HDFS-1052/CHANGES.txt
hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
Modified: hadoop/hdfs/branches/HDFS-1052/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1052/CHANGES.txt?rev=1074719&r1=1074718&r2=1074719&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1052/CHANGES.txt (original)
+++ hadoop/hdfs/branches/HDFS-1052/CHANGES.txt Fri Feb 25 22:19:30 2011
@@ -34,6 +34,9 @@ Trunk (unreleased changes)
HDFS-1645. DatanodeCommond.Finalize needs to include BlockPoolId.
(suresh)
+ HDFS-1638.DataNode.handleDiskError needs to inform ALL namenodes if a disk
+ failed (boryas)
+
IMPROVEMENTS
HDFS-1510. Added test-patch.properties required by test-patch.sh (nigel)
Modified: hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java?rev=1074719&r1=1074718&r2=1074719&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java (original)
+++ hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java Fri Feb 25 22:19:30 2011
@@ -103,6 +103,7 @@ import org.apache.hadoop.hdfs.server.pro
import org.apache.hadoop.hdfs.server.protocol.DisallowedDatanodeException;
import org.apache.hadoop.hdfs.server.protocol.InterDatanodeProtocol;
import org.apache.hadoop.hdfs.server.protocol.KeyUpdateCommand;
+import org.apache.hadoop.hdfs.server.protocol.NamenodeProtocol;
import org.apache.hadoop.hdfs.server.protocol.NamespaceInfo;
import org.apache.hadoop.hdfs.server.protocol.ReplicaRecoveryInfo;
import org.apache.hadoop.hdfs.server.protocol.UpgradeCommand;
@@ -1324,20 +1325,28 @@ public class DataNode extends Configured
}
}
- // shutdown BPOS thread TODO:FEDERATION - review if this is enough
- if (nameNodeThreads != null) {
- for(BPOfferService bpos : nameNodeThreads) {
- if(bpos != null && bpos.bpThread!=null) {
- try {
- bpos.bpThread.interrupt();
- bpos.bpThread.join();
- } catch (InterruptedException ie) {}
- }
+ // interrupt all the threads, let them discover that shouldRun is false now
+ for(BPOfferService bpos : nameNodeThreads) {
+ if(bpos != null && bpos.bpThread!=null) {
+ bpos.bpThread.interrupt();
+ }
+ }
+
+ // wait until the bp threads are done.
+ for(BPOfferService bpos : nameNodeThreads) {
+ if(bpos != null && bpos.bpThread!=null) {
+ try {
+ bpos.bpThread.join();
+ } catch (InterruptedException ignored) {}
}
}
-
- RPC.stopProxy(namenode); // stop the RPC threads
-
+
+ // stop all the proxy threads
+ for(BPOfferService bpos: nameNodeThreads) {
+ if(bpos!=null && bpos.bpNamenode!=null)
+ RPC.stopProxy(bpos.bpNamenode); // stop the RPC threads
+ }
+
if(upgradeManager != null)
upgradeManager.shutdownUpgrade();
if (blockScannerThread != null) {
@@ -1401,14 +1410,14 @@ public class DataNode extends Configured
// DN will be shutdown and NN should remove it
dp_error = DatanodeProtocol.FATAL_DISK_ERROR;
}
- //inform NameNode
- try {
- namenode.errorReport(
- dnRegistration, dp_error, errMsgr);
- } catch(IOException ignored) {
+ //inform NameNodes
+ for(BPOfferService bpos: nameNodeThreads) {
+ DatanodeProtocol nn = bpos.bpNamenode;
+ try {
+ nn.errorReport(bpos.bpRegistration, dp_error, errMsgr);
+ } catch(IOException ignored) { }
}
-
if(hasEnoughResource) {
scheduleAllBlockReport(0);
return; // do not shutdown