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 2013/11/09 06:54:19 UTC
svn commit: r1540257 - in
/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs: CHANGES.txt
src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java
src/test/resources/testCacheAdminConf.xml
Author: cnauroth
Date: Sat Nov 9 05:54:19 2013
New Revision: 1540257
URL: http://svn.apache.org/r1540257
Log:
HDFS-5482. DistributedFileSystem#listPathBasedCacheDirectives must support relative paths. Contributed by Colin Patrick McCabe.
Modified:
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testCacheAdminConf.xml
Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1540257&r1=1540256&r2=1540257&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Sat Nov 9 05:54:19 2013
@@ -361,6 +361,9 @@ Trunk (Unreleased)
HDFS-5394. Fix race conditions in DN caching and uncaching (cmccabe)
+ HDFS-5482. DistributedFileSystem#listPathBasedCacheDirectives must support
+ relative paths. (Colin Patrick McCabe via cnauroth)
+
Release 2.3.0 - UNRELEASED
INCOMPATIBLE CHANGES
Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java?rev=1540257&r1=1540256&r2=1540257&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java (original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java Sat Nov 9 05:54:19 2013
@@ -1637,9 +1637,8 @@ public class DistributedFileSystem exten
}
if (filter.getPath() != null) {
filter = new PathBasedCacheDirective.Builder(filter).
- setPath(filter.getPath().
- makeQualified(getUri(), filter.getPath())).
- build();
+ setPath(new Path(getPathName(fixRelativePart(filter.getPath())))).
+ build();
}
final RemoteIterator<PathBasedCacheDirective> iter =
dfs.listPathBasedCacheDirectives(filter);
@@ -1651,8 +1650,11 @@ public class DistributedFileSystem exten
@Override
public PathBasedCacheDirective next() throws IOException {
+ // Although the paths we get back from the NameNode should always be
+ // absolute, we call makeQualified to add the scheme and authority of
+ // this DistributedFilesystem.
PathBasedCacheDirective desc = iter.next();
- Path p = desc.getPath().makeQualified(getUri(), desc.getPath());
+ Path p = desc.getPath().makeQualified(getUri(), getWorkingDirectory());
return new PathBasedCacheDirective.Builder(desc).setPath(p).build();
}
};
Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testCacheAdminConf.xml
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testCacheAdminConf.xml?rev=1540257&r1=1540256&r2=1540257&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testCacheAdminConf.xml (original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testCacheAdminConf.xml Sat Nov 9 05:54:19 2013
@@ -335,7 +335,7 @@
<cache-admin-command>-addDirective -path /bar -pool pool1</cache-admin-command>
<cache-admin-command>-addDirective -path /foo -pool pool2</cache-admin-command>
<cache-admin-command>-addDirective -path /bar -pool pool2</cache-admin-command>
- <cache-admin-command>-removeDirectives -path /foo</cache-admin-command>
+ <cache-admin-command>-removeDirectives -path ../../foo</cache-admin-command>
<cache-admin-command>-listDirectives</cache-admin-command>
</test-commands>
<cleanup-commands>