From a445b82baaa58dcaaa3831e724a9915e9dde57c5 Mon Sep 17 00:00:00 2001 From: Andrew Wang Date: Fri, 26 Aug 2016 15:39:18 -0700 Subject: [PATCH] HDFS-10793. Fix HdfsAuditLogger binary incompatibility introduced by HDFS-9184. Contributed by Manoj Govindassamy. --- .../hdfs/server/namenode/FSNamesystem.java | 10 ++++++++ .../hdfs/server/namenode/HdfsAuditLogger.java | 23 +++++++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java index 05fd709cfb7..52fbaa7c7f5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java @@ -7010,6 +7010,16 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, logAuditMessage(sb.toString()); } } + + @Override + public void logAuditEvent(boolean succeeded, String userName, + InetAddress addr, String cmd, String src, String dst, + FileStatus status, UserGroupInformation ugi, + DelegationTokenSecretManager dtSecretManager) { + this.logAuditEvent(succeeded, userName, addr, cmd, src, dst, status, + null /*CallerContext*/, ugi, dtSecretManager); + } + public void logAuditMessage(String message) { auditLog.info(message); } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/HdfsAuditLogger.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/HdfsAuditLogger.java index 3e95ce1ece6..894c4df1945 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/HdfsAuditLogger.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/HdfsAuditLogger.java @@ -43,9 +43,9 @@ public abstract class HdfsAuditLogger implements AuditLogger { /** * Same as - * {@link #logAuditEvent(boolean, String, InetAddress, String, String, String, FileStatus)} - * with additional parameters related to logging delegation token tracking - * IDs. + * {@link #logAuditEvent(boolean, String, InetAddress, String, String, String, + * FileStatus)} with additional parameters related to logging delegation token + * tracking IDs. * * @param succeeded Whether authorization succeeded. * @param userName Name of the user executing the request. @@ -55,13 +55,28 @@ public abstract class HdfsAuditLogger implements AuditLogger { * @param dst Path of affected destination file (if any). * @param stat File information for operations that change the file's metadata * (permissions, owner, times, etc). + * @param callerContext Context information of the caller * @param ugi UserGroupInformation of the current user, or null if not logging * token tracking information * @param dtSecretManager The token secret manager, or null if not logging * token tracking information */ - public abstract void logAuditEvent(boolean succeeded, String userName, + public void logAuditEvent(boolean succeeded, String userName, InetAddress addr, String cmd, String src, String dst, FileStatus stat, CallerContext callerContext, UserGroupInformation ugi, + DelegationTokenSecretManager dtSecretManager) { + logAuditEvent(succeeded, userName, addr, cmd, src, dst, stat, + ugi, dtSecretManager); + } + + /** + * Same as + * {@link #logAuditEvent(boolean, String, InetAddress, String, String, + * String, FileStatus, CallerContext, UserGroupInformation, + * DelegationTokenSecretManager)} without {@link CallerContext} information. + */ + public abstract void logAuditEvent(boolean succeeded, String userName, + InetAddress addr, String cmd, String src, String dst, + FileStatus stat, UserGroupInformation ugi, DelegationTokenSecretManager dtSecretManager); }