hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmcc...@apache.org
Subject svn commit: r1520665 - in /hadoop/common/branches/HDFS-4949/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop: fs/BatchedRemoteIterator.java fs/permission/FsPermission.java security/UserGroupInformation.java
Date Fri, 06 Sep 2013 18:52:51 GMT
Author: cmccabe
Date: Fri Sep  6 18:52:50 2013
New Revision: 1520665

URL: http://svn.apache.org/r1520665
Log:
HDFS-5163. Miscellaneous cache pool RPC fixes (Contributed by Colin Patrick McCabe)

Modified:
    hadoop/common/branches/HDFS-4949/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/BatchedRemoteIterator.java
    hadoop/common/branches/HDFS-4949/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
    hadoop/common/branches/HDFS-4949/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java

Modified: hadoop/common/branches/HDFS-4949/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/BatchedRemoteIterator.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4949/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/BatchedRemoteIterator.java?rev=1520665&r1=1520664&r2=1520665&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4949/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/BatchedRemoteIterator.java
(original)
+++ hadoop/common/branches/HDFS-4949/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/BatchedRemoteIterator.java
Fri Sep  6 18:52:50 2013
@@ -28,13 +28,16 @@ public abstract class BatchedRemoteItera
   public interface BatchedEntries<E> {
     public E get(int i);
     public int size();
+    public boolean hasMore();
   }
 
   public static class BatchedListEntries<E> implements BatchedEntries<E> {
     private final List<E> entries;
+    private final boolean hasMore;
 
-    public BatchedListEntries(List<E> entries) {
+    public BatchedListEntries(List<E> entries, boolean hasMore) {
       this.entries = entries;
+      this.hasMore = hasMore;
     }
 
     public E get(int i) {
@@ -44,16 +47,18 @@ public abstract class BatchedRemoteItera
     public int size() {
       return entries.size();
     }
+
+    public boolean hasMore() {
+      return hasMore;
+    }
   }
 
   private K prevKey;
-  private final int maxRepliesPerRequest;
   private BatchedEntries<E> entries;
   private int idx;
 
-  public BatchedRemoteIterator(K prevKey, int maxRepliesPerRequest) {
+  public BatchedRemoteIterator(K prevKey) {
     this.prevKey = prevKey;
-    this.maxRepliesPerRequest = maxRepliesPerRequest;
     this.entries = null;
     this.idx = -1;
   }
@@ -62,21 +67,14 @@ public abstract class BatchedRemoteItera
    * Perform the actual remote request.
    *
    * @param key                    The key to send.
-   * @param maxRepliesPerRequest   The maximum number of replies to allow.
    * @return                       A list of replies.
    */
-  public abstract BatchedEntries<E> makeRequest(K prevKey,
-      int maxRepliesPerRequest) throws IOException;
+  public abstract BatchedEntries<E> makeRequest(K prevKey) throws IOException;
 
   private void makeRequest() throws IOException {
     idx = 0;
     entries = null;
-    entries = makeRequest(prevKey, maxRepliesPerRequest);
-    if (entries.size() > maxRepliesPerRequest) {
-      throw new IOException("invalid number of replies returned: got " +
-          entries.size() + ", expected " + maxRepliesPerRequest +
-          " at most.");
-    }
+    entries = makeRequest(prevKey);
     if (entries.size() == 0) {
       entries = null;
     }
@@ -86,7 +84,7 @@ public abstract class BatchedRemoteItera
     if (idx == -1) {
       makeRequest();
     } else if ((entries != null) && (idx >= entries.size())) {
-      if (entries.size() < maxRepliesPerRequest) {
+      if (!entries.hasMore()) {
         // Last time, we got fewer entries than requested.
         // So we should be at the end.
         entries = null;

Modified: hadoop/common/branches/HDFS-4949/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4949/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java?rev=1520665&r1=1520664&r2=1520665&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4949/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
(original)
+++ hadoop/common/branches/HDFS-4949/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/permission/FsPermission.java
Fri Sep  6 18:52:50 2013
@@ -304,6 +304,13 @@ public class FsPermission implements Wri
   }
 
   /**
+   * Get the default permission for cache pools.
+   */
+  public static FsPermission getCachePoolDefault() {
+    return new FsPermission((short)00755);
+  }
+
+  /**
    * Create a FsPermission from a Unix symbolic permission string
    * @param unixSymbolicPermission e.g. "-rw-rw-rw-"
    */

Modified: hadoop/common/branches/HDFS-4949/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-4949/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java?rev=1520665&r1=1520664&r2=1520665&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-4949/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java
(original)
+++ hadoop/common/branches/HDFS-4949/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java
Fri Sep  6 18:52:50 2013
@@ -1253,6 +1253,14 @@ public class UserGroupInformation {
     return null;
   }
 
+  public String getPrimaryGroupName() throws IOException {
+    String[] groups = getGroupNames();
+    if (groups.length == 0) {
+      throw new IOException("There is no primary group for UGI " + this);
+    }
+    return groups[0];
+  }
+
   /**
    * Get the user's full principal name.
    * @return the user's full principal name.



Mime
View raw message