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 @@ GETATTR3Response getattr(XDR xdr, SecurityHandler securityHandler,
} }
FileHandle handle = request.getHandle(); FileHandle handle = request.getHandle();
if (LOG.isTraceEnabled()) { if (LOG.isDebugEnabled()) {
LOG.trace("GETATTR for fileId: " + handle.getFileId()); LOG.debug("GETATTR for fileId: " + handle.getFileId() + " client:"
+ remoteAddress);
} }
Nfs3FileAttributes attrs = null; Nfs3FileAttributes attrs = null;
@ -423,7 +424,8 @@ SETATTR3Response setattr(XDR xdr, SecurityHandler securityHandler,
FileHandle handle = request.getHandle(); FileHandle handle = request.getHandle();
if (LOG.isDebugEnabled()) { 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)) { if (request.getAttr().getUpdateFields().contains(SetAttrField.SIZE)) {
@ -509,7 +511,7 @@ LOOKUP3Response lookup(XDR xdr, SecurityHandler securityHandler,
String fileName = request.getName(); String fileName = request.getName();
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("NFS LOOKUP dir fileId: " + dirHandle.getFileId() + " name: " LOG.debug("NFS LOOKUP dir fileId: " + dirHandle.getFileId() + " name: "
+ fileName); + fileName + " client:" + remoteAddress);
} }
try { try {
@ -577,7 +579,8 @@ ACCESS3Response access(XDR xdr, SecurityHandler securityHandler,
Nfs3FileAttributes attrs; Nfs3FileAttributes attrs;
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("NFS ACCESS fileId: " + handle.getFileId()); LOG.debug("NFS ACCESS fileId: " + handle.getFileId() + " client:"
+ remoteAddress);
} }
try { try {
@ -643,7 +646,8 @@ READLINK3Response readlink(XDR xdr, SecurityHandler securityHandler,
FileHandle handle = request.getHandle(); FileHandle handle = request.getHandle();
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("NFS READLINK fileId: " + handle.getFileId()); LOG.debug("NFS READLINK fileId: " + handle.getFileId() + " client:"
+ remoteAddress);
} }
String fileIdPath = Nfs3Utils.getFileIdPath(handle); String fileIdPath = Nfs3Utils.getFileIdPath(handle);
@ -722,7 +726,7 @@ READ3Response read(XDR xdr, SecurityHandler securityHandler,
FileHandle handle = request.getHandle(); FileHandle handle = request.getHandle();
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("NFS READ fileId: " + handle.getFileId() + " offset: " + offset LOG.debug("NFS READ fileId: " + handle.getFileId() + " offset: " + offset
+ " count: " + count); + " count: " + count + " client:" + remoteAddress);
} }
Nfs3FileAttributes attrs; Nfs3FileAttributes attrs;
@ -863,7 +867,7 @@ WRITE3Response write(XDR xdr, Channel channel, int xid,
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("NFS WRITE fileId: " + handle.getFileId() + " offset: " LOG.debug("NFS WRITE fileId: " + handle.getFileId() + " offset: "
+ offset + " length:" + count + " stableHow:" + stableHow.getValue() + offset + " length:" + count + " stableHow:" + stableHow.getValue()
+ " xid:" + xid); + " xid:" + xid + " client:" + remoteAddress);
} }
Nfs3FileAttributes preOpAttr = null; Nfs3FileAttributes preOpAttr = null;
@ -936,7 +940,7 @@ CREATE3Response create(XDR xdr, SecurityHandler securityHandler,
String fileName = request.getName(); String fileName = request.getName();
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("NFS CREATE dir fileId: " + dirHandle.getFileId() LOG.debug("NFS CREATE dir fileId: " + dirHandle.getFileId()
+ " filename: " + fileName); + " filename: " + fileName + " client:" + remoteAddress);
} }
int createMode = request.getMode(); int createMode = request.getMode();
@ -1067,6 +1071,10 @@ MKDIR3Response mkdir(XDR xdr, SecurityHandler securityHandler,
} }
FileHandle dirHandle = request.getHandle(); FileHandle dirHandle = request.getHandle();
String fileName = request.getName(); 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)) { if (request.getObjAttr().getUpdateFields().contains(SetAttrField.SIZE)) {
LOG.error("Setting file size is not supported when mkdir: " + fileName LOG.error("Setting file size is not supported when mkdir: " + fileName
@ -1165,7 +1173,7 @@ REMOVE3Response remove(XDR xdr, SecurityHandler securityHandler,
String fileName = request.getName(); String fileName = request.getName();
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("NFS REMOVE dir fileId: " + dirHandle.getFileId() LOG.debug("NFS REMOVE dir fileId: " + dirHandle.getFileId()
+ " fileName: " + fileName); + " fileName: " + fileName + " client:" + remoteAddress);
} }
String dirFileIdPath = Nfs3Utils.getFileIdPath(dirHandle); String dirFileIdPath = Nfs3Utils.getFileIdPath(dirHandle);
@ -1246,7 +1254,7 @@ RMDIR3Response rmdir(XDR xdr, SecurityHandler securityHandler,
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("NFS RMDIR dir fileId: " + dirHandle.getFileId() LOG.debug("NFS RMDIR dir fileId: " + dirHandle.getFileId()
+ " fileName: " + fileName); + " fileName: " + fileName + " client:" + remoteAddress);
} }
String dirFileIdPath = Nfs3Utils.getFileIdPath(dirHandle); String dirFileIdPath = Nfs3Utils.getFileIdPath(dirHandle);
@ -1333,7 +1341,8 @@ RENAME3Response rename(XDR xdr, SecurityHandler securityHandler,
String toName = request.getToName(); String toName = request.getToName();
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("NFS RENAME from: " + fromHandle.getFileId() + "/" + fromName LOG.debug("NFS RENAME from: " + fromHandle.getFileId() + "/" + fromName
+ " to: " + toHandle.getFileId() + "/" + toName); + " to: " + toHandle.getFileId() + "/" + toName + " client:"
+ remoteAddress);
} }
String fromDirFileIdPath = Nfs3Utils.getFileIdPath(fromHandle); String fromDirFileIdPath = Nfs3Utils.getFileIdPath(fromHandle);
@ -1431,7 +1440,8 @@ SYMLINK3Response symlink(XDR xdr, SecurityHandler securityHandler,
// Don't do any name check to source path, just leave it to HDFS // Don't do any name check to source path, just leave it to HDFS
String linkIdPath = linkDirIdPath + "/" + name; String linkIdPath = linkDirIdPath + "/" + name;
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("NFS SYMLINK, target: " + symData + " link: " + linkIdPath); LOG.debug("NFS SYMLINK, target: " + symData + " link: " + linkIdPath
+ " client:" + remoteAddress);
} }
try { try {
@ -1530,7 +1540,7 @@ public READDIR3Response readdir(XDR xdr, SecurityHandler securityHandler,
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("NFS READDIR fileId: " + handle.getFileId() + " cookie: " LOG.debug("NFS READDIR fileId: " + handle.getFileId() + " cookie: "
+ cookie + " count: " + count); + cookie + " count: " + count + " client:" + remoteAddress);
} }
HdfsFileStatus dirStatus; HdfsFileStatus dirStatus;
@ -1693,7 +1703,8 @@ READDIRPLUS3Response readdirplus(XDR xdr, SecurityHandler securityHandler,
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("NFS READDIRPLUS fileId: " + handle.getFileId() + " cookie: " LOG.debug("NFS READDIRPLUS fileId: " + handle.getFileId() + " cookie: "
+ cookie + " dirCount: " + dirCount + " maxCount: " + maxCount); + cookie + " dirCount: " + dirCount + " maxCount: " + maxCount
+ " client:" + remoteAddress);
} }
HdfsFileStatus dirStatus; HdfsFileStatus dirStatus;
@ -1852,7 +1863,8 @@ FSSTAT3Response fsstat(XDR xdr, SecurityHandler securityHandler,
FileHandle handle = request.getHandle(); FileHandle handle = request.getHandle();
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("NFS FSSTAT fileId: " + handle.getFileId()); LOG.debug("NFS FSSTAT fileId: " + handle.getFileId() + " client:"
+ remoteAddress);
} }
try { try {
@ -1926,7 +1938,8 @@ FSINFO3Response fsinfo(XDR xdr, SecurityHandler securityHandler,
FileHandle handle = request.getHandle(); FileHandle handle = request.getHandle();
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("NFS FSINFO fileId: " + handle.getFileId()); LOG.debug("NFS FSINFO fileId: " + handle.getFileId() + " client:"
+ remoteAddress);
} }
try { try {
@ -1992,7 +2005,8 @@ PATHCONF3Response pathconf(XDR xdr, SecurityHandler securityHandler,
Nfs3FileAttributes attrs; Nfs3FileAttributes attrs;
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("NFS PATHCONF fileId: " + handle.getFileId()); LOG.debug("NFS PATHCONF fileId: " + handle.getFileId() + " client:"
+ remoteAddress);
} }
try { try {
@ -2043,7 +2057,8 @@ COMMIT3Response commit(XDR xdr, Channel channel, int xid,
FileHandle handle = request.getHandle(); FileHandle handle = request.getHandle();
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("NFS COMMIT fileId: " + handle.getFileId() + " offset=" 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); 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. HDFS-7573. Consolidate the implementation of delete() into a single class.
(wheat9) (wheat9)
HDFS-7640. Print NFS Client in the NFS log. (Brandon Li via wheat9)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-7454. Reduce memory footprint for AclEntries in NameNode. HDFS-7454. Reduce memory footprint for AclEntries in NameNode.