Return-Path: X-Original-To: apmail-hadoop-common-commits-archive@www.apache.org Delivered-To: apmail-hadoop-common-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AF8AB17993 for ; Tue, 3 Mar 2015 02:05:12 +0000 (UTC) Received: (qmail 82867 invoked by uid 500); 3 Mar 2015 02:05:12 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 82803 invoked by uid 500); 3 Mar 2015 02:05:12 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 82794 invoked by uid 99); 3 Mar 2015 02:05:12 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Mar 2015 02:05:12 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 50ACEE03B9; Tue, 3 Mar 2015 02:05:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: szetszwo@apache.org To: common-commits@hadoop.apache.org Message-Id: <025d910cb05a4148a754590cf291d1ce@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: hadoop git commit: HDFS-7302. Remove "downgrade" from "namenode -rollingUpgrade" startup option since it may incorrectly finalize an ongoing rolling upgrade. Contributed by Kai Sasaki Date: Tue, 3 Mar 2015 02:05:12 +0000 (UTC) Repository: hadoop Updated Branches: refs/heads/trunk 14dd647c5 -> 431e7d84c HDFS-7302. Remove "downgrade" from "namenode -rollingUpgrade" startup option since it may incorrectly finalize an ongoing rolling upgrade. Contributed by Kai Sasaki Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/431e7d84 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/431e7d84 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/431e7d84 Branch: refs/heads/trunk Commit: 431e7d84c7b68b34ff18de19afe8e46637047fa6 Parents: 14dd647 Author: Tsz-Wo Nicholas Sze Authored: Tue Mar 3 10:04:08 2015 +0800 Committer: Tsz-Wo Nicholas Sze Committed: Tue Mar 3 10:04:08 2015 +0800 ---------------------------------------------------------------------- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 4 ++++ .../hadoop/hdfs/server/common/HdfsServerConstants.java | 10 +++++++++- .../hadoop/hdfs/server/namenode/FSEditLogLoader.java | 3 --- .../org/apache/hadoop/hdfs/server/namenode/FSImage.java | 4 ---- .../hadoop/hdfs/server/namenode/FSNamesystem.java | 3 +-- .../hadoop-hdfs/src/site/markdown/HDFSCommands.md | 2 +- .../hadoop-hdfs/src/site/xdoc/HdfsRollingUpgrade.xml | 11 +++++------ .../apache/hadoop/hdfs/TestRollingUpgradeDowngrade.java | 12 ++++++++---- .../hdfs/server/datanode/TestHdfsServerConstants.java | 3 --- .../hdfs/server/namenode/TestNameNodeOptionParsing.java | 8 -------- 10 files changed, 28 insertions(+), 32 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/431e7d84/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 43505d7..52e5d3c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -14,6 +14,10 @@ Trunk (Unreleased) HDFS-2538. option to disable fsck dots (Mohammad Kamrul Islam via aw) + HDFS-7302. Remove "downgrade" from "namenode -rollingUpgrade" startup + option since it may incorrectly finalize an ongoing rolling upgrade. + (Kai Sasaki via szetszwo) + NEW FEATURES HDFS-3125. Add JournalService to enable Journal Daemon. (suresh) http://git-wip-us.apache.org/repos/asf/hadoop/blob/431e7d84/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java index 9bba2c9..ff64524 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java @@ -49,7 +49,7 @@ public final class HdfsServerConstants { /** Startup options for rolling upgrade. */ public static enum RollingUpgradeStartupOption{ - ROLLBACK, DOWNGRADE, STARTED; + ROLLBACK, STARTED; public String getOptionString() { return StartupOption.ROLLINGUPGRADE.getName() + " " @@ -64,6 +64,14 @@ public final class HdfsServerConstants { private static final RollingUpgradeStartupOption[] VALUES = values(); static RollingUpgradeStartupOption fromString(String s) { + if ("downgrade".equalsIgnoreCase(s)) { + throw new IllegalArgumentException( + "The \"downgrade\" option is no longer supported" + + " since it may incorrectly finalize an ongoing rolling upgrade." + + " For downgrade instruction, please see the documentation" + + " (http://hadoop.apache.org/docs/current/hadoop-project-dist/" + + "hadoop-hdfs/HdfsRollingUpgrade.html#Downgrade)."); + } for(RollingUpgradeStartupOption opt : VALUES) { if (opt.name().equalsIgnoreCase(s)) { return opt; http://git-wip-us.apache.org/repos/asf/hadoop/blob/431e7d84/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java index a09df82..51c167a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java @@ -793,9 +793,6 @@ public class FSEditLogLoader { = startOpt.getRollingUpgradeStartupOption(); if (rollingUpgradeOpt == RollingUpgradeStartupOption.ROLLBACK) { throw new RollingUpgradeOp.RollbackException(); - } else if (rollingUpgradeOpt == RollingUpgradeStartupOption.DOWNGRADE) { - //ignore upgrade marker - break; } } // start rolling upgrade http://git-wip-us.apache.org/repos/asf/hadoop/blob/431e7d84/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java index 1aeb0b8..44c41d0 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java @@ -687,10 +687,6 @@ public class FSImage implements Closeable { long txnsAdvanced = loadEdits(editStreams, target, startOpt, recovery); needToSave |= needsResaveBasedOnStaleCheckpoint(imageFile.getFile(), txnsAdvanced); - if (RollingUpgradeStartupOption.DOWNGRADE.matches(startOpt)) { - // rename rollback image if it is downgrade - renameCheckpoint(NameNodeFile.IMAGE_ROLLBACK, NameNodeFile.IMAGE); - } } else { // Trigger the rollback for rolling upgrade. Here lastAppliedTxId equals // to the last txid in rollback fsimage. http://git-wip-us.apache.org/repos/asf/hadoop/blob/431e7d84/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java index bbab09e..7cd194e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java @@ -972,8 +972,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, MetaRecoveryContext recovery = startOpt.createRecoveryContext(); final boolean staleImage = fsImage.recoverTransitionRead(startOpt, this, recovery); - if (RollingUpgradeStartupOption.ROLLBACK.matches(startOpt) || - RollingUpgradeStartupOption.DOWNGRADE.matches(startOpt)) { + if (RollingUpgradeStartupOption.ROLLBACK.matches(startOpt)) { rollingUpgradeInfo = null; } final boolean needToSave = staleImage && !haEnabled && !isRollingUpgrade(); http://git-wip-us.apache.org/repos/asf/hadoop/blob/431e7d84/hadoop-hdfs-project/hadoop-hdfs/src/site/markdown/HDFSCommands.md ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/site/markdown/HDFSCommands.md b/hadoop-hdfs-project/hadoop-hdfs/src/site/markdown/HDFSCommands.md index 0573158..191b5bc 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/site/markdown/HDFSCommands.md +++ b/hadoop-hdfs-project/hadoop-hdfs/src/site/markdown/HDFSCommands.md @@ -435,7 +435,7 @@ Usage: | `-upgrade` `[-clusterid cid]` [`-renameReserved` \] | Namenode should be started with upgrade option after the distribution of new Hadoop version. | | `-upgradeOnly` `[-clusterid cid]` [`-renameReserved` \] | Upgrade the specified NameNode and then shutdown it. | | `-rollback` | Rollback the NameNode to the previous version. This should be used after stopping the cluster and distributing the old Hadoop version. | -| `-rollingUpgrade` \ | See [Rolling Upgrade document](./HdfsRollingUpgrade.html#NameNode_Startup_Options) for the detail. | +| `-rollingUpgrade` \ | See [Rolling Upgrade document](./HdfsRollingUpgrade.html#NameNode_Startup_Options) for the detail. | | `-finalize` | Finalize will remove the previous state of the files system. Recent upgrade will become permanent. Rollback option will not be available anymore. After finalization it shuts the NameNode down. | | `-importCheckpoint` | Loads image from a checkpoint directory and save it into the current one. Checkpoint dir is read from property fs.checkpoint.dir | | `-initializeSharedEdits` | Format a new shared edits dir and copy in enough edit log segments so that the standby NameNode can start up. | http://git-wip-us.apache.org/repos/asf/hadoop/blob/431e7d84/hadoop-hdfs-project/hadoop-hdfs/src/site/xdoc/HdfsRollingUpgrade.xml ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/site/xdoc/HdfsRollingUpgrade.xml b/hadoop-hdfs-project/hadoop-hdfs/src/site/xdoc/HdfsRollingUpgrade.xml index 1053695..f2f3ebe 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/site/xdoc/HdfsRollingUpgrade.xml +++ b/hadoop-hdfs-project/hadoop-hdfs/src/site/xdoc/HdfsRollingUpgrade.xml @@ -308,17 +308,13 @@

