Return-Path: X-Original-To: apmail-hadoop-common-commits-archive@www.apache.org Delivered-To: apmail-hadoop-common-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CD2F710EC9 for ; Fri, 6 Sep 2013 18:53:14 +0000 (UTC) Received: (qmail 18431 invoked by uid 500); 6 Sep 2013 18:53:13 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 18384 invoked by uid 500); 6 Sep 2013 18:53:13 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 18368 invoked by uid 99); 6 Sep 2013 18:53:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Sep 2013 18:53:12 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Sep 2013 18:53:11 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 5E3A42388994; Fri, 6 Sep 2013 18:52:51 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: common-commits@hadoop.apache.org From: cmccabe@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130906185251.5E3A42388994@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 { public E get(int i); public int size(); + public boolean hasMore(); } public static class BatchedListEntries implements BatchedEntries { private final List entries; + private final boolean hasMore; - public BatchedListEntries(List entries) { + public BatchedListEntries(List 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 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 makeRequest(K prevKey, - int maxRepliesPerRequest) throws IOException; + public abstract BatchedEntries 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.