hadoop-hdfs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dia Kharrat <dkhar...@gmail.com>
Subject Unable to delete symlinks in HDFS via FileContext
Date Thu, 25 Apr 2013 03:05:43 GMT
Hi,

We have an HDFS setup (v2.0.0) managed by Cloudera. I'm having trouble
getting the FileStatus of a symlink or deleting it.

According to the documentation, FileContext#getFileLinkStatus() or
FileContext#delete() should operate on the symlink itself if the provided
path is a symlink.

However, what happens instead is, FileContext#getFileLinkStatus() or
delete() resolve the symlink and act on the target path. So, for example,
if "/tmp/symlink.file" points to "/tmp/target.file", doing this:

Path path = new Path("hdfs://nameservice1:8020/tmp/symlink.file");
fileContext.getFileLinkStatus(path).getPath();

returns a path of:

Path("hdfs://nameservice1:8020/tmp/target.file")

Similarly, fileContext.delete(path, true) deletes the target file
("/tmp/target.file") instead of the symlink itself. So, this behavior does
not match with the documentation.

What's interesting is, locally in pseudo-mode, the above works as expected.

Any ideas or pointers as to why FileContext#delete and
FileContext#getFileLinkStatus() are not operating correctly on the symlinks?

Thanks,
Dia

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message