From a8cbf195480826c25a95e1ef1cbcffa7b3ba4947 Mon Sep 17 00:00:00 2001 From: Eli Collins Date: Fri, 30 Mar 2012 17:50:05 +0000 Subject: [PATCH] HDFS-3138. Move DatanodeInfo#ipcPort to DatanodeID. Contributed by Eli Collins git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1307553 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 2 ++ .../java/org/apache/hadoop/hdfs/protocol/DatanodeID.java | 3 ++- .../org/apache/hadoop/hdfs/protocol/DatanodeInfo.java | 8 -------- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index dcb7d0ffed4..afabd4b1ec3 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -118,6 +118,8 @@ Release 2.0.0 - UNRELEASED HDFS-2303. Unbundle jsvc. (Roman Shaposhnik and Mingjie Lai via eli) HDFS-3137. Bump LAST_UPGRADABLE_LAYOUT_VERSION to -16. (eli) + + HDFS-3138. Move DatanodeInfo#ipcPort to DatanodeID. (eli) NEW FEATURES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeID.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeID.java index 9c837d291f4..1b8ce5bff10 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeID.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeID.java @@ -170,7 +170,6 @@ public class DatanodeID implements WritableComparable { name = nodeReg.getName(); infoPort = nodeReg.getInfoPort(); ipcPort = nodeReg.getIpcPort(); - // update any more fields added in future. } /** Comparable. @@ -190,6 +189,7 @@ public class DatanodeID implements WritableComparable { DeprecatedUTF8.writeString(out, name); DeprecatedUTF8.writeString(out, storageID); out.writeShort(infoPort); + out.writeShort(ipcPort); } @Override @@ -201,5 +201,6 @@ public class DatanodeID implements WritableComparable { // So chop off the first two bytes (and hence the signed bits) before // setting the field. this.infoPort = in.readShort() & 0x0000ffff; + this.ipcPort = in.readShort() & 0x0000ffff; } } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeInfo.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeInfo.java index 2065ae1d1eb..418f32db16f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeInfo.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeInfo.java @@ -380,10 +380,6 @@ public class DatanodeInfo extends DatanodeID implements Node { @Override public void write(DataOutput out) throws IOException { super.write(out); - - //TODO: move it to DatanodeID once DatanodeID is not stored in FSImage - out.writeShort(ipcPort); - out.writeLong(capacity); out.writeLong(dfsUsed); out.writeLong(remaining); @@ -398,10 +394,6 @@ public class DatanodeInfo extends DatanodeID implements Node { @Override public void readFields(DataInput in) throws IOException { super.readFields(in); - - //TODO: move it to DatanodeID once DatanodeID is not stored in FSImage - this.ipcPort = in.readShort() & 0x0000ffff; - this.capacity = in.readLong(); this.dfsUsed = in.readLong(); this.remaining = in.readLong();