hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vinayakum...@apache.org
Subject [1/2] hadoop git commit: HDFS-9413. getContentSummary() on standby should throw StandbyException. (Brahma Reddy Battula via mingma)
Date Tue, 17 Nov 2015 10:45:45 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2.7 ab04c9ab5 -> 1b0f277ea
  refs/heads/branch-2.7.2 d92ff488b -> 83200450f


HDFS-9413. getContentSummary() on standby should throw StandbyException. (Brahma Reddy Battula
via mingma)

(cherry picked from commit 02653add98f34deedc27f4da2254d25e83e55b58)
(cherry picked from commit 42b55ff23e5fa30e00a6b56df92777a1899a1952)

 Conflicts:
	hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/83200450
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/83200450
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/83200450

Branch: refs/heads/branch-2.7.2
Commit: 83200450f67c1fe2b17385ade23051d83c7354bf
Parents: d92ff48
Author: Ming Ma <mingma@apache.org>
Authored: Mon Nov 16 09:32:40 2015 -0800
Committer: Vinayakumar B <vinayakumarb@apache.org>
Committed: Tue Nov 17 16:08:58 2015 +0530

----------------------------------------------------------------------
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt          |  3 +++
 .../hadoop/hdfs/server/namenode/FSNamesystem.java    |  2 ++
 .../hdfs/server/namenode/ha/TestQuotasWithHA.java    | 15 +++++++++++++++
 3 files changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/83200450/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index eb0d961..b1be2f9 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -92,6 +92,9 @@ Release 2.7.2 - 2015-11-11
     HDFS-9317. Document fsck -blockId and -storagepolicy options in branch-2.7.
     (aajisaka)
 
+    HDFS-9413. getContentSummary() on standby should throw StandbyException.
+    (Brahma Reddy Battula via mingma)
+
 Release 2.7.1 - 2015-07-06
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/83200450/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
----------------------------------------------------------------------
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 a2e35eb..df43198 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
@@ -3918,9 +3918,11 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
    *         or null if file not found
    */
   ContentSummary getContentSummary(final String src) throws IOException {
+    checkOperation(OperationCategory.READ);
     readLock();
     boolean success = true;
     try {
+      checkOperation(OperationCategory.READ);
       return FSDirStatAndListingOp.getContentSummary(dir, src);
     } catch (AccessControlException ace) {
       success = false;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/83200450/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestQuotasWithHA.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestQuotasWithHA.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestQuotasWithHA.java
index 6ceecc7..db67d95 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestQuotasWithHA.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestQuotasWithHA.java
@@ -17,6 +17,7 @@
  */
 package org.apache.hadoop.hdfs.server.namenode.ha;
 
+
 import static org.junit.Assert.assertEquals;
 
 import java.io.IOException;
@@ -34,6 +35,7 @@ import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.hadoop.hdfs.MiniDFSNNTopology;
 import org.apache.hadoop.hdfs.server.namenode.NameNode;
 import org.apache.hadoop.io.IOUtils;
+import org.apache.hadoop.ipc.StandbyException;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -130,4 +132,17 @@ public class TestQuotasWithHA {
     assertEquals(1, cs.getDirectoryCount());
     assertEquals(0, cs.getFileCount());
   }
+
+  /**
+   * Test that getContentSummary on Standby should should throw standby
+   * exception.
+   */
+  @Test(expected = StandbyException.class)
+  public void testgetContentSummaryOnStandby() throws Exception {
+    Configuration nn1conf =cluster.getConfiguration(1);
+    // just reset the standby reads to default i.e False on standby.
+    HAUtil.setAllowStandbyReads(nn1conf, false);
+    cluster.restartNameNode(1);
+    cluster.getNameNodeRpc(1).getContentSummary("/");
+  }
 }


Mime
View raw message