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 aa...@apache.org on 2019/08/23 06:29:45 UTC

[hadoop] branch branch-3.2 updated: HDFS-14396. Failed to load image from FSImageFile when downgrade from 3.x to 2.x. Contributed by Fei Hui.

This is an automated email from the ASF dual-hosted git repository.

aajisaka pushed a commit to branch branch-3.2
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.2 by this push:
     new e8b93d0  HDFS-14396. Failed to load image from FSImageFile when downgrade from 3.x to 2.x. Contributed by Fei Hui.
e8b93d0 is described below

commit e8b93d04c4b3cb68654a1704e1d3b51253832757
Author: Akira Ajisaka <aa...@apache.org>
AuthorDate: Fri Aug 23 15:27:32 2019 +0900

    HDFS-14396. Failed to load image from FSImageFile when downgrade from 3.x to 2.x. Contributed by Fei Hui.
    
    (cherry picked from commit bd7baea5a5d4ff351645e34c0ef09b7ba82f4285)
---
 .../hdfs/server/namenode/FSImageFormatProtobuf.java       | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormatProtobuf.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormatProtobuf.java
index a00cde5..c99add3 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormatProtobuf.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormatProtobuf.java
@@ -568,6 +568,8 @@ public final class FSImageFormatProtobuf {
         FSImageCompression compression, String filePath) throws IOException {
       StartupProgress prog = NameNode.getStartupProgress();
       MessageDigest digester = MD5Hash.getDigester();
+      int layoutVersion =
+          context.getSourceNamesystem().getEffectiveLayoutVersion();
 
       underlyingOutputStream = new DigestOutputStream(new BufferedOutputStream(
           fout), digester);
@@ -594,11 +596,16 @@ public final class FSImageFormatProtobuf {
       // depends on this behavior.
       context.checkCancelled();
 
+      Step step;
+
       // Erasure coding policies should be saved before inodes
-      Step step = new Step(StepType.ERASURE_CODING_POLICIES, filePath);
-      prog.beginStep(Phase.SAVING_CHECKPOINT, step);
-      saveErasureCodingSection(b);
-      prog.endStep(Phase.SAVING_CHECKPOINT, step);
+      if (NameNodeLayoutVersion.supports(
+          NameNodeLayoutVersion.Feature.ERASURE_CODING, layoutVersion)) {
+        step = new Step(StepType.ERASURE_CODING_POLICIES, filePath);
+        prog.beginStep(Phase.SAVING_CHECKPOINT, step);
+        saveErasureCodingSection(b);
+        prog.endStep(Phase.SAVING_CHECKPOINT, step);
+      }
 
       step = new Step(StepType.INODES, filePath);
       prog.beginStep(Phase.SAVING_CHECKPOINT, step);


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org