hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject svn commit: r620586 - in /hadoop/core/branches/branch-0.16: CHANGES.txt src/java/org/apache/hadoop/dfs/Balancer.java src/java/org/apache/hadoop/dfs/FSNamesystem.java src/test/org/apache/hadoop/dfs/TestGetBlocks.java
Date Mon, 11 Feb 2008 19:35:10 GMT
Author: shv
Date: Mon Feb 11 11:35:08 2008
New Revision: 620586

URL: http://svn.apache.org/viewvc?rev=620586&view=rev
Log:
HADOOP-2716. Merge -r 620431:620577 from trunk to branch-0.16.

Modified:
    hadoop/core/branches/branch-0.16/CHANGES.txt
    hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/dfs/Balancer.java
    hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/dfs/FSNamesystem.java
    hadoop/core/branches/branch-0.16/src/test/org/apache/hadoop/dfs/TestGetBlocks.java

Modified: hadoop/core/branches/branch-0.16/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.16/CHANGES.txt?rev=620586&r1=620585&r2=620586&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.16/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.16/CHANGES.txt Mon Feb 11 11:35:08 2008
@@ -19,6 +19,9 @@
     HADOOP-2780. The default socket buffer size for DataNodes is 128K.
     (dhruba)
 
+		HADOOP-2716. Superuser privileges for the Balancer.
+		(Tsz Wo (Nicholas), SZE via shv)
+
 Release 0.16.0 - 2008-02-07
 
   INCOMPATIBLE CHANGES

Modified: hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/dfs/Balancer.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/dfs/Balancer.java?rev=620586&r1=620585&r2=620586&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/dfs/Balancer.java (original)
+++ hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/dfs/Balancer.java Mon Feb
11 11:35:08 2008
@@ -60,7 +60,10 @@
 import org.apache.hadoop.io.retry.RetryProxy;
 import org.apache.hadoop.ipc.RPC;
 import org.apache.hadoop.ipc.RemoteException;
+import org.apache.hadoop.net.NetUtils;
 import org.apache.hadoop.net.NetworkTopology;
+import org.apache.hadoop.security.UnixUserGroupInformation;
+import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.util.Tool;
 import org.apache.hadoop.util.ToolRunner;
@@ -858,12 +861,21 @@
         new HashMap<String, RetryPolicy>();
     methodNameToPolicyMap.put("getBlocks", methodPolicy);
 
+    UserGroupInformation ugi;
+    try {
+      ugi = UnixUserGroupInformation.login(conf);
+    } catch (javax.security.auth.login.LoginException e) {
+      throw new IOException(StringUtils.stringifyException(e));
+    }
+
     return (NamenodeProtocol) RetryProxy.create(
         NamenodeProtocol.class,
         RPC.getProxy(NamenodeProtocol.class,
-                         NamenodeProtocol.versionID,
-                         nameNodeAddr, 
-                         conf),
+            NamenodeProtocol.versionID,
+            nameNodeAddr,
+            ugi,
+            conf,
+            NetUtils.getDefaultSocketFactory(conf)),
         methodNameToPolicyMap);
   }
   

Modified: hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/dfs/FSNamesystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/dfs/FSNamesystem.java?rev=620586&r1=620585&r2=620586&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/dfs/FSNamesystem.java (original)
+++ hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/dfs/FSNamesystem.java Mon
Feb 11 11:35:08 2008
@@ -639,6 +639,8 @@
    */
   synchronized BlocksWithLocations getBlocks(DatanodeID datanode, long size)
       throws IOException {
+    checkSuperuserPrivilege();
+
     DatanodeDescriptor node = getDatanode(datanode);
     if (node == null) {
       NameNode.stateChangeLog.warn("BLOCK* NameSystem.getBlocks: "

Modified: hadoop/core/branches/branch-0.16/src/test/org/apache/hadoop/dfs/TestGetBlocks.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.16/src/test/org/apache/hadoop/dfs/TestGetBlocks.java?rev=620586&r1=620585&r2=620586&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.16/src/test/org/apache/hadoop/dfs/TestGetBlocks.java (original)
+++ hadoop/core/branches/branch-0.16/src/test/org/apache/hadoop/dfs/TestGetBlocks.java Mon
Feb 11 11:35:08 2008
@@ -30,6 +30,7 @@
 import org.apache.hadoop.ipc.RPC;
 import org.apache.hadoop.ipc.RemoteException;
 import org.apache.hadoop.net.NetUtils;
+import org.apache.hadoop.security.UnixUserGroupInformation;
 
 import junit.framework.TestCase;
 /**
@@ -37,7 +38,7 @@
  */
 public class TestGetBlocks extends TestCase {
   /** test getBlocks */
-  public void testGetBlocks() throws IOException {
+  public void testGetBlocks() throws Exception {
     final Configuration CONF = new Configuration();
 
     final short REPLICATION_FACTOR = (short)2;
@@ -93,7 +94,9 @@
       InetSocketAddress addr = new InetSocketAddress("localhost",
           cluster.getNameNodePort());
       NamenodeProtocol namenode = (NamenodeProtocol) RPC.getProxy(
-          NamenodeProtocol.class, NamenodeProtocol.versionID, addr, CONF);
+          NamenodeProtocol.class, NamenodeProtocol.versionID, addr,
+          UnixUserGroupInformation.login(CONF), CONF,
+          NetUtils.getDefaultSocketFactory(CONF));
 
       // get blocks of size fileLen from dataNodes[0]
       BlockWithLocations[] locs;



Mime
View raw message