You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by cn...@apache.org on 2014/02/08 20:05:17 UTC
svn commit: r1566100 [1/2] - in
/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs: ./
src/main/java/ src/main/java/org/apache/hadoop/hdfs/
src/main/java/org/apache/hadoop/hdfs/client/
src/main/java/org/apache/hadoop/hdfs/protocol/ src/m...
Author: cnauroth
Date: Sat Feb 8 19:05:12 2014
New Revision: 1566100
URL: http://svn.apache.org/r1566100
Log:
Merge trunk to HDFS-4685.
Added:
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/client/ShortCircuitSharedMemorySegment.java
- copied unchanged from r1566041, hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/client/ShortCircuitSharedMemorySegment.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestHttpPolicy.java
- copied unchanged from r1566041, hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestHttpPolicy.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/client/
- copied from r1566041, hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/client/
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/client/TestShortCircuitSharedMemorySegment.java
- copied unchanged from r1566041, hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/client/TestShortCircuitSharedMemorySegment.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeOptionParsing.java
- copied unchanged from r1566041, hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeOptionParsing.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/hadoop-2-reserved.tgz
- copied unchanged from r1566041, hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/hadoop-2-reserved.tgz
Modified:
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/ (props changed)
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/ (props changed)
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/BlockReaderLocalLegacy.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/NameNodeProxies.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/PeerCache.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/HdfsConstants.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyDefault.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/SecureDataNodeStarter.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormat.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/CacheAdmin.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/native/ (props changed)
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/ (props changed)
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/ (props changed)
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/secondary/ (props changed)
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/site/apt/HdfsUserGuide.apt.vm
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/site/xdoc/HdfsSnapshots.xml
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/test/hdfs/ (props changed)
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUpgradeFromImage.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDataTransferKeepalive.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/balancer/TestBalancerWithNodeGroup.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestReplicationPolicyWithNodeGroup.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestAuditLogs.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeHttpServer.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestHASafeMode.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestHttpsFileSystem.java
hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testCacheAdminConf.xml
Propchange: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/
------------------------------------------------------------------------------
Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs:r1563326-1566041
Modified: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Sat Feb 8 19:05:12 2014
@@ -303,6 +303,14 @@ Release 2.4.0 - UNRELEASED
HDFS-5804. HDFS NFS Gateway fails to mount and proxy when using Kerberos.
(Abin Shahab via jing9)
+ HDFS-5859. DataNode#checkBlockToken should check block tokens even if
+ security is not enabled. (cmccabe)
+
+ HDFS-5746. Add ShortCircuitSharedMemorySegment (cmccabe)
+
+ HDFS-4911. Reduce PeerCache timeout to be commensurate with
+ dfs.datanode.socket.reuse.keepalive (cmccabe)
+
OPTIMIZATIONS
HDFS-5790. LeaseManager.findPath is very slow when many leases need recovery
@@ -319,6 +327,32 @@ Release 2.4.0 - UNRELEASED
HDFS-5856. DataNode.checkDiskError might throw NPE.
(Josh Elser via suresh)
+ HDFS-5828. BlockPlacementPolicyWithNodeGroup can place multiple replicas on
+ the same node group when dfs.namenode.avoid.write.stale.datanode is true.
+ (Buddy via junping_du)
+
+ HDFS-5767. NFS implementation assumes userName userId mapping to be unique,
+ which is not true sometimes (Yongjun Zhang via brandonli)
+
+ HDFS-5791. TestHttpsFileSystem should use a random port to avoid binding
+ error during testing (Haohui Mai via brandonli)
+
+ HDFS-5709. Improve NameNode upgrade with existing reserved paths and path
+ components. (Andrew Wang via atm)
+
+ HDFS-5881. Fix skip() of the short-circuit local reader(legacy). (kihwal)
+
+ HDFS-5895. HDFS cacheadmin -listPools has exit_code of 1 when the command
+ returns 0 result. (Tassapol Athiapinya via cnauroth)
+
+ HDFS-5807. TestBalancerWithNodeGroup.testBalancerWithNodeGroup fails
+ intermittently. (Chen He via kihwal)
+
+ HDFS-5882. TestAuditLogs is flaky (jxiang via cmccabe)
+
+ HDFS-5900. Cannot set cache pool limit of "unlimited" via CacheAdmin.
+ (wang)
+
Release 2.3.0 - UNRELEASED
INCOMPATIBLE CHANGES
@@ -848,6 +882,15 @@ Release 2.3.0 - UNRELEASED
HDFS-5842. Cannot create hftp filesystem when using a proxy user ugi and a doAs
on a secure cluster. (jing9)
+ HDFS-5399. Revisit SafeModeException and corresponding retry policies.
+ (Jing Zhao via todd)
+
+ HDFS-5876. SecureDataNodeStarter does not pick up configuration in
+ hdfs-site.xml. (Haohui Mai via jing9)
+
+ HDFS-5873. dfs.http.policy should have higher precedence over dfs.https.enable.
+ (Haohui Mai via jing9)
+
BREAKDOWN OF HDFS-2832 SUBTASKS AND RELATED JIRAS
HDFS-4985. Add storage type to the protocol and expose it in block report
Propchange: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/
------------------------------------------------------------------------------
Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java:r1563326-1566041
Modified: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/BlockReaderLocalLegacy.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/BlockReaderLocalLegacy.java?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/BlockReaderLocalLegacy.java (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/BlockReaderLocalLegacy.java Sat Feb 8 19:05:12 2014
@@ -629,7 +629,7 @@ class BlockReaderLocalLegacy implements
skipBuf = new byte[bytesPerChecksum];
}
int ret = read(skipBuf, 0, (int)(n - remaining));
- return ret;
+ return (remaining + ret);
}
// optimize for big gap: discard the current buffer, skip to
@@ -660,9 +660,9 @@ class BlockReaderLocalLegacy implements
int ret = read(skipBuf, 0, myOffsetFromChunkBoundary);
if (ret == -1) { // EOS
- return toskip;
+ return (toskip + remaining);
} else {
- return (toskip + ret);
+ return (toskip + remaining + ret);
}
}
Modified: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java Sat Feb 8 19:05:12 2014
@@ -36,6 +36,8 @@ import static org.apache.hadoop.hdfs.DFS
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_CLIENT_FAILOVER_SLEEPTIME_BASE_KEY;
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_CLIENT_FAILOVER_SLEEPTIME_MAX_DEFAULT;
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_CLIENT_FAILOVER_SLEEPTIME_MAX_KEY;
+import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_CLIENT_RETRY_MAX_ATTEMPTS_DEFAULT;
+import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_CLIENT_RETRY_MAX_ATTEMPTS_KEY;
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_CLIENT_MAX_BLOCK_ACQUIRE_FAILURES_DEFAULT;
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_CLIENT_MAX_BLOCK_ACQUIRE_FAILURES_KEY;
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_CLIENT_READ_PREFETCH_SIZE_KEY;
@@ -261,6 +263,7 @@ public class DFSClient implements java.i
public static class Conf {
final int hdfsTimeout; // timeout value for a DFS operation.
final int maxFailoverAttempts;
+ final int maxRetryAttempts;
final int failoverSleepBaseMillis;
final int failoverSleepMaxMillis;
final int maxBlockAcquireFailures;
@@ -306,6 +309,9 @@ public class DFSClient implements java.i
maxFailoverAttempts = conf.getInt(
DFS_CLIENT_FAILOVER_MAX_ATTEMPTS_KEY,
DFS_CLIENT_FAILOVER_MAX_ATTEMPTS_DEFAULT);
+ maxRetryAttempts = conf.getInt(
+ DFS_CLIENT_RETRY_MAX_ATTEMPTS_KEY,
+ DFS_CLIENT_RETRY_MAX_ATTEMPTS_DEFAULT);
failoverSleepBaseMillis = conf.getInt(
DFS_CLIENT_FAILOVER_SLEEPTIME_BASE_KEY,
DFS_CLIENT_FAILOVER_SLEEPTIME_BASE_DEFAULT);
Modified: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java Sat Feb 8 19:05:12 2014
@@ -84,9 +84,11 @@ public class DFSConfigKeys extends Commo
public static final int DFS_CLIENT_FAILOVER_CONNECTION_RETRIES_DEFAULT = 0;
public static final String DFS_CLIENT_FAILOVER_CONNECTION_RETRIES_ON_SOCKET_TIMEOUTS_KEY = "dfs.client.failover.connection.retries.on.timeouts";
public static final int DFS_CLIENT_FAILOVER_CONNECTION_RETRIES_ON_SOCKET_TIMEOUTS_DEFAULT = 0;
+ public static final String DFS_CLIENT_RETRY_MAX_ATTEMPTS_KEY = "dfs.client.retry.max.attempts";
+ public static final int DFS_CLIENT_RETRY_MAX_ATTEMPTS_DEFAULT = 10;
public static final String DFS_CLIENT_SOCKET_CACHE_EXPIRY_MSEC_KEY = "dfs.client.socketcache.expiryMsec";
- public static final long DFS_CLIENT_SOCKET_CACHE_EXPIRY_MSEC_DEFAULT = 2 * 60 * 1000;
+ public static final long DFS_CLIENT_SOCKET_CACHE_EXPIRY_MSEC_DEFAULT = 3000;
public static final String DFS_CLIENT_WRITE_EXCLUDE_NODES_CACHE_EXPIRY_INTERVAL = "dfs.client.write.exclude.nodes.cache.expiry.interval.millis";
public static final long DFS_CLIENT_WRITE_EXCLUDE_NODES_CACHE_EXPIRY_INTERVAL_DEFAULT = 10 * 60 * 1000; // 10 minutes, in ms
public static final String DFS_NAMENODE_BACKUP_ADDRESS_KEY = "dfs.namenode.backup.address";
@@ -217,7 +219,7 @@ public class DFSConfigKeys extends Commo
public static final String DFS_DATANODE_SYNCONCLOSE_KEY = "dfs.datanode.synconclose";
public static final boolean DFS_DATANODE_SYNCONCLOSE_DEFAULT = false;
public static final String DFS_DATANODE_SOCKET_REUSE_KEEPALIVE_KEY = "dfs.datanode.socket.reuse.keepalive";
- public static final int DFS_DATANODE_SOCKET_REUSE_KEEPALIVE_DEFAULT = 1000;
+ public static final int DFS_DATANODE_SOCKET_REUSE_KEEPALIVE_DEFAULT = 4000;
public static final String DFS_NAMENODE_DATANODE_REGISTRATION_IP_HOSTNAME_CHECK_KEY = "dfs.namenode.datanode.registration.ip-hostname-check";
public static final boolean DFS_NAMENODE_DATANODE_REGISTRATION_IP_HOSTNAME_CHECK_DEFAULT = true;
@@ -578,6 +580,8 @@ public class DFSConfigKeys extends Commo
public static final String DFS_HTTP_CLIENT_RETRY_POLICY_SPEC_DEFAULT = "10000,6,60000,10"; //t1,n1,t2,n2,...
public static final String DFS_HTTP_CLIENT_FAILOVER_MAX_ATTEMPTS_KEY = "dfs.http.client.failover.max.attempts";
public static final int DFS_HTTP_CLIENT_FAILOVER_MAX_ATTEMPTS_DEFAULT = 15;
+ public static final String DFS_HTTP_CLIENT_RETRY_MAX_ATTEMPTS_KEY = "dfs.http.client.retry.max.attempts";
+ public static final int DFS_HTTP_CLIENT_RETRY_MAX_ATTEMPTS_DEFAULT = 10;
public static final String DFS_HTTP_CLIENT_FAILOVER_SLEEPTIME_BASE_KEY = "dfs.http.client.failover.sleep.base.millis";
public static final int DFS_HTTP_CLIENT_FAILOVER_SLEEPTIME_BASE_DEFAULT = 500;
public static final String DFS_HTTP_CLIENT_FAILOVER_SLEEPTIME_MAX_KEY = "dfs.http.client.failover.sleep.max.millis";
Modified: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java Sat Feb 8 19:05:12 2014
@@ -1345,6 +1345,14 @@ implements ByteBufferReadable, CanSetDro
pos += blockReader.skip(diff);
if (pos == targetPos) {
done = true;
+ } else {
+ // The range was already checked. If the block reader returns
+ // something unexpected instead of throwing an exception, it is
+ // most likely a bug.
+ String errMsg = "BlockReader failed to seek to " +
+ targetPos + ". Instead, it seeked to " + pos + ".";
+ DFSClient.LOG.warn(errMsg);
+ throw new IOException(errMsg);
}
} catch (IOException e) {//make following read to retry
if(DFSClient.LOG.isDebugEnabled()) {
Modified: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java Sat Feb 8 19:05:12 2014
@@ -262,6 +262,47 @@ public class DFSUtil {
}
/**
+ * Checks if a string is a valid path component. For instance, components
+ * cannot contain a ":" or "/", and cannot be equal to a reserved component
+ * like ".snapshot".
+ * <p>
+ * The primary use of this method is for validating paths when loading the
+ * FSImage. During normal NN operation, paths are sometimes allowed to
+ * contain reserved components.
+ *
+ * @return If component is valid
+ */
+ public static boolean isValidNameForComponent(String component) {
+ if (component.equals(".") ||
+ component.equals("..") ||
+ component.indexOf(":") >= 0 ||
+ component.indexOf("/") >= 0) {
+ return false;
+ }
+ return !isReservedPathComponent(component);
+ }
+
+
+ /**
+ * Returns if the component is reserved.
+ *
+ * <p>
+ * Note that some components are only reserved under certain directories, e.g.
+ * "/.reserved" is reserved, while "/hadoop/.reserved" is not.
+ *
+ * @param component
+ * @return if the component is reserved
+ */
+ public static boolean isReservedPathComponent(String component) {
+ for (String reserved : HdfsConstants.RESERVED_PATH_COMPONENTS) {
+ if (component.equals(reserved)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
* Converts a byte array to a string using UTF8 encoding.
*/
public static String bytes2String(byte[] bytes) {
@@ -312,7 +353,25 @@ public class DFSUtil {
}
return result.toString();
}
-
+
+ /**
+ * Converts a list of path components into a path using Path.SEPARATOR.
+ *
+ * @param components Path components
+ * @return Combined path as a UTF-8 string
+ */
+ public static String strings2PathString(String[] components) {
+ if (components.length == 0) {
+ return "";
+ }
+ if (components.length == 1) {
+ if (components[0] == null || components[0].isEmpty()) {
+ return Path.SEPARATOR;
+ }
+ }
+ return Joiner.on(Path.SEPARATOR).join(components);
+ }
+
/**
* Given a list of path components returns a byte array
*/
@@ -1508,31 +1567,34 @@ public class DFSUtil {
* configuration settings.
*/
public static HttpConfig.Policy getHttpPolicy(Configuration conf) {
- String httpPolicy = conf.get(DFSConfigKeys.DFS_HTTP_POLICY_KEY,
- DFSConfigKeys.DFS_HTTP_POLICY_DEFAULT);
-
- HttpConfig.Policy policy = HttpConfig.Policy.fromString(httpPolicy);
-
- if (policy == HttpConfig.Policy.HTTP_ONLY) {
- boolean httpsEnabled = conf.getBoolean(
- DFSConfigKeys.DFS_HTTPS_ENABLE_KEY,
+ String policyStr = conf.get(DFSConfigKeys.DFS_HTTP_POLICY_KEY);
+ if (policyStr == null) {
+ boolean https = conf.getBoolean(DFSConfigKeys.DFS_HTTPS_ENABLE_KEY,
DFSConfigKeys.DFS_HTTPS_ENABLE_DEFAULT);
- boolean hadoopSslEnabled = conf.getBoolean(
+ boolean hadoopSsl = conf.getBoolean(
CommonConfigurationKeys.HADOOP_SSL_ENABLED_KEY,
CommonConfigurationKeys.HADOOP_SSL_ENABLED_DEFAULT);
- if (hadoopSslEnabled) {
+ if (hadoopSsl) {
LOG.warn(CommonConfigurationKeys.HADOOP_SSL_ENABLED_KEY
- + " is deprecated. Please use "
- + DFSConfigKeys.DFS_HTTPS_ENABLE_KEY + ".");
- policy = HttpConfig.Policy.HTTPS_ONLY;
- } else if (httpsEnabled) {
+ + " is deprecated. Please use " + DFSConfigKeys.DFS_HTTP_POLICY_KEY
+ + ".");
+ }
+ if (https) {
LOG.warn(DFSConfigKeys.DFS_HTTPS_ENABLE_KEY
- + " is deprecated. Please use "
- + DFSConfigKeys.DFS_HTTPS_ENABLE_KEY + ".");
- policy = HttpConfig.Policy.HTTP_AND_HTTPS;
+ + " is deprecated. Please use " + DFSConfigKeys.DFS_HTTP_POLICY_KEY
+ + ".");
}
+
+ return (hadoopSsl || https) ? HttpConfig.Policy.HTTP_AND_HTTPS
+ : HttpConfig.Policy.HTTP_ONLY;
+ }
+
+ HttpConfig.Policy policy = HttpConfig.Policy.fromString(policyStr);
+ if (policy == null) {
+ throw new HadoopIllegalArgumentException("Unregonized value '"
+ + policyStr + "' for " + DFSConfigKeys.DFS_HTTP_POLICY_KEY);
}
conf.set(DFSConfigKeys.DFS_HTTP_POLICY_KEY, policy.name());
Modified: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/NameNodeProxies.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/NameNodeProxies.java?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/NameNodeProxies.java (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/NameNodeProxies.java Sat Feb 8 19:05:12 2014
@@ -24,6 +24,8 @@ import static org.apache.hadoop.hdfs.DFS
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_CLIENT_FAILOVER_SLEEPTIME_BASE_KEY;
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_CLIENT_FAILOVER_SLEEPTIME_MAX_DEFAULT;
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_CLIENT_FAILOVER_SLEEPTIME_MAX_KEY;
+import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_CLIENT_RETRY_MAX_ATTEMPTS_KEY;
+import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_CLIENT_RETRY_MAX_ATTEMPTS_DEFAULT;
import java.io.IOException;
import java.lang.reflect.Constructor;
@@ -144,9 +146,10 @@ public class NameNodeProxies {
.createFailoverProxyProvider(conf, failoverProxyProviderClass, xface,
nameNodeUri);
Conf config = new Conf(conf);
- T proxy = (T) RetryProxy.create(xface, failoverProxyProvider, RetryPolicies
- .failoverOnNetworkException(RetryPolicies.TRY_ONCE_THEN_FAIL,
- config.maxFailoverAttempts, config.failoverSleepBaseMillis,
+ T proxy = (T) RetryProxy.create(xface, failoverProxyProvider,
+ RetryPolicies.failoverOnNetworkException(
+ RetryPolicies.TRY_ONCE_THEN_FAIL, config.maxFailoverAttempts,
+ config.maxRetryAttempts, config.failoverSleepBaseMillis,
config.failoverSleepMaxMillis));
Text dtService = HAUtil.buildTokenServiceForLogicalUri(nameNodeUri);
@@ -192,11 +195,14 @@ public class NameNodeProxies {
int maxFailoverAttempts = config.getInt(
DFS_CLIENT_FAILOVER_MAX_ATTEMPTS_KEY,
DFS_CLIENT_FAILOVER_MAX_ATTEMPTS_DEFAULT);
+ int maxRetryAttempts = config.getInt(
+ DFS_CLIENT_RETRY_MAX_ATTEMPTS_KEY,
+ DFS_CLIENT_RETRY_MAX_ATTEMPTS_DEFAULT);
InvocationHandler dummyHandler = new LossyRetryInvocationHandler<T>(
numResponseToDrop, failoverProxyProvider,
RetryPolicies.failoverOnNetworkException(
- RetryPolicies.TRY_ONCE_THEN_FAIL,
- Math.max(numResponseToDrop + 1, maxFailoverAttempts), delay,
+ RetryPolicies.TRY_ONCE_THEN_FAIL, maxFailoverAttempts,
+ Math.max(numResponseToDrop + 1, maxRetryAttempts), delay,
maxCap));
T proxy = (T) Proxy.newProxyInstance(
Modified: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/PeerCache.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/PeerCache.java?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/PeerCache.java (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/PeerCache.java Sat Feb 8 19:05:12 2014
@@ -18,6 +18,7 @@
package org.apache.hadoop.hdfs;
+import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
@@ -25,6 +26,7 @@ import java.util.Map.Entry;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.collect.LinkedListMultimap;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hdfs.protocol.DatanodeID;
@@ -118,6 +120,11 @@ class PeerCache {
return instance;
}
+ @VisibleForTesting
+ public static synchronized void setInstance(int c, long e) {
+ instance = new PeerCache(c, e);
+ }
+
private boolean isDaemonStarted() {
return (daemon == null)? false: true;
}
@@ -171,8 +178,17 @@ class PeerCache {
while (iter.hasNext()) {
Value candidate = iter.next();
iter.remove();
- if (!candidate.getPeer().isClosed()) {
- return candidate.getPeer();
+ long ageMs = Time.monotonicNow() - candidate.getTime();
+ Peer peer = candidate.getPeer();
+ if (ageMs >= expiryPeriod) {
+ try {
+ peer.close();
+ } catch (IOException e) {
+ LOG.warn("got IOException closing stale peer " + peer +
+ ", which is " + ageMs + " ms old");
+ }
+ } else if (!peer.isClosed()) {
+ return peer;
}
}
return null;
Modified: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/HdfsConstants.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/HdfsConstants.java?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/HdfsConstants.java (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/HdfsConstants.java Sat Feb 8 19:05:12 2014
@@ -22,6 +22,7 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.DFSUtil;
import org.apache.hadoop.hdfs.HdfsConfiguration;
+import org.apache.hadoop.hdfs.server.namenode.FSDirectory;
/************************************
* Some handy constants
@@ -108,7 +109,17 @@ public class HdfsConstants {
*/
public static final int LAYOUT_VERSION = LayoutVersion
.getCurrentLayoutVersion();
-
+
+ /**
+ * Path components that are reserved in HDFS.
+ * <p>
+ * .reserved is only reserved under root ("/").
+ */
+ public static final String[] RESERVED_PATH_COMPONENTS = new String[] {
+ HdfsConstants.DOT_SNAPSHOT_DIR,
+ FSDirectory.DOT_RESERVED_STRING
+ };
+
/**
* A special path component contained in the path for a snapshot file/dir
*/
Modified: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyDefault.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyDefault.java?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyDefault.java (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyDefault.java Sat Feb 8 19:05:12 2014
@@ -317,7 +317,7 @@ public class BlockPlacementPolicyDefault
// We need to additionally exclude the nodes that were added to the
// result list in the successful calls to choose*() above.
for (DatanodeStorageInfo resultStorage : results) {
- oldExcludedNodes.add(resultStorage.getDatanodeDescriptor());
+ addToExcludedNodes(resultStorage.getDatanodeDescriptor(), oldExcludedNodes);
}
// Set numOfReplicas, since it can get out of sync with the result list
// if the NotEnoughReplicasException was thrown in chooseRandom().
Modified: hadoop/common/branches/HDFS-4685/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-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java Sat Feb 8 19:05:12 2014
@@ -59,7 +59,8 @@ public final class HdfsServerConstants {
INITIALIZESHAREDEDITS("-initializeSharedEdits"),
RECOVER ("-recover"),
FORCE("-force"),
- NONINTERACTIVE("-nonInteractive");
+ NONINTERACTIVE("-nonInteractive"),
+ RENAMERESERVED("-renameReserved");
private final String name;
Modified: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java Sat Feb 8 19:05:12 2014
@@ -362,13 +362,13 @@ public class DataNode extends Configured
.setConf(conf).setACL(new AccessControlList(conf.get(DFS_ADMIN, " ")));
HttpConfig.Policy policy = DFSUtil.getHttpPolicy(conf);
- InetSocketAddress infoSocAddr = DataNode.getInfoAddr(conf);
- String infoHost = infoSocAddr.getHostName();
if (policy.isHttpEnabled()) {
if (secureResources == null) {
+ InetSocketAddress infoSocAddr = DataNode.getInfoAddr(conf);
int port = infoSocAddr.getPort();
- builder.addEndpoint(URI.create("http://" + infoHost + ":" + port));
+ builder.addEndpoint(URI.create("http://"
+ + NetUtils.getHostPortString(infoSocAddr)));
if (port == 0) {
builder.setFindPort(true);
}
@@ -381,7 +381,7 @@ public class DataNode extends Configured
if (policy.isHttpsEnabled()) {
InetSocketAddress secInfoSocAddr = NetUtils.createSocketAddr(conf.get(
- DFS_DATANODE_HTTPS_ADDRESS_KEY, infoHost + ":" + 0));
+ DFS_DATANODE_HTTPS_ADDRESS_KEY, DFS_DATANODE_HTTPS_ADDRESS_DEFAULT));
Configuration sslConf = DFSUtil.loadSslConfiguration(conf);
DFSUtil.loadSslConfToHttpServerBuilder(builder, sslConf);
@@ -390,7 +390,8 @@ public class DataNode extends Configured
if (port == 0) {
builder.setFindPort(true);
}
- builder.addEndpoint(URI.create("https://" + infoHost + ":" + port));
+ builder.addEndpoint(URI.create("https://"
+ + NetUtils.getHostPortString(secInfoSocAddr)));
}
this.infoServer = builder.build();
@@ -1194,7 +1195,7 @@ public class DataNode extends Configured
private void checkBlockToken(ExtendedBlock block, Token<BlockTokenIdentifier> token,
AccessMode accessMode) throws IOException {
- if (isBlockTokenEnabled && UserGroupInformation.isSecurityEnabled()) {
+ if (isBlockTokenEnabled) {
BlockTokenIdentifier id = new BlockTokenIdentifier();
ByteArrayInputStream buf = new ByteArrayInputStream(token.getIdentifier());
DataInputStream in = new DataInputStream(buf);
Modified: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/SecureDataNodeStarter.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/SecureDataNodeStarter.java?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/SecureDataNodeStarter.java (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/SecureDataNodeStarter.java Sat Feb 8 19:05:12 2014
@@ -25,6 +25,7 @@ import org.apache.commons.daemon.DaemonC
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.DFSUtil;
+import org.apache.hadoop.hdfs.HdfsConfiguration;
import org.apache.hadoop.hdfs.server.common.HdfsServerConstants;
import org.apache.hadoop.http.HttpConfig;
import org.apache.hadoop.http.HttpServer2;
@@ -62,7 +63,9 @@ public class SecureDataNodeStarter imple
@Override
public void init(DaemonContext context) throws Exception {
System.err.println("Initializing secure datanode resources");
- Configuration conf = new Configuration();
+ // Create a new HdfsConfiguration object to ensure that the configuration in
+ // hdfs-site.xml is picked up.
+ Configuration conf = new HdfsConfiguration();
// Stash command-line arguments for regular datanode
args = context.getArguments();
Modified: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogLoader.java Sat Feb 8 19:05:12 2014
@@ -17,6 +17,7 @@
*/
package org.apache.hadoop.hdfs.server.namenode;
+import static org.apache.hadoop.hdfs.server.namenode.FSImageFormat.renameReservedPathsOnUpgrade;
import static org.apache.hadoop.util.Time.now;
import java.io.FilterInputStream;
@@ -296,8 +297,10 @@ public class FSEditLogLoader {
if (addCloseOp.aclEntries != null) {
fsNamesys.getAclConfigFlag().checkForEditLog();
}
+ final String path =
+ renameReservedPathsOnUpgrade(addCloseOp.path, logVersion);
if (FSNamesystem.LOG.isDebugEnabled()) {
- FSNamesystem.LOG.debug(op.opCode + ": " + addCloseOp.path +
+ FSNamesystem.LOG.debug(op.opCode + ": " + path +
" numblocks : " + addCloseOp.blocks.length +
" clientHolder " + addCloseOp.clientName +
" clientMachine " + addCloseOp.clientMachine);
@@ -308,9 +311,9 @@ public class FSEditLogLoader {
// 3. OP_ADD to open file for append
// See if the file already exists (persistBlocks call)
- final INodesInPath iip = fsDir.getLastINodeInPath(addCloseOp.path);
+ final INodesInPath iip = fsDir.getLastINodeInPath(path);
final INodeFile oldFile = INodeFile.valueOf(
- iip.getINode(0), addCloseOp.path, true);
+ iip.getINode(0), path, true);
INodeFile newFile = oldFile;
if (oldFile == null) { // this is OP_ADD on a new file (case 1)
// versions > 0 support per file replication
@@ -323,11 +326,11 @@ public class FSEditLogLoader {
inodeId = getAndUpdateLastInodeId(addCloseOp.inodeId, logVersion,
lastInodeId);
newFile = fsDir.unprotectedAddFile(inodeId,
- addCloseOp.path, addCloseOp.permissions, addCloseOp.aclEntries,
+ path, addCloseOp.permissions, addCloseOp.aclEntries,
replication, addCloseOp.mtime, addCloseOp.atime,
addCloseOp.blockSize, true, addCloseOp.clientName,
addCloseOp.clientMachine);
- fsNamesys.leaseManager.addLease(addCloseOp.clientName, addCloseOp.path);
+ fsNamesys.leaseManager.addLease(addCloseOp.clientName, path);
// add the op into retry cache if necessary
if (toAddRetryCache) {
@@ -343,11 +346,11 @@ public class FSEditLogLoader {
FSNamesystem.LOG.debug("Reopening an already-closed file " +
"for append");
}
- LocatedBlock lb = fsNamesys.prepareFileForWrite(addCloseOp.path,
+ LocatedBlock lb = fsNamesys.prepareFileForWrite(path,
oldFile, addCloseOp.clientName, addCloseOp.clientMachine, null,
false, iip.getLatestSnapshotId(), false);
- newFile = INodeFile.valueOf(fsDir.getINode(addCloseOp.path),
- addCloseOp.path, true);
+ newFile = INodeFile.valueOf(fsDir.getINode(path),
+ path, true);
// add the op into retry cache is necessary
if (toAddRetryCache) {
@@ -368,16 +371,17 @@ public class FSEditLogLoader {
}
case OP_CLOSE: {
AddCloseOp addCloseOp = (AddCloseOp)op;
-
+ final String path =
+ renameReservedPathsOnUpgrade(addCloseOp.path, logVersion);
if (FSNamesystem.LOG.isDebugEnabled()) {
- FSNamesystem.LOG.debug(op.opCode + ": " + addCloseOp.path +
+ FSNamesystem.LOG.debug(op.opCode + ": " + path +
" numblocks : " + addCloseOp.blocks.length +
" clientHolder " + addCloseOp.clientName +
" clientMachine " + addCloseOp.clientMachine);
}
- final INodesInPath iip = fsDir.getLastINodeInPath(addCloseOp.path);
- final INodeFile file = INodeFile.valueOf(iip.getINode(0), addCloseOp.path);
+ final INodesInPath iip = fsDir.getLastINodeInPath(path);
+ final INodeFile file = INodeFile.valueOf(iip.getINode(0), path);
// Update the salient file attributes.
file.setAccessTime(addCloseOp.atime, Snapshot.CURRENT_STATE_ID);
@@ -391,24 +395,26 @@ public class FSEditLogLoader {
// could show up twice in a row. But after that version, this
// should be fixed, so we should treat it as an error.
throw new IOException(
- "File is not under construction: " + addCloseOp.path);
+ "File is not under construction: " + path);
}
// One might expect that you could use removeLease(holder, path) here,
// but OP_CLOSE doesn't serialize the holder. So, remove by path.
if (file.isUnderConstruction()) {
- fsNamesys.leaseManager.removeLeaseWithPrefixPath(addCloseOp.path);
+ fsNamesys.leaseManager.removeLeaseWithPrefixPath(path);
file.toCompleteFile(file.getModificationTime());
}
break;
}
case OP_UPDATE_BLOCKS: {
UpdateBlocksOp updateOp = (UpdateBlocksOp)op;
+ final String path =
+ renameReservedPathsOnUpgrade(updateOp.path, logVersion);
if (FSNamesystem.LOG.isDebugEnabled()) {
- FSNamesystem.LOG.debug(op.opCode + ": " + updateOp.path +
+ FSNamesystem.LOG.debug(op.opCode + ": " + path +
" numblocks : " + updateOp.blocks.length);
}
- INodeFile oldFile = INodeFile.valueOf(fsDir.getINode(updateOp.path),
- updateOp.path);
+ INodeFile oldFile = INodeFile.valueOf(fsDir.getINode(path),
+ path);
// Update in-memory data structures
updateBlocks(fsDir, updateOp, oldFile);
@@ -419,7 +425,7 @@ public class FSEditLogLoader {
}
case OP_ADD_BLOCK: {
AddBlockOp addBlockOp = (AddBlockOp) op;
- String path = addBlockOp.getPath();
+ String path = renameReservedPathsOnUpgrade(addBlockOp.getPath(), logVersion);
if (FSNamesystem.LOG.isDebugEnabled()) {
FSNamesystem.LOG.debug(op.opCode + ": " + path +
" new block id : " + addBlockOp.getLastBlock().getBlockId());
@@ -433,14 +439,20 @@ public class FSEditLogLoader {
SetReplicationOp setReplicationOp = (SetReplicationOp)op;
short replication = fsNamesys.getBlockManager().adjustReplication(
setReplicationOp.replication);
- fsDir.unprotectedSetReplication(setReplicationOp.path,
+ fsDir.unprotectedSetReplication(
+ renameReservedPathsOnUpgrade(setReplicationOp.path, logVersion),
replication, null);
break;
}
case OP_CONCAT_DELETE: {
ConcatDeleteOp concatDeleteOp = (ConcatDeleteOp)op;
- fsDir.unprotectedConcat(concatDeleteOp.trg, concatDeleteOp.srcs,
- concatDeleteOp.timestamp);
+ String trg = renameReservedPathsOnUpgrade(concatDeleteOp.trg, logVersion);
+ String[] srcs = new String[concatDeleteOp.srcs.length];
+ for (int i=0; i<srcs.length; i++) {
+ srcs[i] =
+ renameReservedPathsOnUpgrade(concatDeleteOp.srcs[i], logVersion);
+ }
+ fsDir.unprotectedConcat(trg, srcs, concatDeleteOp.timestamp);
if (toAddRetryCache) {
fsNamesys.addCacheEntry(concatDeleteOp.rpcClientId,
@@ -450,7 +462,9 @@ public class FSEditLogLoader {
}
case OP_RENAME_OLD: {
RenameOldOp renameOp = (RenameOldOp)op;
- fsDir.unprotectedRenameTo(renameOp.src, renameOp.dst,
+ final String src = renameReservedPathsOnUpgrade(renameOp.src, logVersion);
+ final String dst = renameReservedPathsOnUpgrade(renameOp.dst, logVersion);
+ fsDir.unprotectedRenameTo(src, dst,
renameOp.timestamp);
if (toAddRetryCache) {
@@ -460,7 +474,9 @@ public class FSEditLogLoader {
}
case OP_DELETE: {
DeleteOp deleteOp = (DeleteOp)op;
- fsDir.unprotectedDelete(deleteOp.path, deleteOp.timestamp);
+ fsDir.unprotectedDelete(
+ renameReservedPathsOnUpgrade(deleteOp.path, logVersion),
+ deleteOp.timestamp);
if (toAddRetryCache) {
fsNamesys.addCacheEntry(deleteOp.rpcClientId, deleteOp.rpcCallId);
@@ -474,8 +490,9 @@ public class FSEditLogLoader {
}
inodeId = getAndUpdateLastInodeId(mkdirOp.inodeId, logVersion,
lastInodeId);
- fsDir.unprotectedMkdir(inodeId, mkdirOp.path, mkdirOp.permissions,
- mkdirOp.aclEntries, mkdirOp.timestamp);
+ fsDir.unprotectedMkdir(inodeId,
+ renameReservedPathsOnUpgrade(mkdirOp.path, logVersion),
+ mkdirOp.permissions, mkdirOp.aclEntries, mkdirOp.timestamp);
break;
}
case OP_SET_GENSTAMP_V1: {
@@ -485,53 +502,56 @@ public class FSEditLogLoader {
}
case OP_SET_PERMISSIONS: {
SetPermissionsOp setPermissionsOp = (SetPermissionsOp)op;
- fsDir.unprotectedSetPermission(setPermissionsOp.src,
- setPermissionsOp.permissions);
+ fsDir.unprotectedSetPermission(
+ renameReservedPathsOnUpgrade(setPermissionsOp.src, logVersion),
+ setPermissionsOp.permissions);
break;
}
case OP_SET_OWNER: {
SetOwnerOp setOwnerOp = (SetOwnerOp)op;
- fsDir.unprotectedSetOwner(setOwnerOp.src, setOwnerOp.username,
- setOwnerOp.groupname);
+ fsDir.unprotectedSetOwner(
+ renameReservedPathsOnUpgrade(setOwnerOp.src, logVersion),
+ setOwnerOp.username, setOwnerOp.groupname);
break;
}
case OP_SET_NS_QUOTA: {
SetNSQuotaOp setNSQuotaOp = (SetNSQuotaOp)op;
- fsDir.unprotectedSetQuota(setNSQuotaOp.src,
- setNSQuotaOp.nsQuota,
- HdfsConstants.QUOTA_DONT_SET);
+ fsDir.unprotectedSetQuota(
+ renameReservedPathsOnUpgrade(setNSQuotaOp.src, logVersion),
+ setNSQuotaOp.nsQuota, HdfsConstants.QUOTA_DONT_SET);
break;
}
case OP_CLEAR_NS_QUOTA: {
ClearNSQuotaOp clearNSQuotaOp = (ClearNSQuotaOp)op;
- fsDir.unprotectedSetQuota(clearNSQuotaOp.src,
- HdfsConstants.QUOTA_RESET,
- HdfsConstants.QUOTA_DONT_SET);
+ fsDir.unprotectedSetQuota(
+ renameReservedPathsOnUpgrade(clearNSQuotaOp.src, logVersion),
+ HdfsConstants.QUOTA_RESET, HdfsConstants.QUOTA_DONT_SET);
break;
}
case OP_SET_QUOTA:
SetQuotaOp setQuotaOp = (SetQuotaOp)op;
- fsDir.unprotectedSetQuota(setQuotaOp.src,
- setQuotaOp.nsQuota,
- setQuotaOp.dsQuota);
+ fsDir.unprotectedSetQuota(
+ renameReservedPathsOnUpgrade(setQuotaOp.src, logVersion),
+ setQuotaOp.nsQuota, setQuotaOp.dsQuota);
break;
case OP_TIMES: {
TimesOp timesOp = (TimesOp)op;
- fsDir.unprotectedSetTimes(timesOp.path,
- timesOp.mtime,
- timesOp.atime, true);
+ fsDir.unprotectedSetTimes(
+ renameReservedPathsOnUpgrade(timesOp.path, logVersion),
+ timesOp.mtime, timesOp.atime, true);
break;
}
case OP_SYMLINK: {
SymlinkOp symlinkOp = (SymlinkOp)op;
inodeId = getAndUpdateLastInodeId(symlinkOp.inodeId, logVersion,
lastInodeId);
- fsDir.unprotectedAddSymlink(inodeId, symlinkOp.path,
- symlinkOp.value, symlinkOp.mtime,
- symlinkOp.atime, symlinkOp.permissionStatus);
+ fsDir.unprotectedAddSymlink(inodeId,
+ renameReservedPathsOnUpgrade(symlinkOp.path, logVersion),
+ symlinkOp.value, symlinkOp.mtime, symlinkOp.atime,
+ symlinkOp.permissionStatus);
if (toAddRetryCache) {
fsNamesys.addCacheEntry(symlinkOp.rpcClientId, symlinkOp.rpcCallId);
@@ -540,8 +560,10 @@ public class FSEditLogLoader {
}
case OP_RENAME: {
RenameOp renameOp = (RenameOp)op;
- fsDir.unprotectedRenameTo(renameOp.src, renameOp.dst,
- renameOp.timestamp, renameOp.options);
+ fsDir.unprotectedRenameTo(
+ renameReservedPathsOnUpgrade(renameOp.src, logVersion),
+ renameReservedPathsOnUpgrade(renameOp.dst, logVersion),
+ renameOp.timestamp, renameOp.options);
if (toAddRetryCache) {
fsNamesys.addCacheEntry(renameOp.rpcClientId, renameOp.rpcCallId);
@@ -584,10 +606,12 @@ public class FSEditLogLoader {
Lease lease = fsNamesys.leaseManager.getLease(
reassignLeaseOp.leaseHolder);
- INodeFile pendingFile = fsDir.getINode(reassignLeaseOp.path).asFile();
+ final String path =
+ renameReservedPathsOnUpgrade(reassignLeaseOp.path, logVersion);
+ INodeFile pendingFile = fsDir.getINode(path).asFile();
Preconditions.checkState(pendingFile.isUnderConstruction());
fsNamesys.reassignLeaseInternal(lease,
- reassignLeaseOp.path, reassignLeaseOp.newHolder, pendingFile);
+ path, reassignLeaseOp.newHolder, pendingFile);
break;
}
case OP_START_LOG_SEGMENT:
@@ -597,8 +621,11 @@ public class FSEditLogLoader {
}
case OP_CREATE_SNAPSHOT: {
CreateSnapshotOp createSnapshotOp = (CreateSnapshotOp) op;
+ final String snapshotRoot =
+ renameReservedPathsOnUpgrade(createSnapshotOp.snapshotRoot,
+ logVersion);
String path = fsNamesys.getSnapshotManager().createSnapshot(
- createSnapshotOp.snapshotRoot, createSnapshotOp.snapshotName);
+ snapshotRoot, createSnapshotOp.snapshotName);
if (toAddRetryCache) {
fsNamesys.addCacheEntryWithPayload(createSnapshotOp.rpcClientId,
createSnapshotOp.rpcCallId, path);
@@ -609,8 +636,11 @@ public class FSEditLogLoader {
DeleteSnapshotOp deleteSnapshotOp = (DeleteSnapshotOp) op;
BlocksMapUpdateInfo collectedBlocks = new BlocksMapUpdateInfo();
List<INode> removedINodes = new ChunkedArrayList<INode>();
+ final String snapshotRoot =
+ renameReservedPathsOnUpgrade(deleteSnapshotOp.snapshotRoot,
+ logVersion);
fsNamesys.getSnapshotManager().deleteSnapshot(
- deleteSnapshotOp.snapshotRoot, deleteSnapshotOp.snapshotName,
+ snapshotRoot, deleteSnapshotOp.snapshotName,
collectedBlocks, removedINodes);
fsNamesys.removeBlocksAndUpdateSafemodeTotal(collectedBlocks);
collectedBlocks.clear();
@@ -625,8 +655,11 @@ public class FSEditLogLoader {
}
case OP_RENAME_SNAPSHOT: {
RenameSnapshotOp renameSnapshotOp = (RenameSnapshotOp) op;
+ final String snapshotRoot =
+ renameReservedPathsOnUpgrade(renameSnapshotOp.snapshotRoot,
+ logVersion);
fsNamesys.getSnapshotManager().renameSnapshot(
- renameSnapshotOp.snapshotRoot, renameSnapshotOp.snapshotOldName,
+ snapshotRoot, renameSnapshotOp.snapshotOldName,
renameSnapshotOp.snapshotNewName);
if (toAddRetryCache) {
@@ -637,14 +670,19 @@ public class FSEditLogLoader {
}
case OP_ALLOW_SNAPSHOT: {
AllowSnapshotOp allowSnapshotOp = (AllowSnapshotOp) op;
+ final String snapshotRoot =
+ renameReservedPathsOnUpgrade(allowSnapshotOp.snapshotRoot, logVersion);
fsNamesys.getSnapshotManager().setSnapshottable(
- allowSnapshotOp.snapshotRoot, false);
+ snapshotRoot, false);
break;
}
case OP_DISALLOW_SNAPSHOT: {
DisallowSnapshotOp disallowSnapshotOp = (DisallowSnapshotOp) op;
+ final String snapshotRoot =
+ renameReservedPathsOnUpgrade(disallowSnapshotOp.snapshotRoot,
+ logVersion);
fsNamesys.getSnapshotManager().resetSnapshottable(
- disallowSnapshotOp.snapshotRoot);
+ snapshotRoot);
break;
}
case OP_SET_GENSTAMP_V2: {
Modified: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormat.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormat.java?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormat.java (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormat.java Sat Feb 8 19:05:12 2014
@@ -32,12 +32,13 @@ import java.security.DigestOutputStream;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.TreeMap;
import org.apache.commons.logging.Log;
-import org.apache.hadoop.HadoopIllegalArgumentException;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.conf.Configuration;
@@ -45,7 +46,9 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.PathIsNotDirectoryException;
import org.apache.hadoop.fs.UnresolvedLinkException;
import org.apache.hadoop.fs.permission.PermissionStatus;
+import org.apache.hadoop.hdfs.DFSUtil;
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
+import org.apache.hadoop.hdfs.protocol.LayoutFlags;
import org.apache.hadoop.hdfs.protocol.LayoutVersion;
import org.apache.hadoop.hdfs.protocol.LayoutVersion.Feature;
import org.apache.hadoop.hdfs.protocol.proto.AclProtos.AclFsImageProto;
@@ -54,6 +57,7 @@ import org.apache.hadoop.hdfs.protocol.L
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo;
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfoUnderConstruction;
import org.apache.hadoop.hdfs.server.blockmanagement.BlockManager;
+import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption;
import org.apache.hadoop.hdfs.server.common.InconsistentFSStateException;
import org.apache.hadoop.hdfs.server.namenode.snapshot.DirectoryWithSnapshotFeature;
import org.apache.hadoop.hdfs.server.namenode.snapshot.FileDiffList;
@@ -69,6 +73,10 @@ import org.apache.hadoop.hdfs.server.nam
import org.apache.hadoop.hdfs.util.ReadOnlyList;
import org.apache.hadoop.io.MD5Hash;
import org.apache.hadoop.io.Text;
+import org.apache.hadoop.util.StringUtils;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
/**
* Contains inner classes for reading or writing the on-disk format for
@@ -415,7 +423,8 @@ public class FSImageFormat {
}
/**
- * load fsimage files assuming only local names are stored
+ * load fsimage files assuming only local names are stored. Used when
+ * snapshots are not supported by the layout version.
*
* @param numFiles number of files expected to be read
* @param in image input stream
@@ -531,6 +540,8 @@ public class FSImageFormat {
*/
private int loadDirectory(DataInput in, Counter counter) throws IOException {
String parentPath = FSImageSerialization.readString(in);
+ // Rename .snapshot paths if we're doing an upgrade
+ parentPath = renameReservedPathsOnUpgrade(parentPath, getLayoutVersion());
final INodeDirectory parent = INodeDirectory.valueOf(
namesystem.dir.rootDir.getNode(parentPath, true), parentPath);
return loadChildren(parent, in, counter);
@@ -590,11 +601,9 @@ public class FSImageFormat {
*/
private void addToParent(INodeDirectory parent, INode child) {
FSDirectory fsDir = namesystem.dir;
- if (parent == fsDir.rootDir && FSDirectory.isReservedName(child)) {
- throw new HadoopIllegalArgumentException("File name \""
- + child.getLocalName() + "\" is reserved. Please "
- + " change the name of the existing file or directory to another "
- + "name before upgrading to this release.");
+ if (parent == fsDir.rootDir) {
+ child.setLocalName(renameReservedRootComponentOnUpgrade(
+ child.getLocalNameBytes(), getLayoutVersion()));
}
// NOTE: This does not update space counts for parents
if (!parent.addChild(child)) {
@@ -631,7 +640,9 @@ public class FSImageFormat {
public INode loadINodeWithLocalName(boolean isSnapshotINode,
DataInput in, boolean updateINodeMap, Counter counter)
throws IOException {
- final byte[] localName = FSImageSerialization.readLocalName(in);
+ byte[] localName = FSImageSerialization.readLocalName(in);
+ localName =
+ renameReservedComponentOnUpgrade(localName, getLayoutVersion());
INode inode = loadINode(localName, isSnapshotINode, in, counter);
if (updateINodeMap
&& LayoutVersion.supports(Feature.ADD_INODE_ID, getLayoutVersion())) {
@@ -968,7 +979,156 @@ public class FSImageFormat {
return snapshotMap.get(in.readInt());
}
}
-
+
+ @VisibleForTesting
+ public static TreeMap<String, String> renameReservedMap =
+ new TreeMap<String, String>();
+
+ /**
+ * Use the default key-value pairs that will be used to determine how to
+ * rename reserved paths on upgrade.
+ */
+ @VisibleForTesting
+ public static void useDefaultRenameReservedPairs() {
+ renameReservedMap.clear();
+ for (String key: HdfsConstants.RESERVED_PATH_COMPONENTS) {
+ renameReservedMap.put(
+ key,
+ key + "." + LayoutVersion.getCurrentLayoutVersion() + "."
+ + "UPGRADE_RENAMED");
+ }
+ }
+
+ /**
+ * Set the key-value pairs that will be used to determine how to rename
+ * reserved paths on upgrade.
+ */
+ @VisibleForTesting
+ public static void setRenameReservedPairs(String renameReserved) {
+ // Clear and set the default values
+ useDefaultRenameReservedPairs();
+ // Overwrite with provided values
+ setRenameReservedMapInternal(renameReserved);
+ }
+
+ private static void setRenameReservedMapInternal(String renameReserved) {
+ Collection<String> pairs =
+ StringUtils.getTrimmedStringCollection(renameReserved);
+ for (String p : pairs) {
+ String[] pair = StringUtils.split(p, '/', '=');
+ Preconditions.checkArgument(pair.length == 2,
+ "Could not parse key-value pair " + p);
+ String key = pair[0];
+ String value = pair[1];
+ Preconditions.checkArgument(DFSUtil.isReservedPathComponent(key),
+ "Unknown reserved path " + key);
+ Preconditions.checkArgument(DFSUtil.isValidNameForComponent(value),
+ "Invalid rename path for " + key + ": " + value);
+ LOG.info("Will rename reserved path " + key + " to " + value);
+ renameReservedMap.put(key, value);
+ }
+ }
+
+ /**
+ * When upgrading from an old version, the filesystem could contain paths
+ * that are now reserved in the new version (e.g. .snapshot). This renames
+ * these new reserved paths to a user-specified value to avoid collisions
+ * with the reserved name.
+ *
+ * @param path Old path potentially containing a reserved path
+ * @return New path with reserved path components renamed to user value
+ */
+ static String renameReservedPathsOnUpgrade(String path,
+ final int layoutVersion) {
+ final String oldPath = path;
+ // If any known LVs aren't supported, we're doing an upgrade
+ if (!LayoutVersion.supports(Feature.ADD_INODE_ID, layoutVersion)) {
+ String[] components = INode.getPathNames(path);
+ // Only need to worry about the root directory
+ if (components.length > 1) {
+ components[1] = DFSUtil.bytes2String(
+ renameReservedRootComponentOnUpgrade(
+ DFSUtil.string2Bytes(components[1]),
+ layoutVersion));
+ path = DFSUtil.strings2PathString(components);
+ }
+ }
+ if (!LayoutVersion.supports(Feature.SNAPSHOT, layoutVersion)) {
+ String[] components = INode.getPathNames(path);
+ // Special case the root path
+ if (components.length == 0) {
+ return path;
+ }
+ for (int i=0; i<components.length; i++) {
+ components[i] = DFSUtil.bytes2String(
+ renameReservedComponentOnUpgrade(
+ DFSUtil.string2Bytes(components[i]),
+ layoutVersion));
+ }
+ path = DFSUtil.strings2PathString(components);
+ }
+
+ if (!path.equals(oldPath)) {
+ LOG.info("Upgrade process renamed reserved path " + oldPath + " to "
+ + path);
+ }
+ return path;
+ }
+
+ private final static String RESERVED_ERROR_MSG =
+ FSDirectory.DOT_RESERVED_PATH_PREFIX + " is a reserved path and "
+ + HdfsConstants.DOT_SNAPSHOT_DIR + " is a reserved path component in"
+ + " this version of HDFS. Please rollback and delete or rename"
+ + " this path, or upgrade with the "
+ + StartupOption.RENAMERESERVED.getName()
+ + " [key-value pairs]"
+ + " option to automatically rename these paths during upgrade.";
+
+ /**
+ * Same as {@link #renameReservedPathsOnUpgrade(String)}, but for a single
+ * byte array path component.
+ */
+ private static byte[] renameReservedComponentOnUpgrade(byte[] component,
+ final int layoutVersion) {
+ // If the LV doesn't support snapshots, we're doing an upgrade
+ if (!LayoutVersion.supports(Feature.SNAPSHOT, layoutVersion)) {
+ if (Arrays.equals(component, HdfsConstants.DOT_SNAPSHOT_DIR_BYTES)) {
+ Preconditions.checkArgument(
+ renameReservedMap != null &&
+ renameReservedMap.containsKey(HdfsConstants.DOT_SNAPSHOT_DIR),
+ RESERVED_ERROR_MSG);
+ component =
+ DFSUtil.string2Bytes(renameReservedMap
+ .get(HdfsConstants.DOT_SNAPSHOT_DIR));
+ }
+ }
+ return component;
+ }
+
+ /**
+ * Same as {@link #renameReservedPathsOnUpgrade(String)}, but for a single
+ * byte array path component.
+ */
+ private static byte[] renameReservedRootComponentOnUpgrade(byte[] component,
+ final int layoutVersion) {
+ // If the LV doesn't support inode IDs, we're doing an upgrade
+ if (!LayoutVersion.supports(Feature.ADD_INODE_ID, layoutVersion)) {
+ if (Arrays.equals(component, FSDirectory.DOT_RESERVED)) {
+ Preconditions.checkArgument(
+ renameReservedMap != null &&
+ renameReservedMap.containsKey(FSDirectory.DOT_RESERVED_STRING),
+ RESERVED_ERROR_MSG);
+ final String renameString = renameReservedMap
+ .get(FSDirectory.DOT_RESERVED_STRING);
+ component =
+ DFSUtil.string2Bytes(renameString);
+ LOG.info("Renamed root path " + FSDirectory.DOT_RESERVED_STRING
+ + " to " + renameString);
+ }
+ }
+ return component;
+ }
+
/**
* A one-shot class responsible for writing an image file.
* The write() function should be called once, after which the getter
Modified: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java Sat Feb 8 19:05:12 2014
@@ -1166,7 +1166,8 @@ public class FSNamesystem implements Nam
if (isInSafeMode()) {
SafeModeException se = new SafeModeException(errorMsg, safeMode);
if (haEnabled && haContext != null
- && haContext.getState().getServiceState() == HAServiceState.ACTIVE) {
+ && haContext.getState().getServiceState() == HAServiceState.ACTIVE
+ && shouldRetrySafeMode(this.safeMode)) {
throw new RetriableException(se);
} else {
throw se;
@@ -1174,6 +1175,18 @@ public class FSNamesystem implements Nam
}
}
+ /**
+ * We already know that the safemode is on. We will throw a RetriableException
+ * if the safemode is not manual or caused by low resource.
+ */
+ private boolean shouldRetrySafeMode(SafeModeInfo safeMode) {
+ if (safeMode == null) {
+ return false;
+ } else {
+ return !safeMode.isManual() && !safeMode.areResourcesLow();
+ }
+ }
+
public static Collection<URI> getNamespaceDirs(Configuration conf) {
return getStorageDirs(conf, DFS_NAMENODE_NAME_DIR_KEY);
}
Modified: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java Sat Feb 8 19:05:12 2014
@@ -212,7 +212,9 @@ public class NameNode implements NameNod
+ StartupOption.CLUSTERID.getName() + " cid ] ["
+ StartupOption.FORCE.getName() + "] ["
+ StartupOption.NONINTERACTIVE.getName() + "] ] | ["
- + StartupOption.UPGRADE.getName() + "] | ["
+ + StartupOption.UPGRADE.getName() +
+ " [" + StartupOption.CLUSTERID.getName() + " cid]" +
+ " [" + StartupOption.RENAMERESERVED.getName() + "<k-v pairs>] ] | ["
+ StartupOption.ROLLBACK.getName() + "] | ["
+ StartupOption.FINALIZE.getName() + "] | ["
+ StartupOption.IMPORT.getName() + "] | ["
@@ -1056,7 +1058,8 @@ public class NameNode implements NameNod
out.println(USAGE + "\n");
}
- private static StartupOption parseArguments(String args[]) {
+ @VisibleForTesting
+ static StartupOption parseArguments(String args[]) {
int argsLen = (args == null) ? 0 : args.length;
StartupOption startOpt = StartupOption.REGULAR;
for(int i=0; i < argsLen; i++) {
@@ -1103,11 +1106,33 @@ public class NameNode implements NameNod
startOpt = StartupOption.CHECKPOINT;
} else if (StartupOption.UPGRADE.getName().equalsIgnoreCase(cmd)) {
startOpt = StartupOption.UPGRADE;
- // might be followed by two args
- if (i + 2 < argsLen
- && args[i + 1].equalsIgnoreCase(StartupOption.CLUSTERID.getName())) {
- i += 2;
- startOpt.setClusterId(args[i]);
+ /* Can be followed by CLUSTERID with a required parameter or
+ * RENAMERESERVED with an optional parameter
+ */
+ while (i + 1 < argsLen) {
+ String flag = args[i + 1];
+ if (flag.equalsIgnoreCase(StartupOption.CLUSTERID.getName())) {
+ if (i + 2 < argsLen) {
+ i += 2;
+ startOpt.setClusterId(args[i]);
+ } else {
+ LOG.fatal("Must specify a valid cluster ID after the "
+ + StartupOption.CLUSTERID.getName() + " flag");
+ return null;
+ }
+ } else if (flag.equalsIgnoreCase(StartupOption.RENAMERESERVED
+ .getName())) {
+ if (i + 2 < argsLen) {
+ FSImageFormat.setRenameReservedPairs(args[i + 2]);
+ i += 2;
+ } else {
+ FSImageFormat.useDefaultRenameReservedPairs();
+ i += 1;
+ }
+ } else {
+ LOG.fatal("Unknown upgrade flag " + flag);
+ return null;
+ }
}
} else if (StartupOption.ROLLBACK.getName().equalsIgnoreCase(cmd)) {
startOpt = StartupOption.ROLLBACK;
Modified: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/CacheAdmin.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/CacheAdmin.java?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/CacheAdmin.java (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/CacheAdmin.java Sat Feb 8 19:05:12 2014
@@ -140,6 +140,18 @@ public class CacheAdmin extends Configur
return maxTtl;
}
+ private static Long parseLimitString(String limitString) {
+ Long limit = null;
+ if (limitString != null) {
+ if (limitString.equalsIgnoreCase("unlimited")) {
+ limit = CachePoolInfo.LIMIT_UNLIMITED;
+ } else {
+ limit = Long.parseLong(limitString);
+ }
+ }
+ return limit;
+ }
+
private static Expiration parseExpirationString(String ttlString)
throws IOException {
Expiration ex = null;
@@ -650,8 +662,8 @@ public class CacheAdmin extends Configur
info.setMode(new FsPermission(mode));
}
String limitString = StringUtils.popOptionWithArgument("-limit", args);
- if (limitString != null) {
- long limit = Long.parseLong(limitString);
+ Long limit = parseLimitString(limitString);
+ if (limit != null) {
info.setLimit(limit);
}
String maxTtlString = StringUtils.popOptionWithArgument("-maxTtl", args);
@@ -726,8 +738,7 @@ public class CacheAdmin extends Configur
Integer mode = (modeString == null) ?
null : Integer.parseInt(modeString, 8);
String limitString = StringUtils.popOptionWithArgument("-limit", args);
- Long limit = (limitString == null) ?
- null : Long.parseLong(limitString);
+ Long limit = parseLimitString(limitString);
String maxTtlString = StringUtils.popOptionWithArgument("-maxTtl", args);
Long maxTtl = null;
try {
@@ -962,9 +973,8 @@ public class CacheAdmin extends Configur
if (numResults > 0) {
System.out.print(listing);
}
- // If there are no results, we return 1 (failure exit code);
- // otherwise we return 0 (success exit code).
- return (numResults == 0) ? 1 : 0;
+ // If list pools succeed, we return 0 (success exit code)
+ return 0;
}
}
Modified: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java Sat Feb 8 19:05:12 2014
@@ -191,6 +191,9 @@ public class WebHdfsFileSystem extends F
int maxFailoverAttempts = conf.getInt(
DFSConfigKeys.DFS_HTTP_CLIENT_FAILOVER_MAX_ATTEMPTS_KEY,
DFSConfigKeys.DFS_HTTP_CLIENT_FAILOVER_MAX_ATTEMPTS_DEFAULT);
+ int maxRetryAttempts = conf.getInt(
+ DFSConfigKeys.DFS_HTTP_CLIENT_RETRY_MAX_ATTEMPTS_KEY,
+ DFSConfigKeys.DFS_HTTP_CLIENT_RETRY_MAX_ATTEMPTS_DEFAULT);
int failoverSleepBaseMillis = conf.getInt(
DFSConfigKeys.DFS_HTTP_CLIENT_FAILOVER_SLEEPTIME_BASE_KEY,
DFSConfigKeys.DFS_HTTP_CLIENT_FAILOVER_SLEEPTIME_BASE_DEFAULT);
@@ -200,7 +203,7 @@ public class WebHdfsFileSystem extends F
this.retryPolicy = RetryPolicies
.failoverOnNetworkException(RetryPolicies.TRY_ONCE_THEN_FAIL,
- maxFailoverAttempts, failoverSleepBaseMillis,
+ maxFailoverAttempts, maxRetryAttempts, failoverSleepBaseMillis,
failoverSleepMaxMillis);
}
Propchange: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/native/
------------------------------------------------------------------------------
Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native:r1563326-1566041
Propchange: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/
------------------------------------------------------------------------------
Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode:r1563326-1566041
Propchange: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/
------------------------------------------------------------------------------
Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs:r1563326-1566041
Propchange: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/secondary/
------------------------------------------------------------------------------
Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/secondary:r1563326-1566041
Modified: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/site/apt/HdfsUserGuide.apt.vm
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/site/apt/HdfsUserGuide.apt.vm?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/site/apt/HdfsUserGuide.apt.vm (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/site/apt/HdfsUserGuide.apt.vm Sat Feb 8 19:05:12 2014
@@ -435,7 +435,7 @@ HDFS Users Guide
state it was in before the upgrade. HDFS upgrade is described in more
detail in {{{http://wiki.apache.org/hadoop/Hadoop_Upgrade}Hadoop Upgrade}}
Wiki page. HDFS can have one such backup at a time. Before upgrading,
- administrators need to remove existing backupusing bin/hadoop dfsadmin
+ administrators need to remove existing backup using bin/hadoop dfsadmin
<<<-finalizeUpgrade>>> command. The following briefly describes the
typical upgrade procedure:
@@ -459,6 +459,33 @@ HDFS Users Guide
* start the cluster with rollback option. (<<<bin/start-dfs.sh -rollback>>>).
+ When upgrading to a new version of HDFS, it is necessary to rename or
+ delete any paths that are reserved in the new version of HDFS. If the
+ NameNode encounters a reserved path during upgrade, it will print an
+ error like the following:
+
+ <<< /.reserved is a reserved path and .snapshot is a
+ reserved path component in this version of HDFS. Please rollback and delete
+ or rename this path, or upgrade with the -renameReserved [key-value pairs]
+ option to automatically rename these paths during upgrade.>>>
+
+ Specifying <<<-upgrade -renameReserved [optional key-value pairs]>>> causes
+ the NameNode to automatically rename any reserved paths found during
+ startup. For example, to rename all paths named <<<.snapshot>>> to
+ <<<.my-snapshot>>> and <<<.reserved>>> to <<<.my-reserved>>>, a user would
+ specify <<<-upgrade -renameReserved
+ .snapshot=.my-snapshot,.reserved=.my-reserved>>>.
+
+ If no key-value pairs are specified with <<<-renameReserved>>>, the
+ NameNode will then suffix reserved paths with
+ <<<.<LAYOUT-VERSION>.UPGRADE_RENAMED>>>, e.g.
+ <<<.snapshot.-51.UPGRADE_RENAMED>>>.
+
+ There are some caveats to this renaming process. It's recommended,
+ if possible, to first <<<hdfs dfsadmin -saveNamespace>>> before upgrading.
+ This is because data inconsistency can result if an edit log operation
+ refers to the destination of an automatically renamed file.
+
* File Permissions and Security
The file permissions are designed to be similar to file permissions on
Modified: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/site/xdoc/HdfsSnapshots.xml
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/site/xdoc/HdfsSnapshots.xml?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/site/xdoc/HdfsSnapshots.xml (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/site/xdoc/HdfsSnapshots.xml Sat Feb 8 19:05:12 2014
@@ -20,7 +20,7 @@
xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
<properties>
- <title>HFDS Snapshots</title>
+ <title>HDFS Snapshots</title>
</properties>
<body>
@@ -99,15 +99,22 @@
<li>Copying a file from snapshot <code>s0</code>:
<source>hdfs dfs -cp /foo/.snapshot/s0/bar /tmp</source></li>
</ul>
- <p>
- <b>Note</b> that the name ".snapshot" is now a reserved file name in HDFS
- so that users cannot create a file/directory with ".snapshot" as the name.
- If ".snapshot" is used in a previous version of HDFS, it must be renamed before upgrade;
- otherwise, upgrade will fail.
- </p>
</subsection>
</section>
+ <section name="Upgrading to a version of HDFS with snapshots" id="Upgrade">
+
+ <p>
+ The HDFS snapshot feature introduces a new reserved path name used to
+ interact with snapshots: <tt>.snapshot</tt>. When upgrading from an
+ older version of HDFS, existing paths named <tt>.snapshot</tt> need
+ to first be renamed or deleted to avoid conflicting with the reserved path.
+ See the upgrade section in
+ <a href="HdfsUserGuide.html#Upgrade_and_Rollback">the HDFS user guide</a>
+ for more information. </p>
+
+ </section>
+
<section name="Snapshot Operations" id="SnapshotOperations">
<subsection name="Administrator Operations" id="AdministratorOperations">
<p>
Propchange: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/test/hdfs/
------------------------------------------------------------------------------
Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/hdfs:r1563326-1566041
Modified: hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUpgradeFromImage.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUpgradeFromImage.java?rev=1566100&r1=1566099&r2=1566100&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUpgradeFromImage.java (original)
+++ hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUpgradeFromImage.java Sat Feb 8 19:05:12 2014
@@ -27,6 +27,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.TreeMap;
@@ -43,7 +44,9 @@ import org.apache.hadoop.hdfs.protocol.D
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
import org.apache.hadoop.hdfs.protocol.HdfsFileStatus;
import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption;
+import org.apache.hadoop.hdfs.server.namenode.FSImageFormat;
import org.apache.hadoop.hdfs.server.namenode.FSImageTestUtil;
+import org.apache.hadoop.test.GenericTestUtils;
import org.apache.hadoop.util.StringUtils;
import org.apache.log4j.Logger;
import org.junit.Test;
@@ -67,6 +70,7 @@ public class TestDFSUpgradeFromImage {
private static final String HADOOP_DFS_DIR_TXT = "hadoop-dfs-dir.txt";
private static final String HADOOP22_IMAGE = "hadoop-22-dfs-dir.tgz";
private static final String HADOOP1_BBW_IMAGE = "hadoop1-bbw.tgz";
+ private static final String HADOOP2_RESERVED_IMAGE = "hadoop-2-reserved.tgz";
private static class ReferenceFileInfo {
String path;
@@ -320,6 +324,87 @@ public class TestDFSUpgradeFromImage {
assertEquals("Upgrade did not fail with bad MD5", 1, md5failures);
}
}
+
+ /**
+ * Test upgrade from 2.0 image with a variety of .snapshot and .reserved
+ * paths to test renaming on upgrade
+ */
+ @Test
+ public void testUpgradeFromRel2ReservedImage() throws IOException {
+ unpackStorage(HADOOP2_RESERVED_IMAGE);
+ MiniDFSCluster cluster = null;
+ // Try it once without setting the upgrade flag to ensure it fails
+ try {
+ cluster =
+ new MiniDFSCluster.Builder(new Configuration())
+ .format(false)
+ .startupOption(StartupOption.UPGRADE)
+ .numDataNodes(0).build();
+ } catch (IllegalArgumentException e) {
+ GenericTestUtils.assertExceptionContains(
+ "reserved path component in this version",
+ e);
+ } finally {
+ if (cluster != null) {
+ cluster.shutdown();
+ }
+ }
+ // Try it again with a custom rename string
+ try {
+ FSImageFormat.setRenameReservedPairs(
+ ".snapshot=.user-snapshot," +
+ ".reserved=.my-reserved");
+ cluster =
+ new MiniDFSCluster.Builder(new Configuration())
+ .format(false)
+ .startupOption(StartupOption.UPGRADE)
+ .numDataNodes(0).build();
+ // Make sure the paths were renamed as expected
+ DistributedFileSystem dfs = cluster.getFileSystem();
+ ArrayList<Path> toList = new ArrayList<Path>();
+ ArrayList<String> found = new ArrayList<String>();
+ toList.add(new Path("/"));
+ while (!toList.isEmpty()) {
+ Path p = toList.remove(0);
+ FileStatus[] statuses = dfs.listStatus(p);
+ for (FileStatus status: statuses) {
+ final String path = status.getPath().toUri().getPath();
+ System.out.println("Found path " + path);
+ found.add(path);
+ if (status.isDirectory()) {
+ toList.add(status.getPath());
+ }
+ }
+ }
+ String[] expected = new String[] {
+ "/edits",
+ "/edits/.reserved",
+ "/edits/.user-snapshot",
+ "/edits/.user-snapshot/editsdir",
+ "/edits/.user-snapshot/editsdir/editscontents",
+ "/edits/.user-snapshot/editsdir/editsdir2",
+ "/image",
+ "/image/.reserved",
+ "/image/.user-snapshot",
+ "/image/.user-snapshot/imagedir",
+ "/image/.user-snapshot/imagedir/imagecontents",
+ "/image/.user-snapshot/imagedir/imagedir2",
+ "/.my-reserved",
+ "/.my-reserved/edits-touch",
+ "/.my-reserved/image-touch"
+ };
+
+ for (String s: expected) {
+ assertTrue("Did not find expected path " + s, found.contains(s));
+ }
+ assertEquals("Found an unexpected path while listing filesystem",
+ found.size(), expected.length);
+ } finally {
+ if (cluster != null) {
+ cluster.shutdown();
+ }
+ }
+ }
static void recoverAllLeases(DFSClient dfs,
Path path) throws IOException {