You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ki...@apache.org on 2015/12/01 23:43:52 UTC

hadoop git commit: HDFS-9426. Rollingupgrade finalization is not backward compatible (Contributed by Kihwal Lee)

Repository: hadoop
Updated Branches:
  refs/heads/branch-2.8 456426fe6 -> b70b380f3


HDFS-9426. Rollingupgrade finalization is not backward compatible (Contributed by Kihwal Lee)

(cherry picked from commit c62d42cd8bb09a5ffc0c5eefa2d87913e71b9e7e)

Conflicts:
	hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolClientSideTranslatorPB.java
	hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolServerSideTranslatorPB.java
	hadoop-hdfs-project/hadoop-hdfs/src/main/proto/DatanodeProtocol.proto
(cherry picked from commit 9f256d1d716a7e17606245fcfc619901a8fa299a)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/b70b380f
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/b70b380f
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/b70b380f

Branch: refs/heads/branch-2.8
Commit: b70b380f37ff03d5b30b8aa2adb9e731fb898c5f
Parents: 456426f
Author: Kihwal Lee <ki...@apache.org>
Authored: Tue Dec 1 16:43:15 2015 -0600
Committer: Kihwal Lee <ki...@apache.org>
Committed: Tue Dec 1 16:43:27 2015 -0600

----------------------------------------------------------------------
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt            |  3 +++
 .../DatanodeProtocolClientSideTranslatorPB.java        |  5 ++++-
 .../DatanodeProtocolServerSideTranslatorPB.java        | 13 +++++++++++--
 .../hadoop-hdfs/src/main/proto/DatanodeProtocol.proto  |  1 +
 4 files changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/b70b380f/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index 586790f..bf4d620 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -1649,6 +1649,9 @@ Release 2.7.2 - UNRELEASED
     HDFS-6481. DatanodeManager#getDatanodeStorageInfos() should check the
     length of storageIDs. (szetszwo via Arpit Agarwal)
 
+    HDFS-9426. Rollingupgrade finalization is not backward compatible
+    (Kihwal Lee via vinayakumarb)
+
 Release 2.7.1 - 2015-07-06
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/b70b380f/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolClientSideTranslatorPB.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolClientSideTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolClientSideTranslatorPB.java
index 705d573..388680b 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolClientSideTranslatorPB.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolClientSideTranslatorPB.java
@@ -163,7 +163,10 @@ public class DatanodeProtocolClientSideTranslatorPB implements
       index++;
     }
     RollingUpgradeStatus rollingUpdateStatus = null;
-    if (resp.hasRollingUpgradeStatus()) {
+    // Use v2 semantics if available.
+    if (resp.hasRollingUpgradeStatusV2()) {
+      rollingUpdateStatus = PBHelperClient.convert(resp.getRollingUpgradeStatusV2());
+    } else if (resp.hasRollingUpgradeStatus()) {
       rollingUpdateStatus = PBHelperClient.convert(resp.getRollingUpgradeStatus());
     }
     return new HeartbeatResponse(cmds, PBHelper.convert(resp.getHaStatus()),

http://git-wip-us.apache.org/repos/asf/hadoop/blob/b70b380f/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolServerSideTranslatorPB.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolServerSideTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolServerSideTranslatorPB.java
index 4b9f7c4..4f8f44f 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolServerSideTranslatorPB.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolServerSideTranslatorPB.java
@@ -46,6 +46,7 @@ import org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.StorageBlock
 import org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.StorageReceivedDeletedBlocksProto;
 import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.DatanodeIDProto;
 import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto;
+import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.RollingUpgradeStatusProto;
 import org.apache.hadoop.hdfs.protocol.proto.HdfsServerProtos.VersionRequestProto;
 import org.apache.hadoop.hdfs.protocol.proto.HdfsServerProtos.VersionResponseProto;
 import org.apache.hadoop.hdfs.server.protocol.DatanodeCommand;
@@ -132,9 +133,17 @@ public class DatanodeProtocolServerSideTranslatorPB implements
     RollingUpgradeStatus rollingUpdateStatus = response
         .getRollingUpdateStatus();
     if (rollingUpdateStatus != null) {
-      builder.setRollingUpgradeStatus(PBHelperClient
-          .convertRollingUpgradeStatus(rollingUpdateStatus));
+      // V2 is always set for newer datanodes.
+      // To be compatible with older datanodes, V1 is set to null
+      //  if the RU was finalized.
+      RollingUpgradeStatusProto rus = PBHelperClient.
+          convertRollingUpgradeStatus(rollingUpdateStatus);
+      builder.setRollingUpgradeStatusV2(rus);
+      if (!rollingUpdateStatus.isFinalized()) {
+        builder.setRollingUpgradeStatus(rus);
+      }
     }
+
     builder.setFullBlockReportLeaseId(response.getFullBlockReportLeaseId());
     return builder.build();
   }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/b70b380f/hadoop-hdfs-project/hadoop-hdfs/src/main/proto/DatanodeProtocol.proto
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/proto/DatanodeProtocol.proto b/hadoop-hdfs-project/hadoop-hdfs/src/main/proto/DatanodeProtocol.proto
index bb7a668..3c5e7ed 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/proto/DatanodeProtocol.proto
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/proto/DatanodeProtocol.proto
@@ -220,6 +220,7 @@ message HeartbeatResponseProto {
   required NNHAStatusHeartbeatProto haStatus = 2;
   optional RollingUpgradeStatusProto rollingUpgradeStatus = 3;
   optional uint64 fullBlockReportLeaseId = 4 [ default = 0 ];
+  optional RollingUpgradeStatusProto rollingUpgradeStatusV2 = 5;
 }
 
 /**