hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sur...@apache.org
Subject svn commit: r1404860 - in /hadoop/common/branches/HDFS-2802/hadoop-hdfs-project/hadoop-hdfs: CHANGES.HDFS-2802.txt src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
Date Fri, 02 Nov 2012 02:26:59 GMT
Author: suresh
Date: Fri Nov  2 02:26:58 2012
New Revision: 1404860

URL: http://svn.apache.org/viewvc?rev=1404860&view=rev
Log:
HDFS-4116. Add auditlog for some snapshot operations. Contributed by Jing Zhao.

Modified:
    hadoop/common/branches/HDFS-2802/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-2802.txt
    hadoop/common/branches/HDFS-2802/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java

Modified: hadoop/common/branches/HDFS-2802/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-2802.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-2802.txt?rev=1404860&r1=1404859&r2=1404860&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-2802/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-2802.txt
(original)
+++ hadoop/common/branches/HDFS-2802/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-2802.txt
Fri Nov  2 02:26:58 2012
@@ -40,3 +40,5 @@ Branch-2802 Snapshot (Unreleased)
 
   HDFS-4133. Add testcases for testing basic snapshot functionalities.
   (Jing Zhao via suresh)
+
+  HDFS-4116. Add auditlog for some snapshot operations. (Jing Zhao via suresh)

Modified: hadoop/common/branches/HDFS-2802/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java?rev=1404860&r1=1404859&r2=1404860&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-2802/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
(original)
+++ hadoop/common/branches/HDFS-2802/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
Fri Nov  2 02:26:58 2012
@@ -5519,7 +5519,8 @@ public class FSNamesystem implements Nam
     try {
       checkOperation(OperationCategory.WRITE);
       if (isInSafeMode()) {
-        throw new SafeModeException("Cannot allow snapshot for " + path, safeMode);
+        throw new SafeModeException("Cannot allow snapshot for " + path,
+            safeMode);
       }
       checkOwner(path);
 
@@ -5531,7 +5532,10 @@ public class FSNamesystem implements Nam
     }
     getEditLog().logSync();
     
-    //TODO: audit log
+    if (auditLog.isInfoEnabled() && isExternalInvocation()) {
+      logAuditEvent(UserGroupInformation.getCurrentUser(), getRemoteIp(),
+          "allowSnapshot", path, null, null);
+    }
   }
   
   // Disallow snapshot on a directory.
@@ -5539,6 +5543,11 @@ public class FSNamesystem implements Nam
   public void disallowSnapshot(String snapshotRoot)
       throws SafeModeException, IOException {
     // TODO: implement
+    
+    if (auditLog.isInfoEnabled() && isExternalInvocation()) {
+      logAuditEvent(UserGroupInformation.getCurrentUser(), getRemoteIp(),
+          "disallowSnapshot", snapshotRoot, null, null);
+    }
   }
   
   /**
@@ -5552,7 +5561,8 @@ public class FSNamesystem implements Nam
     try {
       checkOperation(OperationCategory.WRITE);
       if (isInSafeMode()) {
-        throw new SafeModeException("Cannot create snapshot for " + path, safeMode);
+        throw new SafeModeException("Cannot create snapshot for " + path,
+            safeMode);
       }
       checkOwner(path);
 
@@ -5568,6 +5578,10 @@ public class FSNamesystem implements Nam
     }
     getEditLog().logSync();
     
-    //TODO: audit log
+    if (auditLog.isInfoEnabled() && isExternalInvocation()) {
+      Path snapshotRoot = new Path(path, ".snapshot/" + snapshotName);
+      logAuditEvent(UserGroupInformation.getCurrentUser(), getRemoteIp(),
+          "createSnapshot", path, snapshotRoot.toString(), null);
+    }
   }
 }



Mime
View raw message