Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-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 414BFF1AE for ; Thu, 4 Apr 2013 15:03:40 +0000 (UTC) Received: (qmail 63230 invoked by uid 500); 4 Apr 2013 15:03:39 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 63160 invoked by uid 500); 4 Apr 2013 15:03:39 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 63149 invoked by uid 99); 4 Apr 2013 15:03:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Apr 2013 15:03:38 +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; Thu, 04 Apr 2013 15:03:35 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 2F03523888E7; Thu, 4 Apr 2013 15:03:14 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1464586 - in /accumulo/trunk: ./ assemble/ core/ examples/ fate/src/main/java/org/apache/accumulo/fate/ fate/src/main/java/org/apache/accumulo/fate/zookeeper/ server/ server/src/main/java/org/apache/accumulo/server/master/tableOps/ server/... Date: Thu, 04 Apr 2013 15:03:13 -0000 To: commits@accumulo.apache.org From: ecn@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130404150314.2F03523888E7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ecn Date: Thu Apr 4 15:03:13 2013 New Revision: 1464586 URL: http://svn.apache.org/r1464586 Log: ACCUMULO-1238 throw a better error than permission denied when a table has just been deleted Modified: accumulo/trunk/ (props changed) accumulo/trunk/assemble/ (props changed) accumulo/trunk/core/ (props changed) accumulo/trunk/examples/ (props changed) accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java (props changed) accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java (props changed) accumulo/trunk/server/ (props changed) accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/CreateTable.java accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java accumulo/trunk/src/ (props changed) accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CloneTable.java Propchange: accumulo/trunk/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5:r1464582 Propchange: accumulo/trunk/assemble/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/assemble:r1464582 Propchange: accumulo/trunk/core/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/core:r1464582 Propchange: accumulo/trunk/examples/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/examples:r1464582 Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:r1464582 Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java:r1464582 Propchange: accumulo/trunk/server/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/server:r1464582 Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/CreateTable.java URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/CreateTable.java?rev=1464586&r1=1464585&r2=1464586&view=diff ============================================================================== --- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/CreateTable.java (original) +++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/CreateTable.java Thu Apr 4 15:03:13 2013 @@ -223,11 +223,6 @@ class SetupPermissions extends MasterRep } @Override - public long isReady(long tid, Master environment) throws Exception { - return 0; - } - - @Override public Repo call(long tid, Master env) throws Exception { // give all table permissions to the creator SecurityOperation security = AuditedSecurityOperation.getInstance(); Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java?rev=1464586&r1=1464585&r2=1464586&view=diff ============================================================================== --- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java (original) +++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java Thu Apr 4 15:03:13 2013 @@ -47,6 +47,7 @@ public class ZKPermHandler implements Pe private static PermissionHandler zkPermHandlerInstance = null; private String ZKUserPath; + private String ZKTablePath; private final ZooCache zooCache; private final String ZKUserSysPerms = "/System"; private final String ZKUserTablePerms = "/Tables"; @@ -59,6 +60,7 @@ public class ZKPermHandler implements Pe public void initialize(String instanceId, boolean initialize) { ZKUserPath = ZKSecurityTool.getInstancePath(instanceId) + "/users"; + ZKTablePath = ZKSecurityTool.getInstancePath(instanceId) + "/tables"; } public ZKPermHandler() { @@ -66,7 +68,7 @@ public class ZKPermHandler implements Pe } @Override - public boolean hasTablePermission(String user, String table, TablePermission permission) { + public boolean hasTablePermission(String user, String table, TablePermission permission) throws TableNotFoundException { byte[] serializedPerms; try { String path = ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table; @@ -74,6 +76,22 @@ public class ZKPermHandler implements Pe serializedPerms = ZooReaderWriter.getRetryingInstance().getData(path, null); } catch (KeeperException e) { if (e.code() == Code.NONODE) { + // maybe the table was just deleted? + try { + // check for existence: + ZooReaderWriter.getRetryingInstance().getData(ZKTablePath + "/" + table, null); + // it's there, you don't have permission + return false; + } catch (InterruptedException ex) { + log.warn("Unhandled InterruptedException, failing closed for table permission check", e); + return false; + } catch (KeeperException ex) { + // not there, throw an informative exception + if (e.code() == Code.NONODE) { + throw new TableNotFoundException(null, table, "while checking permissions"); + } + log.warn("Unhandled InterruptedException, failing closed for table permission check", e); + } return false; } log.warn("Unhandled KeeperException, failing closed for table permission check", e); Propchange: accumulo/trunk/src/ ------------------------------------------------------------------------------ Merged /accumulo/branches/1.5/src:r1464582 Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CloneTable.java URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CloneTable.java?rev=1464586&r1=1464585&r2=1464586&view=diff ============================================================================== --- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CloneTable.java (original) +++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CloneTable.java Thu Apr 4 15:03:13 2013 @@ -44,8 +44,8 @@ public class CloneTable extends Test { boolean flush = rand.nextBoolean(); try { + log.debug("Cloning table " + srcTableName + " " + newTableName + " " + flush); conn.tableOperations().clone(srcTableName, newTableName, flush, new HashMap(), new HashSet()); - log.debug("Cloned table " + srcTableName + " " + newTableName + " " + flush); } catch (TableExistsException e) { log.debug("Clone " + srcTableName + " failed, " + newTableName + " exist"); } catch (TableNotFoundException e) {