Author: szetszwo Date: Fri Feb 28 19:33:08 2014 New Revision: 1573040 URL: http://svn.apache.org/r1573040 Log: HDFS-6031. Add back the "-rollingUpgrade started" namenode startup option; otherwise, namenode cannot start when the layout version is changed.
Modified: hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-5535.txt hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/site/xdoc/HdfsRollingUpgrade.xml Modified: hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-5535.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-5535.txt?rev=1573040&r1=1573039&r2=1573040&view=diff ============================================================================== --- hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-5535.txt (original) +++ hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-5535.txt Fri Feb 28 19:33:08 2014 @@ -33,7 +33,7 @@ HDFS-5535 subtasks: so that the standby namenode can create checkpoints during upgrade. (szetszwo & jing9) - HDFS-5535. Add BlockPoolSliceStorage 'trash' to handle block deletions + HDFS-5907. Add BlockPoolSliceStorage 'trash' to handle block deletions during rolling upgrades. (Arpit Agarwal) HDFS-5494. Merge Protobuf-based-FSImage code from trunk - fix build @@ -123,3 +123,7 @@ HDFS-5535 subtasks: HDFS-6032. -rollingUpgrade query hits NPE after the NN restarts. (Haohui Mai via jing9) + + HDFS-6031. Add back the "-rollingUpgrade started" namenode startup option; + otherwise, namenode cannot start when the layout version is changed. + (szetszwo) Modified: hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java?rev=1573040&r1=1573039&r2=1573040&view=diff ============================================================================== --- hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java (original) +++ hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java Fri Feb 28 19:33:08 2014 @@ -49,7 +49,7 @@ public final class HdfsServerConstants { /** Startup options for rolling upgrade. */ public static enum RollingUpgradeStartupOption{ - ROLLBACK, DOWNGRADE; + ROLLBACK, DOWNGRADE, STARTED; private static final RollingUpgradeStartupOption[] VALUES = values(); @@ -95,10 +95,16 @@ public final class HdfsServerConstants { public static boolean isRollingUpgradeDowngrade(StartupOption option) { return option == ROLLINGUPGRADE - && option.getRollingUpgradeStartupOption() + && option.getRollingUpgradeStartupOption() == RollingUpgradeStartupOption.DOWNGRADE; } + public static boolean isRollingUpgradeStarted(StartupOption option) { + return option == ROLLINGUPGRADE + && option.getRollingUpgradeStartupOption() + == RollingUpgradeStartupOption.STARTED; + } + private final String name; // Used only with format and upgrade options Modified: hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java?rev=1573040&r1=1573039&r2=1573040&view=diff ============================================================================== --- hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java (original) +++ hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java Fri Feb 28 19:33:08 2014 @@ -217,6 +217,7 @@ public class FSImage implements Closeabl NNStorage.checkVersionUpgradable(storage.getLayoutVersion()); } if (startOpt != StartupOption.UPGRADE + && !StartupOption.isRollingUpgradeStarted(startOpt) && layoutVersion < Storage.LAST_PRE_UPGRADE_LAYOUT_VERSION && layoutVersion != HdfsConstants.NAMENODE_LAYOUT_VERSION) { throw new IOException( Modified: hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/site/xdoc/HdfsRollingUpgrade.xml URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/site/xdoc/HdfsRollingUpgrade.xml?rev=1573040&r1=1573039&r2=1573040&view=diff ============================================================================== --- hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/site/xdoc/HdfsRollingUpgrade.xml (original) +++ hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/site/xdoc/HdfsRollingUpgrade.xml Fri Feb 28 19:33:08 2014 @@ -75,10 +75,14 @@ </li> </ul></li> <li>Upgrade Active and Standby <em>NNs</em><ol> - <li>Shutdown, upgrade and restart <em>NN2</em> as standby.</li> + <li>Shutdown and upgrade <em>NN2</em>.</li> + <li>Start <em>NN2</em> as standby with the + "<a href="#namenode_-rollingUpgrade"><code>-rollingUpgrade started</code></a>" option.</li> <li>Failover from <em>NN1</em> to <em>NN2</em> - so that <em>NN2</em> becomes active and <em>NN1</em> becomes standby.</li> - <li>Shutdown, upgrade and restart <em>NN1</em> as standby.</li> + so that <em>NN2</em> becomes active and <em>NN1</em> becomes standby.</li> + <li>Shutdown and upgrade <em>NN1</em>.</li> + <li>Start <em>NN1</em> as standby with the + "<a href="#namenode_-rollingUpgrade"><code>-rollingUpgrade started</code></a>" option.</li> </ol></li> <li>Upgrade <em>DNs</em><ol> <li>Choose a small subset of datanodes (e.g. all datanodes under a particular rack).</li> @@ -132,7 +136,9 @@ <ul> <li>Upgrade <em>NN</em> and <em>SNN</em><ol> <li>Shutdown <em>SNN</em></li> - <li>Shutdown, upgrade and restart <em>NN</em></li> + <li>Shutdown and upgrade <em>NN</em>.</li> + <li>Start <em>NN</em> as standby with the + "<a href="#namenode_-rollingUpgrade"><code>-rollingUpgrade started</code></a>" option.</li> <li>Upgrade and restart <em>SNN</em></li> </ol></li> </ul> @@ -174,7 +180,7 @@ <li>Shutdown all <em>NNs</em> and <em>DNs</em>.</li> <li>Restore the pre-upgrade release in all machines.</li> <li>Start <em>NNs</em> with the - "<a href="#namenode_-rollingUpgrade"><code>-rollingUpgrade downgrade</code></a>" option.</li> + "<a href="#namenode_-rollingUpgrade"><code>-rollingUpgrade downgrade</code></a>" option.</li> <li>Start <em>DNs</em> normally.</li> </ol></li> </ul> @@ -198,7 +204,7 @@ <li>Shutdown all <em>NNs</em> and <em>DNs</em>.</li> <li>Restore the pre-upgrade release in all machines.</li> <li>Start <em>NNs</em> with the - "<a href="#namenode_-rollingUpgrade"><code>-rollingUpgrade rollback</code></a>" option.</li> + "<a href="#namenode_-rollingUpgrade"><code>-rollingUpgrade rollback</code></a>" option.</li> <li>Start <em>DNs</em> normally.</li> </ol></li> </ul> @@ -248,9 +254,11 @@ <subsection name="NameNode Startup Options" id="dfsadminCommands"> <h4><code>namenode -rollingUpgrade</code></h4> - <source>hdfs namenode -rollingUpgrade <downgrade|rollback></source> + <source>hdfs namenode -rollingUpgrade <downgrade|rollback|started></source> <p> - Downgrade or rollback an ongoing rolling upgrade. + When a rolling upgrade is in progress, + the <code>-rollingUpgrade</code> namenode startup option is used to specify + various rolling upgrade options. </p> <ul><li>Options:<table> <tr><td><code>downgrade</code></td> @@ -261,6 +269,11 @@ <td>Restores the namenode back to the pre-upgrade release but also reverts the user data back to the pre-upgrade state.</td> </tr> + <tr><td><code>started</code></td> + <td>Specifies a rolling upgrade already started + so that the namenode should allow image directories + with different layout versions during startup.</td> + </tr> </table></li></ul> </subsection>