From cf6c8a1b4ee70dd45c2e42ac61999e61a05db035 Mon Sep 17 00:00:00 2001 From: Jing Zhao Date: Fri, 24 Apr 2015 10:23:32 -0700 Subject: [PATCH] HDFS-8176. Record from/to snapshots in audit log for snapshot diff report. Contributed by J. Andreina. --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../apache/hadoop/hdfs/server/namenode/FSNamesystem.java | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 56f8ec361e0..1cc31b25587 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -472,6 +472,9 @@ Release 2.8.0 - UNRELEASED HDFS-8052. Move WebHdfsFileSystem into hadoop-hdfs-client. (wheat9) + HDFS-8176. Record from/to snapshots in audit log for snapshot diff report. + (J. Andreina via jing9) + OPTIMIZATIONS HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than 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 4477dc46235..229c4d13504 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 @@ -7406,8 +7406,12 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, } finally { readUnlock(); } - - logAuditEvent(diffs != null, "computeSnapshotDiff", null, null, null); + String fromSnapshotRoot = (fromSnapshot == null || fromSnapshot.isEmpty()) ? + path : Snapshot.getSnapshotPath(path, fromSnapshot); + String toSnapshotRoot = (toSnapshot == null || toSnapshot.isEmpty()) ? + path : Snapshot.getSnapshotPath(path, toSnapshot); + logAuditEvent(diffs != null, "computeSnapshotDiff", fromSnapshotRoot, + toSnapshotRoot, null); return diffs; }