|
@@ -62,7 +62,6 @@ import org.apache.hadoop.hdfs.DFSConfigKeys;
|
|
|
import org.apache.hadoop.fs.ContentSummary;
|
|
|
import org.apache.hadoop.fs.CreateFlag;
|
|
|
import org.apache.hadoop.fs.FileAlreadyExistsException;
|
|
|
-import org.apache.hadoop.fs.FileStatus;
|
|
|
import org.apache.hadoop.fs.FsServerDefaults;
|
|
|
import org.apache.hadoop.fs.Path;
|
|
|
import org.apache.hadoop.fs.Options;
|
|
@@ -87,7 +86,6 @@ import java.util.Map.Entry;
|
|
|
import javax.management.NotCompliantMBeanException;
|
|
|
import javax.management.ObjectName;
|
|
|
import javax.management.StandardMBean;
|
|
|
-import javax.security.auth.login.LoginException;
|
|
|
|
|
|
/***************************************************
|
|
|
* FSNamesystem does the actual bookkeeping work for the
|
|
@@ -120,7 +118,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean, FSClusterSt
|
|
|
|
|
|
private static final void logAuditEvent(UserGroupInformation ugi,
|
|
|
InetAddress addr, String cmd, String src, String dst,
|
|
|
- FileStatus stat) {
|
|
|
+ HdfsFileStatus stat) {
|
|
|
final Formatter fmt = auditFormatter.get();
|
|
|
((StringBuilder)fmt.out()).setLength(0);
|
|
|
auditLog.info(fmt.format(AUDIT_FORMAT, ugi, addr, cmd, src, dst,
|
|
@@ -641,7 +639,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean, FSClusterSt
|
|
|
dir.setPermission(src, permission);
|
|
|
getEditLog().logSync();
|
|
|
if (auditLog.isInfoEnabled()) {
|
|
|
- final FileStatus stat = dir.getFileInfo(src);
|
|
|
+ final HdfsFileStatus stat = dir.getFileInfo(src);
|
|
|
logAuditEvent(UserGroupInformation.getCurrentUser(),
|
|
|
Server.getRemoteIp(),
|
|
|
"setPermission", src, null, stat);
|
|
@@ -669,7 +667,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean, FSClusterSt
|
|
|
dir.setOwner(src, username, group);
|
|
|
getEditLog().logSync();
|
|
|
if (auditLog.isInfoEnabled()) {
|
|
|
- final FileStatus stat = dir.getFileInfo(src);
|
|
|
+ final HdfsFileStatus stat = dir.getFileInfo(src);
|
|
|
logAuditEvent(UserGroupInformation.getCurrentUser(),
|
|
|
Server.getRemoteIp(),
|
|
|
"setOwner", src, null, stat);
|
|
@@ -728,7 +726,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean, FSClusterSt
|
|
|
) throws IOException {
|
|
|
INodeFile inode = dir.getFileINode(src);
|
|
|
if (inode == null)
|
|
|
- throw new FileNotFoundException();
|
|
|
+ throw new FileNotFoundException(src);
|
|
|
if (doAccessTime && isAccessTimeSupported()) {
|
|
|
dir.setTimes(src, inode, -1, now(), false);
|
|
|
}
|
|
@@ -906,7 +904,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean, FSClusterSt
|
|
|
|
|
|
|
|
|
if (auditLog.isInfoEnabled()) {
|
|
|
- final FileStatus stat = dir.getFileInfo(target);
|
|
|
+ final HdfsFileStatus stat = dir.getFileInfo(target);
|
|
|
logAuditEvent(UserGroupInformation.getLoginUser(),
|
|
|
Server.getRemoteIp(),
|
|
|
"concat", Arrays.toString(srcs), target, stat);
|
|
@@ -933,7 +931,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean, FSClusterSt
|
|
|
if (inode != null) {
|
|
|
dir.setTimes(src, inode, mtime, atime, true);
|
|
|
if (auditLog.isInfoEnabled()) {
|
|
|
- final FileStatus stat = dir.getFileInfo(src);
|
|
|
+ final HdfsFileStatus stat = dir.getFileInfo(src);
|
|
|
logAuditEvent(UserGroupInformation.getCurrentUser(),
|
|
|
Server.getRemoteIp(),
|
|
|
"setTimes", src, null, stat);
|
|
@@ -1046,7 +1044,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean, FSClusterSt
|
|
|
createParent, replication, blockSize);
|
|
|
getEditLog().logSync();
|
|
|
if (auditLog.isInfoEnabled()) {
|
|
|
- final FileStatus stat = dir.getFileInfo(src);
|
|
|
+ final HdfsFileStatus stat = dir.getFileInfo(src);
|
|
|
logAuditEvent(UserGroupInformation.getCurrentUser(),
|
|
|
Server.getRemoteIp(),
|
|
|
"create", src, null, stat);
|
|
@@ -1601,7 +1599,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean, FSClusterSt
|
|
|
boolean status = renameToInternal(src, dst);
|
|
|
getEditLog().logSync();
|
|
|
if (status && auditLog.isInfoEnabled()) {
|
|
|
- final FileStatus stat = dir.getFileInfo(dst);
|
|
|
+ final HdfsFileStatus stat = dir.getFileInfo(dst);
|
|
|
logAuditEvent(UserGroupInformation.getCurrentUser(),
|
|
|
Server.getRemoteIp(),
|
|
|
"rename", src, dst, stat);
|
|
@@ -1629,7 +1627,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean, FSClusterSt
|
|
|
checkAncestorAccess(actualdst, FsAction.WRITE);
|
|
|
}
|
|
|
|
|
|
- FileStatus dinfo = dir.getFileInfo(dst);
|
|
|
+ HdfsFileStatus dinfo = dir.getFileInfo(dst);
|
|
|
if (dir.renameTo(src, dst)) {
|
|
|
changeLease(src, dst, dinfo); // update lease with new filename
|
|
|
return true;
|
|
@@ -1648,7 +1646,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean, FSClusterSt
|
|
|
for (Rename option : options) {
|
|
|
cmd.append(option.value()).append(" ");
|
|
|
}
|
|
|
- final FileStatus stat = dir.getFileInfo(dst);
|
|
|
+ final HdfsFileStatus stat = dir.getFileInfo(dst);
|
|
|
logAuditEvent(UserGroupInformation.getCurrentUser(), Server.getRemoteIp(),
|
|
|
cmd.toString(), src, dst, stat);
|
|
|
}
|
|
@@ -1671,7 +1669,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean, FSClusterSt
|
|
|
checkAncestorAccess(dst, FsAction.WRITE);
|
|
|
}
|
|
|
|
|
|
- FileStatus dinfo = dir.getFileInfo(dst);
|
|
|
+ HdfsFileStatus dinfo = dir.getFileInfo(dst);
|
|
|
dir.renameTo(src, dst, options);
|
|
|
changeLease(src, dst, dinfo); // update lease with new filename
|
|
|
}
|
|
@@ -1770,7 +1768,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean, FSClusterSt
|
|
|
* @return object containing information regarding the file
|
|
|
* or null if file not found
|
|
|
*/
|
|
|
- FileStatus getFileInfo(String src) throws IOException {
|
|
|
+ HdfsFileStatus getFileInfo(String src) throws IOException {
|
|
|
if (!DFSUtil.isValidName(src)) {
|
|
|
throw new IOException("Invalid file name: " + src);
|
|
|
}
|
|
@@ -1788,7 +1786,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean, FSClusterSt
|
|
|
boolean status = mkdirsInternal(src, permissions, createParent);
|
|
|
getEditLog().logSync();
|
|
|
if (status && auditLog.isInfoEnabled()) {
|
|
|
- final FileStatus stat = dir.getFileInfo(src);
|
|
|
+ final HdfsFileStatus stat = dir.getFileInfo(src);
|
|
|
logAuditEvent(UserGroupInformation.getCurrentUser(),
|
|
|
Server.getRemoteIp(),
|
|
|
"mkdirs", src, null, stat);
|
|
@@ -2139,7 +2137,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean, FSClusterSt
|
|
|
* Get a listing of all files at 'src'. The Object[] array
|
|
|
* exists so we can return file attributes (soon to be implemented)
|
|
|
*/
|
|
|
- public FileStatus[] getListing(String src) throws IOException {
|
|
|
+ public HdfsFileStatus[] getListing(String src) throws IOException {
|
|
|
if (isPermissionEnabled) {
|
|
|
if (dir.isDir(src)) {
|
|
|
checkPathAccess(src, FsAction.READ_EXECUTE);
|
|
@@ -4186,7 +4184,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean, FSClusterSt
|
|
|
// rename was successful. If any part of the renamed subtree had
|
|
|
// files that were being written to, update with new filename.
|
|
|
//
|
|
|
- void changeLease(String src, String dst, FileStatus dinfo)
|
|
|
+ void changeLease(String src, String dst, HdfsFileStatus dinfo)
|
|
|
throws IOException {
|
|
|
String overwrite;
|
|
|
String replaceBy;
|