HDFS-7640. print NFS Client in the NFS log. Contributed by Brandon Li.

This commit is contained in:
Haohui Mai 2015-01-19 17:29:46 -08:00
parent 0a2d3e717d
commit 5e5e35b185
2 changed files with 36 additions and 19 deletions

View File

@ -330,8 +330,9 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
}
FileHandle handle = request.getHandle();
if (LOG.isTraceEnabled()) {
LOG.trace("GETATTR for fileId: " + handle.getFileId());
if (LOG.isDebugEnabled()) {
LOG.debug("GETATTR for fileId: " + handle.getFileId() + " client:"
+ remoteAddress);
}
Nfs3FileAttributes attrs = null;
@ -423,7 +424,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
FileHandle handle = request.getHandle();
if (LOG.isDebugEnabled()) {
LOG.debug("NFS SETATTR fileId: " + handle.getFileId());
LOG.debug("NFS SETATTR fileId: " + handle.getFileId() + " client:"
+ remoteAddress);
}
if (request.getAttr().getUpdateFields().contains(SetAttrField.SIZE)) {
@ -509,7 +511,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
String fileName = request.getName();
if (LOG.isDebugEnabled()) {
LOG.debug("NFS LOOKUP dir fileId: " + dirHandle.getFileId() + " name: "
+ fileName);
+ fileName + " client:" + remoteAddress);
}
try {
@ -577,7 +579,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
Nfs3FileAttributes attrs;
if (LOG.isDebugEnabled()) {
LOG.debug("NFS ACCESS fileId: " + handle.getFileId());
LOG.debug("NFS ACCESS fileId: " + handle.getFileId() + " client:"
+ remoteAddress);
}
try {
@ -643,7 +646,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
FileHandle handle = request.getHandle();
if (LOG.isDebugEnabled()) {
LOG.debug("NFS READLINK fileId: " + handle.getFileId());
LOG.debug("NFS READLINK fileId: " + handle.getFileId() + " client:"
+ remoteAddress);
}
String fileIdPath = Nfs3Utils.getFileIdPath(handle);
@ -722,7 +726,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
FileHandle handle = request.getHandle();
if (LOG.isDebugEnabled()) {
LOG.debug("NFS READ fileId: " + handle.getFileId() + " offset: " + offset
+ " count: " + count);
+ " count: " + count + " client:" + remoteAddress);
}
Nfs3FileAttributes attrs;
@ -863,7 +867,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
if (LOG.isDebugEnabled()) {
LOG.debug("NFS WRITE fileId: " + handle.getFileId() + " offset: "
+ offset + " length:" + count + " stableHow:" + stableHow.getValue()
+ " xid:" + xid);
+ " xid:" + xid + " client:" + remoteAddress);
}
Nfs3FileAttributes preOpAttr = null;
@ -936,7 +940,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
String fileName = request.getName();
if (LOG.isDebugEnabled()) {
LOG.debug("NFS CREATE dir fileId: " + dirHandle.getFileId()
+ " filename: " + fileName);
+ " filename: " + fileName + " client:" + remoteAddress);
}
int createMode = request.getMode();
@ -1067,6 +1071,10 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
}
FileHandle dirHandle = request.getHandle();
String fileName = request.getName();
if (LOG.isDebugEnabled()) {
LOG.debug("NFS MKDIR dirId: " + dirHandle.getFileId() + " filename: "
+ fileName + " client:" + remoteAddress);
}
if (request.getObjAttr().getUpdateFields().contains(SetAttrField.SIZE)) {
LOG.error("Setting file size is not supported when mkdir: " + fileName
@ -1165,7 +1173,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
String fileName = request.getName();
if (LOG.isDebugEnabled()) {
LOG.debug("NFS REMOVE dir fileId: " + dirHandle.getFileId()
+ " fileName: " + fileName);
+ " fileName: " + fileName + " client:" + remoteAddress);
}
String dirFileIdPath = Nfs3Utils.getFileIdPath(dirHandle);
@ -1246,7 +1254,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
if (LOG.isDebugEnabled()) {
LOG.debug("NFS RMDIR dir fileId: " + dirHandle.getFileId()
+ " fileName: " + fileName);
+ " fileName: " + fileName + " client:" + remoteAddress);
}
String dirFileIdPath = Nfs3Utils.getFileIdPath(dirHandle);
@ -1333,7 +1341,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
String toName = request.getToName();
if (LOG.isDebugEnabled()) {
LOG.debug("NFS RENAME from: " + fromHandle.getFileId() + "/" + fromName
+ " to: " + toHandle.getFileId() + "/" + toName);
+ " to: " + toHandle.getFileId() + "/" + toName + " client:"
+ remoteAddress);
}
String fromDirFileIdPath = Nfs3Utils.getFileIdPath(fromHandle);
@ -1431,7 +1440,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
// Don't do any name check to source path, just leave it to HDFS
String linkIdPath = linkDirIdPath + "/" + name;
if (LOG.isDebugEnabled()) {
LOG.debug("NFS SYMLINK, target: " + symData + " link: " + linkIdPath);
LOG.debug("NFS SYMLINK, target: " + symData + " link: " + linkIdPath
+ " client:" + remoteAddress);
}
try {
@ -1530,7 +1540,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
if (LOG.isDebugEnabled()) {
LOG.debug("NFS READDIR fileId: " + handle.getFileId() + " cookie: "
+ cookie + " count: " + count);
+ cookie + " count: " + count + " client:" + remoteAddress);
}
HdfsFileStatus dirStatus;
@ -1693,7 +1703,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
if (LOG.isDebugEnabled()) {
LOG.debug("NFS READDIRPLUS fileId: " + handle.getFileId() + " cookie: "
+ cookie + " dirCount: " + dirCount + " maxCount: " + maxCount);
+ cookie + " dirCount: " + dirCount + " maxCount: " + maxCount
+ " client:" + remoteAddress);
}
HdfsFileStatus dirStatus;
@ -1852,7 +1863,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
FileHandle handle = request.getHandle();
if (LOG.isDebugEnabled()) {
LOG.debug("NFS FSSTAT fileId: " + handle.getFileId());
LOG.debug("NFS FSSTAT fileId: " + handle.getFileId() + " client:"
+ remoteAddress);
}
try {
@ -1926,7 +1938,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
FileHandle handle = request.getHandle();
if (LOG.isDebugEnabled()) {
LOG.debug("NFS FSINFO fileId: " + handle.getFileId());
LOG.debug("NFS FSINFO fileId: " + handle.getFileId() + " client:"
+ remoteAddress);
}
try {
@ -1992,7 +2005,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
Nfs3FileAttributes attrs;
if (LOG.isDebugEnabled()) {
LOG.debug("NFS PATHCONF fileId: " + handle.getFileId());
LOG.debug("NFS PATHCONF fileId: " + handle.getFileId() + " client:"
+ remoteAddress);
}
try {
@ -2043,7 +2057,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
FileHandle handle = request.getHandle();
if (LOG.isDebugEnabled()) {
LOG.debug("NFS COMMIT fileId: " + handle.getFileId() + " offset="
+ request.getOffset() + " count=" + request.getCount());
+ request.getOffset() + " count=" + request.getCount() + " client:"
+ remoteAddress);
}
String fileIdPath = Nfs3Utils.getFileIdPath(handle);

View File

@ -529,6 +529,8 @@ Release 2.7.0 - UNRELEASED
HDFS-7573. Consolidate the implementation of delete() into a single class.
(wheat9)
HDFS-7640. Print NFS Client in the NFS log. (Brandon Li via wheat9)
OPTIMIZATIONS
HDFS-7454. Reduce memory footprint for AclEntries in NameNode.