HDFS-6135. Merge r1581070 from trunk.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1581071 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jing Zhao 2014-03-24 21:26:24 +00:00
parent b964c4424f
commit 069e6b389e
3 changed files with 17 additions and 1 deletions

View File

@ -438,6 +438,9 @@ Release 2.4.0 - UNRELEASED
HDFS-6140. WebHDFS cannot create a file with spaces in the name after HA HDFS-6140. WebHDFS cannot create a file with spaces in the name after HA
failover changes. (cnauroth) failover changes. (cnauroth)
HDFS-6135. In HDFS upgrade with HA setup, JournalNode cannot handle layout
version bump when rolling back. (jing9)
BREAKDOWN OF HDFS-5698 SUBTASKS AND RELATED JIRAS BREAKDOWN OF HDFS-5698 SUBTASKS AND RELATED JIRAS
HDFS-5717. Save FSImage header in protobuf. (Haohui Mai via jing9) HDFS-5717. Save FSImage header in protobuf. (Haohui Mai via jing9)

View File

@ -20,6 +20,7 @@ package org.apache.hadoop.hdfs.qjournal.server;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Properties;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -27,6 +28,8 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileUtil; import org.apache.hadoop.fs.FileUtil;
import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.NodeType; import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.NodeType;
import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption; import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption;
import org.apache.hadoop.hdfs.server.common.InconsistentFSStateException;
import org.apache.hadoop.hdfs.server.common.IncorrectVersionException;
import org.apache.hadoop.hdfs.server.common.Storage; import org.apache.hadoop.hdfs.server.common.Storage;
import org.apache.hadoop.hdfs.server.common.StorageErrorReporter; import org.apache.hadoop.hdfs.server.common.StorageErrorReporter;
import org.apache.hadoop.hdfs.server.namenode.FileJournalManager; import org.apache.hadoop.hdfs.server.namenode.FileJournalManager;
@ -203,6 +206,16 @@ class JNStorage extends Storage {
} }
} }
@Override
protected void setLayoutVersion(Properties props, StorageDirectory sd)
throws IncorrectVersionException, InconsistentFSStateException {
int lv = Integer.parseInt(getProperty(props, sd, "layoutVersion"));
// For journal node, since it now does not decode but just scan through the
// edits, it can handle edits with future version in most of the cases.
// Thus currently we may skip the layoutVersion check here.
layoutVersion = lv;
}
void checkConsistentNamespace(NamespaceInfo nsInfo) void checkConsistentNamespace(NamespaceInfo nsInfo)
throws IOException { throws IOException {
if (nsInfo.getNamespaceID() != getNamespaceID()) { if (nsInfo.getNamespaceID() != getNamespaceID()) {

View File

@ -202,7 +202,7 @@ public class StorageInfo {
: NameNodeLayoutVersion.FEATURES; : NameNodeLayoutVersion.FEATURES;
} }
static String getProperty(Properties props, StorageDirectory sd, protected static String getProperty(Properties props, StorageDirectory sd,
String name) throws InconsistentFSStateException { String name) throws InconsistentFSStateException {
String property = props.getProperty(name); String property = props.getProperty(name);
if (property == null) { if (property == null) {