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 2F46910A03 for ; Wed, 4 Dec 2013 23:58:48 +0000 (UTC) Received: (qmail 47958 invoked by uid 500); 4 Dec 2013 23:58:46 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 47835 invoked by uid 500); 4 Dec 2013 23:58:46 -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 47798 invoked by uid 99); 4 Dec 2013 23:58:46 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Dec 2013 23:58:46 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 0AC1B3203A5; Wed, 4 Dec 2013 23:58:45 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ctubbsii@apache.org To: commits@accumulo.apache.org Date: Wed, 04 Dec 2013 23:59:30 -0000 Message-Id: <37954d8709004970b2745657d4e42e1c@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [49/50] [abbrv] git commit: ACCUMULO-802 fix more issues from ReviewBoard ACCUMULO-802 fix more issues from ReviewBoard Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/859cf208 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/859cf208 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/859cf208 Branch: refs/heads/master Commit: 859cf2087c2506f60178efff1e08d8ad91af3d2d Parents: 8b54ced Author: Christopher Tubbs Authored: Wed Dec 4 18:45:51 2013 -0500 Committer: Christopher Tubbs Committed: Wed Dec 4 18:47:21 2013 -0500 ---------------------------------------------------------------------- .../core/client/admin/NamespaceOperations.java | 5 ++++- .../client/admin/NamespaceOperationsImpl.java | 8 +++----- .../core/client/admin/TableOperationsImpl.java | 8 +------- .../accumulo/core/client/impl/Tables.java | 21 +++++++++++++------- .../shell/commands/CreateNamespaceCommand.java | 3 --- .../randomwalk/concurrent/RenameNamespace.java | 2 +- 6 files changed, 23 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/859cf208/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperations.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperations.java b/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperations.java index 4ee670c..535287d 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperations.java +++ b/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperations.java @@ -32,6 +32,9 @@ import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope; /** * Provides an API for administering namespaces * + * All tables exist in a namespace. The default namespace has no name, and is used if an explicit namespace is not specified. Fully qualified table names look + * like "namespaceName.tableName". Tables in the default namespace are fully qualified simply as "tableName". + * * @since 1.6.0 */ public interface NamespaceOperations { @@ -63,7 +66,7 @@ public interface NamespaceOperations { public boolean exists(String namespace) throws AccumuloException, AccumuloSecurityException; /** - * Create an empty namespace with no initial configuration + * Create an empty namespace with no initial configuration. Valid names for a namespace contain letters, numbers, and the underscore character. * * @param namespace * the name of the namespace http://git-wip-us.apache.org/repos/asf/accumulo/blob/859cf208/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperationsImpl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperationsImpl.java index 1ddcaf7..e5e18dc 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperationsImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperationsImpl.java @@ -98,9 +98,8 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper { try { doNamespaceOperation(TableOperation.CREATE, Arrays.asList(ByteBuffer.wrap(namespace.getBytes())), Collections. emptyMap()); - } catch (NamespaceNotFoundException e1) { - // should not happen - throw new RuntimeException(e1); + } catch (NamespaceNotFoundException e) { + throw new AssertionError("Shouldn't happen: " + e.getMessage()); } } @@ -235,8 +234,7 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper { try { doNamespaceOperation(TableOperation.DELETE, args, opts); } catch (NamespaceExistsException e) { - // should not happen - throw new RuntimeException(e); + throw new AssertionError("Shouldn't happen: " + e.getMessage()); } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/859cf208/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java index 7f79fcd..ef2bd09 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java @@ -1506,13 +1506,7 @@ public class TableOperationsImpl extends TableOperationsHelper { Logger.getLogger(this.getClass()).warn("Failed to check if imported table references external java classes : " + ioe.getMessage()); } - String namespace = Tables.qualify(tableName).getFirst(); - if (!namespaceExists(namespace)) { - String info = "Namespace not found while importing to table"; - throw new RuntimeException(new NamespaceNotFoundException(null, namespace, info)); - } - - List args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes()), ByteBuffer.wrap(importDir.getBytes())); + List args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes(Constants.UTF8)), ByteBuffer.wrap(importDir.getBytes())); Map opts = Collections.emptyMap(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/859cf208/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java index af8c617..45db491 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java @@ -17,6 +17,7 @@ package org.apache.accumulo.core.client.impl; import java.security.SecurityPermission; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.SortedMap; @@ -54,28 +55,34 @@ public class Tables { TreeMap tableMap = new TreeMap(); + Map namespaceIdToNameMap = new HashMap(); + for (String tableId : tableIds) { - byte[] tblPath = zc.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_NAME); + byte[] tableName = zc.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_NAME); byte[] nId = zc.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_NAMESPACE); - String name = ""; + String namespaceName = Constants.DEFAULT_NAMESPACE; // create fully qualified table name if (nId != null) { String namespaceId = new String(nId, Constants.UTF8); if (!namespaceId.equals(Constants.DEFAULT_NAMESPACE_ID)) { try { - name += Namespaces.getNamespaceName(instance, namespaceId) + "."; + namespaceName = namespaceIdToNameMap.get(namespaceId); + if (namespaceName == null) { + namespaceName = Namespaces.getNamespaceName(instance, namespaceId); + namespaceIdToNameMap.put(namespaceId, namespaceName); + } } catch (NamespaceNotFoundException e) { log.error("Table (" + tableId + ") contains reference to namespace (" + namespaceId + ") that doesn't exist"); continue; } } } - if (tblPath != null) { - name += new String(tblPath, Constants.UTF8); + if (tableName != null) { + String tableNameStr = qualified(new String(tableName, Constants.UTF8), namespaceName); if (nameAsKey) - tableMap.put(name, tableId); + tableMap.put(tableNameStr, tableId); else - tableMap.put(tableId, name); + tableMap.put(tableId, tableNameStr); } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/859cf208/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateNamespaceCommand.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateNamespaceCommand.java b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateNamespaceCommand.java index 908a9cc..d59f2ef 100644 --- a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateNamespaceCommand.java +++ b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateNamespaceCommand.java @@ -35,7 +35,6 @@ import org.apache.commons.cli.Options; public class CreateNamespaceCommand extends Command { private Option createTableOptCopyConfig, createNamespaceOptCopyConfig; - private Option base64Opt; @Override public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws AccumuloException, AccumuloSecurityException, @@ -93,8 +92,6 @@ public class CreateNamespaceCommand extends Command { createTableOptCopyConfig = new Option("ctc", "copy-table-config", true, "table to copy configuration from"); createTableOptCopyConfig.setArgName("tableName"); - base64Opt = new Option("b64", "base64encoded", false, "decode encoded split points"); - o.addOption(base64Opt); OptionGroup ogp = new OptionGroup(); ogp.addOption(createTableOptCopyConfig); ogp.addOption(createNamespaceOptCopyConfig); http://git-wip-us.apache.org/repos/asf/accumulo/blob/859cf208/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/RenameNamespace.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/RenameNamespace.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/RenameNamespace.java index bf22ad6..5aa21ed 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/RenameNamespace.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/RenameNamespace.java @@ -46,7 +46,7 @@ public class RenameNamespace extends Test { } catch (NamespaceExistsException e) { log.debug("Rename namespace " + srcName + " failed, " + newName + " exists"); } catch (NamespaceNotFoundException e) { - log.debug("Rename namespace " + srcName + " failed, doesnt exist"); + log.debug("Rename namespace " + srcName + " failed, doesn't exist"); } } }