hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sur...@apache.org
Subject svn commit: r1074679 - in /hadoop/hdfs/branches/HDFS-1052: ./ src/java/org/apache/hadoop/hdfs/server/datanode/ src/java/org/apache/hadoop/hdfs/server/namenode/ src/java/org/apache/hadoop/hdfs/server/protocol/
Date Fri, 25 Feb 2011 19:41:45 GMT
Author: suresh
Date: Fri Feb 25 19:41:44 2011
New Revision: 1074679

URL: http://svn.apache.org/viewvc?rev=1074679&view=rev
Log:
HDFS-1645. DatanodeCommond.Finalize needs to include BlockPoolId. Contributed by Suresh Srinvias.


Modified:
    hadoop/hdfs/branches/HDFS-1052/CHANGES.txt
    hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
    hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java
    hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/protocol/DatanodeCommand.java

Modified: hadoop/hdfs/branches/HDFS-1052/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1052/CHANGES.txt?rev=1074679&r1=1074678&r2=1074679&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1052/CHANGES.txt (original)
+++ hadoop/hdfs/branches/HDFS-1052/CHANGES.txt Fri Feb 25 19:41:44 2011
@@ -31,6 +31,9 @@ Trunk (unreleased changes)
     HDFS-1653. Federation: Block received message from datanode sends invalid 
     DatanodeRegistration. (Tanping via suresh)
 
+    HDFS-1645. DatanodeCommond.Finalize needs to include BlockPoolId.
+    (suresh)
+
   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=1074679&r1=1074678&r2=1074679&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 19:41:44 2011
@@ -1014,8 +1014,8 @@ public class DataNode extends Configured
         }
         break;
       case DatanodeProtocol.DNA_FINALIZE:
-        // TODO:FEDERATION - global storage????? or per BP storage - add real BPID
-        storage.finalizeUpgrade("FAKE ID NEEDS TO BE REPLACED");
+        storage.finalizeUpgrade(((DatanodeCommand.Finalize) cmd)
+            .getBlockPoolId());
         break;
       case UpgradeCommand.UC_ACTION_START_UPGRADE:
         // start distributed upgrade here

Modified: hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java?rev=1074679&r1=1074678&r2=1074679&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java
(original)
+++ hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java
Fri Feb 25 19:41:44 2011
@@ -251,7 +251,7 @@ public class NameNode implements Namenod
   public static URI [] getNameNodesURIs(Configuration conf) {
     String [] nnURIs = conf.getStrings(DFSConfigKeys.DFS_FEDERATION_NAMENODES);
     if(nnURIs == null) {
-      nnURIs = new String[] { conf.get(CommonConfigurationKeys.FS_DEFAULT_NAME_KEY)};
+      nnURIs = new String[] {conf.get(CommonConfigurationKeys.FS_DEFAULT_NAME_KEY)};
     }
 
     AbstractList<URI> nns = new ArrayList<URI>(nnURIs.length);
@@ -300,6 +300,7 @@ public class NameNode implements Namenod
   /**
    * TODO:FEDERATION
    * @param filesystemURI
+   * @return address of file system
    */
   public static InetSocketAddress getAddress(URI filesystemURI) {
     String authority = filesystemURI.getAuthority();
@@ -1300,7 +1301,7 @@ public class NameNode implements Namenod
 
     namesystem.processReport(nodeReg, poolId, blist);
     if (getFSImage().isUpgradeFinalized())
-      return DatanodeCommand.FINALIZE;
+      return new DatanodeCommand.Finalize(poolId);
     return null;
   }
 
@@ -1356,8 +1357,12 @@ public class NameNode implements Namenod
    */
   public void verifyRequest(NodeRegistration nodeReg) throws IOException {
     verifyVersion(nodeReg.getVersion());
-    if (!namesystem.getRegistrationID().equals(nodeReg.getRegistrationID()))
+    if (!namesystem.getRegistrationID().equals(nodeReg.getRegistrationID())) {
+      LOG.warn("Invalid registrationID - expected: "
+          + namesystem.getRegistrationID() + " received: "
+          + nodeReg.getRegistrationID());
       throw new UnregisteredNodeException(nodeReg);
+    }
   }
     
   /**

Modified: hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/protocol/DatanodeCommand.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/protocol/DatanodeCommand.java?rev=1074679&r1=1074678&r2=1074679&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/protocol/DatanodeCommand.java
(original)
+++ hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/protocol/DatanodeCommand.java
Fri Feb 25 19:41:44 2011
@@ -19,12 +19,14 @@ package org.apache.hadoop.hdfs.server.pr
 
 import java.io.DataInput;
 import java.io.DataOutput;
+import java.io.IOException;
 
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.io.WritableFactory;
 import org.apache.hadoop.io.WritableFactories;
+import org.apache.hadoop.io.WritableUtils;
 import org.apache.avro.reflect.Union;
 
 /**
@@ -47,10 +49,27 @@ public abstract class DatanodeCommand ex
     public void write(DataOutput out) {}
   }
 
-  static class Finalize extends DatanodeCommand {
-    private Finalize() {super(DatanodeProtocol.DNA_FINALIZE);}
-    public void readFields(DataInput in) {}
-    public void write(DataOutput out) {}
+  public static class Finalize extends DatanodeCommand {
+    String blockPoolId;
+    private Finalize() {
+      super(DatanodeProtocol.DNA_FINALIZE);
+    }
+    
+    public Finalize(String bpid) {
+      super(DatanodeProtocol.DNA_FINALIZE);
+      blockPoolId = bpid;
+    }
+    
+    public String getBlockPoolId() {
+      return blockPoolId;
+    }
+    
+    public void readFields(DataInput in) throws IOException {
+      blockPoolId = WritableUtils.readString(in);
+    }
+    public void write(DataOutput out) throws IOException {
+      WritableUtils.writeString(out, blockPoolId);
+    }
   }
 
   static {                                      // register a ctor
@@ -65,7 +84,6 @@ public abstract class DatanodeCommand ex
   }
 
   public static final DatanodeCommand REGISTER = new Register();
-  public static final DatanodeCommand FINALIZE = new Finalize();
   
   public DatanodeCommand() {
     super();



Mime
View raw message