namenode -rollingUpgrade

- hdfs namenode -rollingUpgrade <downgrade|rollback|started> + hdfs namenode -rollingUpgrade <rollback|started>

When a rolling upgrade is in progress, the -rollingUpgrade namenode startup option is used to specify various rolling upgrade options.

  • Options: - - - @@ -329,7 +325,10 @@ with different layout versions during startup.
    downgradeRestores the namenode back to the pre-upgrade release - and preserves the user data.
    rollback Restores the namenode back to the pre-upgrade release but also reverts the user data back to the pre-upgrade state.
- +

+ WARN: downgrade options is obsolete. + It is not necessary to start namenode with downgrade options explicitly. +

http://git-wip-us.apache.org/repos/asf/hadoop/blob/431e7d84/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgradeDowngrade.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgradeDowngrade.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgradeDowngrade.java index 22efd6e..189b5f5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgradeDowngrade.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgradeDowngrade.java @@ -36,7 +36,11 @@ import org.junit.Test; public class TestRollingUpgradeDowngrade { - @Test(timeout = 300000) + /** + * Downgrade option is already obsolete. It should throw exception. + * @throws Exception + */ + @Test(timeout = 300000, expected = IllegalArgumentException.class) public void testDowngrade() throws Exception { final Configuration conf = new HdfsConfiguration(); MiniQJMHACluster cluster = null; @@ -85,10 +89,10 @@ public class TestRollingUpgradeDowngrade { } /** - * Ensure that during downgrade the NN fails to load a fsimage with newer - * format. + * Ensure that restart namenode with downgrade option should throw exception + * because it has been obsolete. */ - @Test(expected = IncorrectVersionException.class) + @Test(expected = IllegalArgumentException.class) public void testRejectNewFsImage() throws IOException { final Configuration conf = new Configuration(); MiniDFSCluster cluster = null; http://git-wip-us.apache.org/repos/asf/hadoop/blob/431e7d84/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestHdfsServerConstants.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestHdfsServerConstants.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestHdfsServerConstants.java index 2e76b25..0f24c05 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestHdfsServerConstants.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestHdfsServerConstants.java @@ -83,9 +83,6 @@ public class TestHdfsServerConstants { verifyStartupOptionResult("ROLLINGUPGRADE(ROLLBACK)", StartupOption.ROLLINGUPGRADE, RollingUpgradeStartupOption.ROLLBACK); - verifyStartupOptionResult("ROLLINGUPGRADE(DOWNGRADE)", - StartupOption.ROLLINGUPGRADE, - RollingUpgradeStartupOption.DOWNGRADE); verifyStartupOptionResult("ROLLINGUPGRADE(STARTED)", StartupOption.ROLLINGUPGRADE, RollingUpgradeStartupOption.STARTED); http://git-wip-us.apache.org/repos/asf/hadoop/blob/431e7d84/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeOptionParsing.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeOptionParsing.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeOptionParsing.java index f540253..a3582ce 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeOptionParsing.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeOptionParsing.java @@ -121,14 +121,6 @@ public class TestNameNodeOptionParsing { } { - final String[] args = {"-rollingUpgrade", "downgrade"}; - final StartupOption opt = NameNode.parseArguments(args); - assertEquals(StartupOption.ROLLINGUPGRADE, opt); - assertEquals(RollingUpgradeStartupOption.DOWNGRADE, opt.getRollingUpgradeStartupOption()); - assertTrue(RollingUpgradeStartupOption.DOWNGRADE.matches(opt)); - } - - { final String[] args = {"-rollingUpgrade", "rollback"}; final StartupOption opt = NameNode.parseArguments(args); assertEquals(StartupOption.ROLLINGUPGRADE, opt);