You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2013/12/05 00:58:38 UTC
[46/50] [abbrv] git commit: ACCUMULO-1906 Remove ops on tables in a
namespace
ACCUMULO-1906 Remove ops on tables in a namespace
Removing operations on tables in a namespace where the same operation
can be easily accomplished with a short sequence of API calls on
existing methods. Also, clean up Javadocs.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/3c920943
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/3c920943
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/3c920943
Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 3c920943bf92e2c15a5eeb4945165b3573003f33
Parents: ea8ec19
Author: Christopher Tubbs <ct...@apache.org>
Authored: Mon Nov 18 16:45:14 2013 -0500
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Wed Dec 4 18:46:11 2013 -0500
----------------------------------------------------------------------
.../core/client/admin/NamespaceOperations.java | 268 ++++++++-----------
.../client/admin/NamespaceOperationsHelper.java | 6 +-
.../client/admin/NamespaceOperationsImpl.java | 250 +----------------
.../core/client/admin/TableOperations.java | 107 ++++----
.../accumulo/core/client/impl/Tables.java | 48 ++--
.../client/mock/MockNamespaceOperations.java | 74 +----
.../shell/commands/DeleteNamespaceCommand.java | 11 +-
.../core/util/shell/commands/OptUtil.java | 5 +-
.../core/client/mock/MockNamespacesTest.java | 4 +-
.../server/security/SecurityOperation.java | 5 -
.../randomwalk/concurrent/DeleteNamespace.java | 2 +-
.../randomwalk/concurrent/OfflineNamespace.java | 53 ----
.../org/apache/accumulo/test/NamespacesIT.java | 7 +-
.../org/apache/accumulo/test/ShellServerIT.java | 49 ++--
.../accumulo/test/functional/RestartIT.java | 18 +-
15 files changed, 257 insertions(+), 650 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/3c920943/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 c82b42e..4ee670c 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
@@ -17,7 +17,6 @@
package org.apache.accumulo.core.client.admin;
import java.util.EnumSet;
-import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.SortedSet;
@@ -28,78 +27,43 @@ import org.apache.accumulo.core.client.IteratorSetting;
import org.apache.accumulo.core.client.NamespaceExistsException;
import org.apache.accumulo.core.client.NamespaceNotEmptyException;
import org.apache.accumulo.core.client.NamespaceNotFoundException;
-import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
/**
- * Provides a class for administering namespaces
+ * Provides an API for administering namespaces
*
+ * @since 1.6.0
*/
-
public interface NamespaceOperations {
/**
* Retrieve a list of namespaces in Accumulo.
*
* @return List of namespaces in accumulo
- */
- public SortedSet<String> list();
-
- /**
- * A method to check if a namespace exists in Accumulo.
- *
- * @param namespace
- * the name of the namespace
- * @return true if the namespace exists
- */
- public boolean exists(String namespace);
-
- /**
- * Create a namespace with no special configuration
- *
- * @param namespace
- * the name of the namespace
* @throws AccumuloException
* if a general error occurs
* @throws AccumuloSecurityException
* if the user does not have permission
- * @throws NamespaceExistsException
- * if the namespace already exists
- */
- public void create(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceExistsException;
-
- /**
- * @param namespace
- * the name of the namespace
- * @param limitVersion
- * Enables/disables the versioning iterator, which will limit the number of Key versions kept.
- * @throws AccumuloException
- * if a general error occurs
- * @throws AccumuloSecurityException
- * if the user does not have permission
- * @throws NamespaceExistsException
- * if the namespace already exists
+ * @since 1.6.0
*/
- public void create(String namespace, boolean limitVersion) throws AccumuloException, AccumuloSecurityException, NamespaceExistsException;
+ public SortedSet<String> list() throws AccumuloException, AccumuloSecurityException;
/**
+ * A method to check if a namespace exists in Accumulo.
+ *
* @param namespace
* the name of the namespace
- * @param versioningIter
- * Enables/disables the versioning iterator, which will limit the number of Key versions kept.
- * @param timeType
- * specifies logical or real-time based time recording for entries in the table
+ * @return true if the namespace exists
* @throws AccumuloException
* if a general error occurs
* @throws AccumuloSecurityException
* if the user does not have permission
- * @throws NamespaceExistsException
- * if the namespace already exists
+ * @since 1.6.0
*/
- public void create(String namespace, boolean versioningIter, TimeType timeType) throws AccumuloException, AccumuloSecurityException, NamespaceExistsException;
+ public boolean exists(String namespace) throws AccumuloException, AccumuloSecurityException;
/**
- * Delete a namespace if it is empty
+ * Create an empty namespace with no initial configuration
*
* @param namespace
* the name of the namespace
@@ -107,36 +71,28 @@ public interface NamespaceOperations {
* if a general error occurs
* @throws AccumuloSecurityException
* if the user does not have permission
- * @throws NamespaceNotFoundException
- * if the namespace does not exist
- * @throws NamespaceNotEmptyException
- * if the namespaces still contains tables
- * @throws TableNotFoundException
- * if table not found while deleting
+ * @throws NamespaceExistsException
+ * if the specified namespace already exists
+ * @since 1.6.0
*/
- public void delete(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException, NamespaceNotEmptyException,
- TableNotFoundException;
+ public void create(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceExistsException;
/**
- * Delete a namespace
+ * Delete an empty namespace
*
* @param namespace
* the name of the namespace
- * @param deleteTables
- * boolean, if true deletes all the tables in the namespace in addition to deleting the namespace.
* @throws AccumuloException
* if a general error occurs
* @throws AccumuloSecurityException
* if the user does not have permission
* @throws NamespaceNotFoundException
- * if the namespace does not exist
+ * if the specified namespace doesn't exist
* @throws NamespaceNotEmptyException
* if the namespaces still contains tables
- * @throws TableNotFoundException
- * if table not found while deleting
+ * @since 1.6.0
*/
- public void delete(String namespace, boolean deleteTables) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException,
- NamespaceNotEmptyException, TableNotFoundException;
+ public void delete(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException, NamespaceNotEmptyException;
/**
* Rename a namespace
@@ -153,13 +109,13 @@ public interface NamespaceOperations {
* if the old namespace does not exist
* @throws NamespaceExistsException
* if the new namespace already exists
+ * @since 1.6.0
*/
- public void rename(String oldNamespaceName, String newNamespaceName) throws AccumuloSecurityException, NamespaceNotFoundException, AccumuloException,
+ public void rename(String oldNamespaceName, String newNamespaceName) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException,
NamespaceExistsException;
/**
- * Sets a property on a namespace which applies to all tables in the namespace. Note that it may take a short period of time (a second) to propagate the
- * change everywhere.
+ * Sets a property on a namespace which applies to all tables in the namespace. Note that it may take a few seconds to propagate the change everywhere.
*
* @param namespace
* the name of the namespace
@@ -171,11 +127,14 @@ public interface NamespaceOperations {
* if a general error occurs
* @throws AccumuloSecurityException
* if the user does not have permission
+ * @throws NamespaceNotFoundException
+ * if the specified namespace doesn't exist
+ * @since 1.6.0
*/
- public void setProperty(String namespace, String property, String value) throws AccumuloException, AccumuloSecurityException;
+ public void setProperty(String namespace, String property, String value) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException;
/**
- * Removes a property from a namespace. Note that it may take a short period of time (a second) to propagate the change everywhere.
+ * Removes a property from a namespace. Note that it may take a few seconds to propagate the change everywhere.
*
* @param namespace
* the name of the namespace
@@ -185,66 +144,39 @@ public interface NamespaceOperations {
* if a general error occurs
* @throws AccumuloSecurityException
* if the user does not have permission
- */
- public void removeProperty(String namespace, String property) throws AccumuloException, AccumuloSecurityException;
-
- /**
- * Gets properties of a namespace. Note that recently changed properties may not be available immediately.
- *
- * @param namespace
- * the name of the namespace
- * @return all properties visible by this table (system and per-table properties). Note that recently changed properties may not be visible immediately.
* @throws NamespaceNotFoundException
- * if the namespace does not exist
+ * if the specified namespace doesn't exist
+ * @since 1.6.0
*/
- public Iterable<Entry<String,String>> getProperties(String namespace) throws AccumuloException, NamespaceNotFoundException;
+ public void removeProperty(String namespace, String property) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException;
/**
+ * Gets properties of a namespace, which are inherited by tables in this namespace. Note that recently changed properties may not be available immediately.
*
* @param namespace
- * the namespace to take offline
- * @throws AccumuloException
- * when there is a general accumulo error
- * @throws AccumuloSecurityException
- * when the user does not have the proper permissions
- * @throws NamespaceNotFoundException
- * if the namespace does not exist
- */
- public void offline(String namespace) throws AccumuloSecurityException, AccumuloException, NamespaceNotFoundException;
-
- /**
- *
- * @param namespace
- * the namespace to take online
+ * the name of the namespace
+ * @return all properties visible by this namespace (system and per-table properties). Note that recently changed properties may not be visible immediately.
* @throws AccumuloException
- * when there is a general accumulo error
+ * if a general error occurs
* @throws AccumuloSecurityException
- * when the user does not have the proper permissions
+ * if the user does not have permission
* @throws NamespaceNotFoundException
- * if the namespace does not exist
+ * if the specified namespace doesn't exist
+ * @since 1.6.0
*/
- public void online(String namespace) throws AccumuloSecurityException, AccumuloException, NamespaceNotFoundException;
+ public Iterable<Entry<String,String>> getProperties(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException;
/**
* Get a mapping of namespace name to internal namespace id.
*
* @return the map from namespace name to internal namespace id
- */
- public Map<String,String> namespaceIdMap();
-
- /**
- * Gets the number of bytes being used in the files for the set of tables in this namespace
- *
- * @param namespace
- * the namespace to get the set of tables from
- *
- * @return a list of disk usage objects containing linked table names and sizes
* @throws AccumuloException
- * when there is a general accumulo error
+ * if a general error occurs
* @throws AccumuloSecurityException
- * when the user does not have the proper permissions
+ * if the user does not have permission
+ * @since 1.6.0
*/
- public List<DiskUsage> getDiskUsage(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException;
+ public Map<String,String> namespaceIdMap() throws AccumuloException, AccumuloSecurityException;
/**
* Add an iterator to a namespace on all scopes.
@@ -253,15 +185,15 @@ public interface NamespaceOperations {
* the name of the namespace
* @param setting
* object specifying the properties of the iterator
- * @throws AccumuloSecurityException
- * thrown if the user does not have the ability to set properties on the namespace
* @throws AccumuloException
+ * if a general error occurs
+ * @throws AccumuloSecurityException
+ * if the user does not have permission
* @throws NamespaceNotFoundException
- * throw if the namespace no longer exists
- * @throws IllegalArgumentException
- * if the setting conflicts with any existing iterators
+ * if the specified namespace doesn't exist
+ * @since 1.6.0
*/
- public void attachIterator(String namespace, IteratorSetting setting) throws AccumuloSecurityException, AccumuloException, NamespaceNotFoundException;
+ public void attachIterator(String namespace, IteratorSetting setting) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException;
/**
* Add an iterator to a namespace on the given scopes.
@@ -270,15 +202,17 @@ public interface NamespaceOperations {
* the name of the namespace
* @param setting
* object specifying the properties of the iterator
- * @throws AccumuloSecurityException
- * thrown if the user does not have the ability to set properties on the namespace
+ * @param scopes
+ * the set of scopes the iterator should apply to
* @throws AccumuloException
+ * if a general error occurs
+ * @throws AccumuloSecurityException
+ * if the user does not have permission
* @throws NamespaceNotFoundException
- * throw if the namespace no longer exists
- * @throws IllegalArgumentException
- * if the setting conflicts with any existing iterators
+ * if the specified namespace doesn't exist
+ * @since 1.6.0
*/
- public void attachIterator(String namespace, IteratorSetting setting, EnumSet<IteratorScope> scopes) throws AccumuloSecurityException, AccumuloException,
+ public void attachIterator(String namespace, IteratorSetting setting, EnumSet<IteratorScope> scopes) throws AccumuloException, AccumuloSecurityException,
NamespaceNotFoundException;
/**
@@ -290,13 +224,15 @@ public interface NamespaceOperations {
* the name of the iterator
* @param scopes
* the scopes of the iterator
- * @throws AccumuloSecurityException
- * thrown if the user does not have the ability to set properties on the namespace
* @throws AccumuloException
+ * if a general error occurs
+ * @throws AccumuloSecurityException
+ * if the user does not have permission
* @throws NamespaceNotFoundException
- * thrown if the namespace no longer exists
+ * if the specified namespace doesn't exist
+ * @since 1.6.0
*/
- public void removeIterator(String namespace, String name, EnumSet<IteratorScope> scopes) throws AccumuloSecurityException, AccumuloException,
+ public void removeIterator(String namespace, String name, EnumSet<IteratorScope> scopes) throws AccumuloException, AccumuloSecurityException,
NamespaceNotFoundException;
/**
@@ -309,14 +245,16 @@ public interface NamespaceOperations {
* @param scope
* the scope of the iterator
* @return the settings for this iterator
- * @throws AccumuloSecurityException
- * thrown if the user does not have the ability to set properties on the namespace
* @throws AccumuloException
+ * if a general error occurs
+ * @throws AccumuloSecurityException
+ * if the user does not have permission
* @throws NamespaceNotFoundException
- * thrown if the namespace no longer exists
+ * if the specified namespace doesn't exist
+ * @since 1.6.0
*/
- public IteratorSetting getIteratorSetting(String namespace, String name, IteratorScope scope) throws AccumuloSecurityException, AccumuloException,
- NumberFormatException, NamespaceNotFoundException;
+ public IteratorSetting getIteratorSetting(String namespace, String name, IteratorScope scope) throws AccumuloException, AccumuloSecurityException,
+ NamespaceNotFoundException;
/**
* Get a list of iterators for this namespace.
@@ -324,30 +262,36 @@ public interface NamespaceOperations {
* @param namespace
* the name of the namespace
* @return a set of iterator names
- * @throws AccumuloSecurityException
- * thrown if the user does not have the ability to set properties on the namespace
* @throws AccumuloException
+ * if a general error occurs
+ * @throws AccumuloSecurityException
+ * if the user does not have permission
* @throws NamespaceNotFoundException
- * thrown if the namespace no longer exists
+ * if the specified namespace doesn't exist
+ * @since 1.6.0
*/
- public Map<String,EnumSet<IteratorScope>> listIterators(String namespace) throws AccumuloSecurityException, AccumuloException, NamespaceNotFoundException;
+ public Map<String,EnumSet<IteratorScope>> listIterators(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException;
/**
* Check whether a given iterator configuration conflicts with existing configuration; in particular, determine if the name or priority are already in use for
- * the specified scopes.
+ * the specified scopes. If not, an IllegalArgumentException is thrown, wrapped in an AccumuloException.
*
* @param namespace
* the name of the namespace
* @param setting
* object specifying the properties of the iterator
+ * @param scopes
+ * the scopes of the iterator
* @throws AccumuloException
+ * if a general error occurs
+ * @throws AccumuloSecurityException
+ * if the user does not have permission
* @throws NamespaceNotFoundException
- * thrown if the namespace no longer exists
- * @throws IllegalStateException
- * if the setting conflicts with any existing iterators
+ * if the specified namespace doesn't exist
+ * @since 1.6.0
*/
public void checkIteratorConflicts(String namespace, IteratorSetting setting, EnumSet<IteratorScope> scopes) throws AccumuloException,
- NamespaceNotFoundException;
+ AccumuloSecurityException, NamespaceNotFoundException;
/**
* Add a new constraint to a namespace.
@@ -356,13 +300,14 @@ public interface NamespaceOperations {
* the name of the namespace
* @param constraintClassName
* the full name of the constraint class
- * @return the unique number assigned to the constraint
+ * @return the unique id number assigned to the constraint
* @throws AccumuloException
- * thrown if the constraint has already been added to the table or if there are errors in the configuration of existing constraints
+ * if a general error occurs
* @throws AccumuloSecurityException
- * thrown if the user doesn't have permission to add the constraint
+ * if the user does not have permission
* @throws NamespaceNotFoundException
- * thrown if the namespace no longer exists
+ * if the specified namespace doesn't exist
+ * @since 1.6.0
*/
public int addConstraint(String namespace, String constraintClassName) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException;
@@ -371,13 +316,17 @@ public interface NamespaceOperations {
*
* @param namespace
* the name of the namespace
- * @param number
- * the unique number assigned to the constraint
+ * @param id
+ * the unique id number assigned to the constraint
* @throws AccumuloException
+ * if a general error occurs
* @throws AccumuloSecurityException
- * thrown if the user doesn't have permission to remove the constraint
+ * if the user does not have permission
+ * @throws NamespaceNotFoundException
+ * if the specified namespace doesn't exist
+ * @since 1.6.0
*/
- public void removeConstraint(String namespace, int number) throws AccumuloException, AccumuloSecurityException;
+ public void removeConstraint(String namespace, int id) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException;
/**
* List constraints on a namespace with their assigned numbers.
@@ -386,16 +335,33 @@ public interface NamespaceOperations {
* the name of the namespace
* @return a map from constraint class name to assigned number
* @throws AccumuloException
- * thrown if there are errors in the configuration of existing constraints
+ * if a general error occurs
+ * @throws AccumuloSecurityException
+ * if the user does not have permission
* @throws NamespaceNotFoundException
- * thrown if the namespace no longer exists
+ * if the specified namespace doesn't exist
+ * @since 1.6.0
*/
- public Map<String,Integer> listConstraints(String namespace) throws AccumuloException, NamespaceNotFoundException;
+ public Map<String,Integer> listConstraints(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException;
/**
* Test to see if the instance can load the given class as the given type. This check uses the table classpath property if it is set.
*
+ * @param namespace
+ * the name of the namespace
+ * @param className
+ * the class to try to load
+ * @param asTypeName
+ * the interface or superclass the given class is attempted to load as
* @return true if the instance can load the given class as the given type, false otherwise
+ * @throws AccumuloException
+ * if a general error occurs
+ * @throws AccumuloSecurityException
+ * if the user does not have permission
+ * @throws NamespaceNotFoundException
+ * if the specified namespace doesn't exist
+ * @since 1.6.0
*/
- boolean testClassLoad(String namespace, String className, String asTypeName) throws NamespaceNotFoundException, AccumuloException, AccumuloSecurityException;
+ public boolean testClassLoad(String namespace, String className, String asTypeName) throws AccumuloException, AccumuloSecurityException,
+ NamespaceNotFoundException;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/3c920943/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperationsHelper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperationsHelper.java b/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperationsHelper.java
index 007461f..7ecc4e3 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperationsHelper.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperationsHelper.java
@@ -119,7 +119,7 @@ public abstract class NamespaceOperationsHelper implements NamespaceOperations {
@Override
public void checkIteratorConflicts(String namespace, IteratorSetting setting, EnumSet<IteratorScope> scopes) throws AccumuloException,
- NamespaceNotFoundException {
+ NamespaceNotFoundException, AccumuloSecurityException {
if (!exists(namespace))
throw new NamespaceNotFoundException(null, namespace, null);
for (IteratorScope scope : scopes) {
@@ -179,12 +179,12 @@ public abstract class NamespaceOperationsHelper implements NamespaceOperations {
}
@Override
- public void removeConstraint(String namespace, int number) throws AccumuloException, AccumuloSecurityException {
+ public void removeConstraint(String namespace, int number) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException {
this.removeProperty(namespace, Property.TABLE_CONSTRAINT_PREFIX.toString() + number);
}
@Override
- public Map<String,Integer> listConstraints(String namespace) throws AccumuloException, NamespaceNotFoundException {
+ public Map<String,Integer> listConstraints(String namespace) throws AccumuloException, NamespaceNotFoundException, AccumuloSecurityException {
Map<String,Integer> constraints = new TreeMap<String,Integer>();
for (Entry<String,String> property : this.getProperties(namespace)) {
if (property.getKey().startsWith(Property.TABLE_CONSTRAINT_PREFIX.toString())) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/3c920943/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 9036845..6c877f8 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
@@ -18,18 +18,15 @@ package org.apache.accumulo.core.client.admin;
import java.nio.ByteBuffer;
import java.util.Arrays;
+import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
-import jline.internal.Log;
-
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -38,7 +35,6 @@ import org.apache.accumulo.core.client.IteratorSetting;
import org.apache.accumulo.core.client.NamespaceExistsException;
import org.apache.accumulo.core.client.NamespaceNotEmptyException;
import org.apache.accumulo.core.client.NamespaceNotFoundException;
-import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.TableOfflineException;
import org.apache.accumulo.core.client.impl.ClientExec;
import org.apache.accumulo.core.client.impl.ClientExecReturn;
@@ -51,7 +47,6 @@ import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode;
import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException;
import org.apache.accumulo.core.constraints.Constraint;
-import org.apache.accumulo.core.iterators.IteratorUtil;
import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
import org.apache.accumulo.core.master.thrift.MasterClientService;
@@ -67,33 +62,18 @@ import org.apache.log4j.Logger;
import org.apache.thrift.TException;
import org.apache.thrift.transport.TTransportException;
-/**
- * Provides a class for administering namespaces
- *
- */
public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
private Instance instance;
private Credentials credentials;
private static final Logger log = Logger.getLogger(TableOperations.class);
- /**
- * @param instance
- * the connection information for this instance
- * @param credentials
- * the username/password for this connection
- */
public NamespaceOperationsImpl(Instance instance, Credentials credentials) {
ArgumentChecker.notNull(instance, credentials);
this.instance = instance;
this.credentials = credentials;
}
- /**
- * Retrieve a list of namespaces in Accumulo.
- *
- * @return List of namespaces in accumulo
- */
@Override
public SortedSet<String> list() {
OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Fetching list of namespaces...");
@@ -102,13 +82,6 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
return namespaces;
}
- /**
- * A method to check if a namespace exists in Accumulo.
- *
- * @param namespace
- * the name of the namespace
- * @return true if the namespace exists
- */
@Override
public boolean exists(String namespace) {
ArgumentChecker.notNull(namespace);
@@ -119,52 +92,12 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
return exists;
}
- /**
- * Create a namespace with no special configuration
- *
- * @param namespace
- * the name of the namespace
- * @throws AccumuloException
- * if a general error occurs
- * @throws AccumuloSecurityException
- * if the user does not have permission
- * @throws NamespaceExistsException
- * if the namespace already exists
- */
@Override
public void create(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceExistsException {
- create(namespace, true, TimeType.MILLIS);
- }
-
- /**
- * @param namespace
- * the name of the namespace
- * @param limitVersion
- * Enables/disables the versioning iterator, which will limit the number of Key versions kept.
- */
- @Override
- public void create(String namespace, boolean limitVersion) throws AccumuloException, AccumuloSecurityException, NamespaceExistsException {
- create(namespace, limitVersion, TimeType.MILLIS);
- }
-
- /**
- * @param namespace
- * the name of the namespace
- * @param timeType
- * specifies logical or real-time based time recording for entries in the table
- * @param limitVersion
- * Enables/disables the versioning iterator, which will limit the number of Key versions kept.
- */
- @Override
- public void create(String namespace, boolean limitVersion, TimeType timeType) throws AccumuloException, AccumuloSecurityException, NamespaceExistsException {
- ArgumentChecker.notNull(namespace, timeType);
-
- List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(namespace.getBytes()), ByteBuffer.wrap(timeType.name().getBytes()));
-
- Map<String,String> opts = IteratorUtil.generateInitialTableProperties(limitVersion);
+ ArgumentChecker.notNull(namespace);
try {
- doNamespaceOperation(TableOperation.CREATE, args, opts);
+ doNamespaceOperation(TableOperation.CREATE, Arrays.asList(ByteBuffer.wrap(namespace.getBytes())), Collections.<String,String> emptyMap());
} catch (NamespaceNotFoundException e1) {
// should not happen
throw new RuntimeException(e1);
@@ -282,49 +215,8 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
}
}
- /**
- * Delete a namespace if empty
- *
- * @param namespace
- * the name of the namespace
- * @throws AccumuloException
- * if a general error occurs
- * @throws AccumuloSecurityException
- * if the user does not have permission
- * @throws NamespaceNotFoundException
- * if the namespace does not exist
- * @throws NamespaceNotEmptyException
- * if the namespaces still contains tables
- * @throws TableNotFoundException
- * if table not found while deleting
- */
@Override
- public void delete(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException, NamespaceNotEmptyException,
- TableNotFoundException {
- delete(namespace, false);
- }
-
- /**
- * Delete a namespace
- *
- * @param namespace
- * the name of the namespace
- * @param deleteTables
- * boolean, if true deletes all the tables in the namespace in addition to deleting the namespace.
- * @throws AccumuloException
- * if a general error occurs
- * @throws AccumuloSecurityException
- * if the user does not have permission
- * @throws NamespaceNotFoundException
- * if the namespace does not exist
- * @throws NamespaceNotEmptyException
- * if the namespaces still contains tables
- * @throws TableNotFoundException
- * if table not found while deleting
- */
- @Override
- public void delete(String namespace, boolean deleteTables) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException,
- NamespaceNotEmptyException, TableNotFoundException {
+ public void delete(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException, NamespaceNotEmptyException {
ArgumentChecker.notNull(namespace);
String namespaceId = Namespaces.getNamespaceId(instance, namespace);
@@ -334,16 +226,7 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
}
if (Namespaces.getTableIds(instance, namespaceId).size() > 0) {
- if (!deleteTables) {
- throw new NamespaceNotEmptyException(namespaceId, namespace, null);
- }
- for (String table : Namespaces.getTableNames(instance, namespaceId)) {
- try {
- getTableOperations().delete(table);
- } catch (TableNotFoundException e) {
- log.debug("Table (" + table + ") not found while deleting namespace, probably deleted while we were deleting the rest of the tables");
- }
- }
+ throw new NamespaceNotEmptyException(namespaceId, namespace, null);
}
List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(namespace.getBytes()));
@@ -358,22 +241,6 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
}
- /**
- * Rename a namespace
- *
- * @param oldNamespaceName
- * the old namespace
- * @param newNamespaceName
- * the new namespace
- * @throws AccumuloException
- * if a general error occurs
- * @throws AccumuloSecurityException
- * if the user does not have permission
- * @throws NamespaceNotFoundException
- * if the old namespace name does not exist
- * @throws NamespaceExistsException
- * if the new namespace name already exists
- */
@Override
public void rename(String oldNamespaceName, String newNamespaceName) throws AccumuloSecurityException, NamespaceNotFoundException, AccumuloException,
NamespaceExistsException {
@@ -383,20 +250,6 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
doNamespaceOperation(TableOperation.RENAME, args, opts);
}
- /**
- * Sets a property on a namespace which will apply to all tables in the namespace
- *
- * @param namespace
- * the name of the namespace
- * @param property
- * the name of a per-table property
- * @param value
- * the value to set a per-table property to
- * @throws AccumuloException
- * if a general error occurs
- * @throws AccumuloSecurityException
- * if the user does not have permission
- */
@Override
public void setProperty(final String namespace, final String property, final String value) throws AccumuloException, AccumuloSecurityException {
ArgumentChecker.notNull(namespace, property, value);
@@ -409,18 +262,6 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
});
}
- /**
- * Removes a property from a namespace
- *
- * @param namespace
- * the name of the namespace
- * @param property
- * the name of a per-table property
- * @throws AccumuloException
- * if a general error occurs
- * @throws AccumuloSecurityException
- * if the user does not have permission
- */
@Override
public void removeProperty(final String namespace, final String property) throws AccumuloException, AccumuloSecurityException {
ArgumentChecker.notNull(namespace, property);
@@ -433,15 +274,6 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
});
}
- /**
- * Gets properties of a namespace
- *
- * @param namespace
- * the name of the namespace
- * @return all properties visible by this namespace (system and per-namespace properties)
- * @throws NamespaceNotFoundException
- * if the namespace does not exist
- */
@Override
public Iterable<Entry<String,String>> getProperties(final String namespace) throws AccumuloException, NamespaceNotFoundException {
ArgumentChecker.notNull(namespace);
@@ -468,84 +300,12 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
}
- /**
- *
- * @param namespace
- * the namespace to take offline
- * @throws AccumuloException
- * when there is a general accumulo error
- * @throws AccumuloSecurityException
- * when the user does not have the proper permissions
- * @throws NamespaceNotFoundException
- * if the namespace does not exist
- */
- @Override
- public void offline(String namespace) throws AccumuloSecurityException, AccumuloException, NamespaceNotFoundException {
-
- ArgumentChecker.notNull(namespace);
- String namespaceId = Namespaces.getNamespaceId(instance, namespace);
- try {
- for (String table : Namespaces.getTableNames(instance, namespaceId)) {
- getTableOperations().offline(table);
- }
- } catch (TableNotFoundException e) {
- Log.error("Namespace (" + namespaceId + ") contains reference to table that doesn't exist");
- }
- }
-
- /**
- *
- * @param namespace
- * the namespace to take online
- * @throws AccumuloException
- * when there is a general accumulo error
- * @throws AccumuloSecurityException
- * when the user does not have the proper permissions
- * @throws NamespaceNotFoundException
- * if the namespace does not exist
- */
- @Override
- public void online(String namespace) throws AccumuloSecurityException, AccumuloException, NamespaceNotFoundException {
- ArgumentChecker.notNull(namespace);
- String namespaceId = Namespaces.getNamespaceId(instance, namespace);
- try {
- for (String table : Namespaces.getTableNames(instance, namespaceId)) {
- getTableOperations().online(table);
- }
- } catch (TableNotFoundException e) {
- Log.warn("Namespace (" + namespaceId + ") contains a reference to a table that doesn't exist");
- }
- }
-
- /**
- * Get a mapping of namespace name to internal namespace id.
- *
- * @return the map from namespace name to internal namespace id
- */
@Override
public Map<String,String> namespaceIdMap() {
return Namespaces.getNameToIdMap(instance);
}
@Override
- public List<DiskUsage> getDiskUsage(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException {
- Set<String> tables = new HashSet<String>();
- String namespaceId = Namespaces.getNamespaceId(instance, namespace);
- tables.addAll(Namespaces.getTableNames(instance, namespaceId));
- List<DiskUsage> du = null;
- try {
- du = getTableOperations().getDiskUsage(tables);
- } catch (TableNotFoundException e) {
- log.warn("Could not find table (" + e.getTableName() + ") reference in namespace (" + namespace + ")");
- }
- return du;
- }
-
- private TableOperations getTableOperations() throws AccumuloException, AccumuloSecurityException {
- return new TableOperationsImpl(instance, credentials);
- }
-
- @Override
public void attachIterator(String namespace, IteratorSetting setting, EnumSet<IteratorScope> scopes) throws AccumuloSecurityException, AccumuloException,
NamespaceNotFoundException {
testClassLoad(namespace, setting.getIteratorClass(), SortedKeyValueIterator.class.getName());
http://git-wip-us.apache.org/repos/asf/accumulo/blob/3c920943/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java b/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java
index dc95250..97066c4 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java
@@ -41,14 +41,14 @@ import org.apache.hadoop.io.Text;
*/
public interface TableOperations {
-
+
/**
* Retrieve a list of tables in Accumulo.
*
* @return List of tables in accumulo
*/
public SortedSet<String> list();
-
+
/**
* A method to check if a table exists in Accumulo.
*
@@ -57,7 +57,7 @@ public interface TableOperations {
* @return true if the table exists
*/
public boolean exists(String tableName);
-
+
/**
* Create a table with no special configuration
*
@@ -71,7 +71,7 @@ public interface TableOperations {
* if the table already exists
*/
public void create(String tableName) throws AccumuloException, AccumuloSecurityException, TableExistsException;
-
+
/**
* @param tableName
* the name of the table
@@ -85,7 +85,7 @@ public interface TableOperations {
* if the table already exists
*/
public void create(String tableName, boolean limitVersion) throws AccumuloException, AccumuloSecurityException, TableExistsException;
-
+
/**
* @param tableName
* the name of the table
@@ -101,7 +101,7 @@ public interface TableOperations {
* if the table already exists
*/
public void create(String tableName, boolean versioningIter, TimeType timeType) throws AccumuloException, AccumuloSecurityException, TableExistsException;
-
+
/**
* Imports a table exported via exportTable and copied via hadoop distcp.
*
@@ -115,7 +115,7 @@ public interface TableOperations {
* @since 1.5.0
*/
public void importTable(String tableName, String importDir) throws TableExistsException, AccumuloException, AccumuloSecurityException;
-
+
/**
* Exports a table. The tables data is not exported, just table metadata and a list of files to distcp. The table being exported must be offline and stay
* offline for the duration of distcp. To avoid losing access to a table it can be cloned and the clone taken offline for export.
@@ -147,7 +147,7 @@ public interface TableOperations {
* if the table does not exist
*/
public void addSplits(String tableName, SortedSet<Text> partitionKeys) throws TableNotFoundException, AccumuloException, AccumuloSecurityException;
-
+
/**
* @param tableName
* the name of the table
@@ -158,7 +158,7 @@ public interface TableOperations {
*/
@Deprecated
public Collection<Text> getSplits(String tableName) throws TableNotFoundException;
-
+
/**
* @param tableName
* the name of the table
@@ -172,7 +172,7 @@ public interface TableOperations {
* @since 1.5.0
*/
public Collection<Text> listSplits(String tableName) throws TableNotFoundException, AccumuloSecurityException, AccumuloException;
-
+
/**
* @param tableName
* the name of the table
@@ -184,7 +184,7 @@ public interface TableOperations {
*/
@Deprecated
public Collection<Text> getSplits(String tableName, int maxSplits) throws TableNotFoundException;
-
+
/**
* @param tableName
* the name of the table
@@ -199,7 +199,7 @@ public interface TableOperations {
* @since 1.5.0
*/
public Collection<Text> listSplits(String tableName, int maxSplits) throws TableNotFoundException, AccumuloSecurityException, AccumuloException;
-
+
/**
* Finds the max row within a given range. To find the max row in a table, pass null for start and end row.
*
@@ -223,7 +223,7 @@ public interface TableOperations {
*/
public Text getMaxRow(String tableName, Authorizations auths, Text startRow, boolean startInclusive, Text endRow, boolean endInclusive)
throws TableNotFoundException, AccumuloException, AccumuloSecurityException;
-
+
/**
* Merge tablets between (start, end]
*
@@ -235,7 +235,7 @@ public interface TableOperations {
* last tablet to be merged contains this row, null means the last tablet
*/
public void merge(String tableName, Text start, Text end) throws AccumuloException, AccumuloSecurityException, TableNotFoundException;
-
+
/**
* Delete rows between (start, end]
*
@@ -247,7 +247,7 @@ public interface TableOperations {
* last row to be deleted, inclusive, null means the last row of the table
*/
public void deleteRows(String tableName, Text start, Text end) throws AccumuloException, AccumuloSecurityException, TableNotFoundException;
-
+
/**
* Starts a full major compaction of the tablets in the range (start, end]. The compaction is preformed even for tablets that have only one file.
*
@@ -264,7 +264,7 @@ public interface TableOperations {
*/
public void compact(String tableName, Text start, Text end, boolean flush, boolean wait) throws AccumuloSecurityException, TableNotFoundException,
AccumuloException;
-
+
/**
* Starts a full major compaction of the tablets in the range (start, end]. The compaction is preformed even for tablets that have only one file.
*
@@ -284,7 +284,7 @@ public interface TableOperations {
*/
public void compact(String tableName, Text start, Text end, List<IteratorSetting> iterators, boolean flush, boolean wait) throws AccumuloSecurityException,
TableNotFoundException, AccumuloException;
-
+
/**
* Cancels a user initiated major compaction of a table initiated with {@link #compact(String, Text, Text, boolean, boolean)} or
* {@link #compact(String, Text, Text, List, boolean, boolean)}. Compactions of tablets that are currently running may finish, but new compactions of tablets
@@ -301,7 +301,7 @@ public interface TableOperations {
* @since 1.5.0
*/
public void cancelCompaction(String tableName) throws AccumuloSecurityException, TableNotFoundException, AccumuloException;
-
+
/**
* Delete a table
*
@@ -315,7 +315,7 @@ public interface TableOperations {
* if the table does not exist
*/
public void delete(String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException;
-
+
/**
* Clone a table from an existing table. The cloned table will have the same data as the source table it was created from. After cloning, the two tables can
* mutate independently. Initially the cloned table should not use any extra space, however as the source table and cloned table major compact extra space
@@ -334,10 +334,10 @@ public interface TableOperations {
* @param propertiesToExclude
* do not copy these properties from the source table, just revert to system defaults
*/
-
+
public void clone(String srcTableName, String newTableName, boolean flush, Map<String,String> propertiesToSet, Set<String> propertiesToExclude)
throws AccumuloException, AccumuloSecurityException, TableNotFoundException, TableExistsException;
-
+
/**
* Rename a table
*
@@ -356,7 +356,7 @@ public interface TableOperations {
*/
public void rename(String oldTableName, String newTableName) throws AccumuloSecurityException, TableNotFoundException, AccumuloException,
TableExistsException;
-
+
/**
* Initiate a flush of a table's data that is in memory
*
@@ -371,7 +371,7 @@ public interface TableOperations {
*/
@Deprecated
public void flush(String tableName) throws AccumuloException, AccumuloSecurityException;
-
+
/**
* Flush a table's data that is currently in memory.
*
@@ -387,7 +387,7 @@ public interface TableOperations {
* @throws TableNotFoundException
*/
public void flush(String tableName, Text start, Text end, boolean wait) throws AccumuloException, AccumuloSecurityException, TableNotFoundException;
-
+
/**
* Sets a property on a table. Note that it may take a short period of time (a second) to propagate the change everywhere.
*
@@ -403,9 +403,9 @@ public interface TableOperations {
* if the user does not have permission
*/
public void setProperty(String tableName, String property, String value) throws AccumuloException, AccumuloSecurityException;
-
+
/**
- * Removes a property from a table. Note that it may take a short period of time (a second) to propagate the change everywhere.
+ * Removes a property from a table. Note that it may take a short period of time (a second) to propagate the change everywhere.
*
* @param tableName
* the name of the table
@@ -417,19 +417,18 @@ public interface TableOperations {
* if the user does not have permission
*/
public void removeProperty(String tableName, String property) throws AccumuloException, AccumuloSecurityException;
-
+
/**
- * Gets properties of a table. Note that recently changed properties may not be available immediately.
+ * Gets properties of a table. Note that recently changed properties may not be available immediately.
*
* @param tableName
* the name of the table
- * @return all properties visible by this table (system and per-table properties). Note that recently changed
- * properties may not be visible immediately.
+ * @return all properties visible by this table (system and per-table properties). Note that recently changed properties may not be visible immediately.
* @throws TableNotFoundException
* if the table does not exist
*/
public Iterable<Entry<String,String>> getProperties(String tableName) throws AccumuloException, TableNotFoundException;
-
+
/**
* Sets a table's locality groups. A table's locality groups can be changed at any time.
*
@@ -445,7 +444,7 @@ public interface TableOperations {
* if the table does not exist
*/
public void setLocalityGroups(String tableName, Map<String,Set<Text>> groups) throws AccumuloException, AccumuloSecurityException, TableNotFoundException;
-
+
/**
*
* Gets the locality groups currently set for a table.
@@ -459,7 +458,7 @@ public interface TableOperations {
* if the table does not exist
*/
public Map<String,Set<Text>> getLocalityGroups(String tableName) throws AccumuloException, TableNotFoundException;
-
+
/**
* @param tableName
* the name of the table
@@ -477,7 +476,7 @@ public interface TableOperations {
*/
public Set<Range> splitRangeByTablets(String tableName, Range range, int maxSplits) throws AccumuloException, AccumuloSecurityException,
TableNotFoundException;
-
+
/**
* Bulk import all the files in a directory into a table.
*
@@ -488,7 +487,7 @@ public interface TableOperations {
* @param failureDir
* the HDFS directory to place files that failed to be imported, must exist and be empty
* @param setTime
- * override the time values in the input files, and use the current time for all mutations
+ * override the time values in the input files, and use the current time for all mutations
* @throws IOException
* when there is an error reading/writing to HDFS
* @throws AccumuloException
@@ -501,7 +500,7 @@ public interface TableOperations {
*/
public void importDirectory(String tableName, String dir, String failureDir, boolean setTime) throws TableNotFoundException, IOException, AccumuloException,
AccumuloSecurityException;
-
+
/**
* Initiates taking a table offline, but does not wait for action to complete
*
@@ -514,7 +513,7 @@ public interface TableOperations {
* @throws TableNotFoundException
*/
public void offline(String tableName) throws AccumuloSecurityException, AccumuloException, TableNotFoundException;
-
+
/**
*
* @param tableName
@@ -529,7 +528,7 @@ public interface TableOperations {
* @since 1.6.0
*/
public void offline(String tableName, boolean wait) throws AccumuloSecurityException, AccumuloException, TableNotFoundException;
-
+
/**
* Initiates bringing a table online, but does not wait for action to complete
*
@@ -542,7 +541,7 @@ public interface TableOperations {
* @throws TableNotFoundException
*/
public void online(String tableName) throws AccumuloSecurityException, AccumuloException, TableNotFoundException;
-
+
/**
*
* @param tableName
@@ -557,7 +556,7 @@ public interface TableOperations {
* @since 1.6.0
*/
public void online(String tableName, boolean wait) throws AccumuloSecurityException, AccumuloException, TableNotFoundException;
-
+
/**
* Clears the tablet locator cache for a specified table
*
@@ -567,14 +566,14 @@ public interface TableOperations {
* if table does not exist
*/
public void clearLocatorCache(String tableName) throws TableNotFoundException;
-
+
/**
* Get a mapping of table name to internal table id.
*
* @return the map from table name to internal table id
*/
public Map<String,String> tableIdMap();
-
+
/**
* Add an iterator to a table on all scopes.
*
@@ -591,7 +590,7 @@ public interface TableOperations {
* if the setting conflicts with any existing iterators
*/
public void attachIterator(String tableName, IteratorSetting setting) throws AccumuloSecurityException, AccumuloException, TableNotFoundException;
-
+
/**
* Add an iterator to a table on the given scopes.
*
@@ -609,7 +608,7 @@ public interface TableOperations {
*/
public void attachIterator(String tableName, IteratorSetting setting, EnumSet<IteratorScope> scopes) throws AccumuloSecurityException, AccumuloException,
TableNotFoundException;
-
+
/**
* Remove an iterator from a table by name.
*
@@ -627,7 +626,7 @@ public interface TableOperations {
*/
public void removeIterator(String tableName, String name, EnumSet<IteratorScope> scopes) throws AccumuloSecurityException, AccumuloException,
TableNotFoundException;
-
+
/**
* Get the settings for an iterator.
*
@@ -646,7 +645,7 @@ public interface TableOperations {
*/
public IteratorSetting getIteratorSetting(String tableName, String name, IteratorScope scope) throws AccumuloSecurityException, AccumuloException,
TableNotFoundException;
-
+
/**
* Get a list of iterators for this table.
*
@@ -658,7 +657,7 @@ public interface TableOperations {
* @throws TableNotFoundException
*/
public Map<String,EnumSet<IteratorScope>> listIterators(String tableName) throws AccumuloSecurityException, AccumuloException, TableNotFoundException;
-
+
/**
* Check whether a given iterator configuration conflicts with existing configuration; in particular, determine if the name or priority are already in use for
* the specified scopes.
@@ -669,11 +668,9 @@ public interface TableOperations {
* object specifying the properties of the iterator
* @throws AccumuloException
* @throws TableNotFoundException
- * @throws IllegalStateException
- * if the setting conflicts with any existing iterators
*/
public void checkIteratorConflicts(String tableName, IteratorSetting setting, EnumSet<IteratorScope> scopes) throws AccumuloException, TableNotFoundException;
-
+
/**
* Add a new constraint to a table.
*
@@ -690,7 +687,7 @@ public interface TableOperations {
* @since 1.5.0
*/
public int addConstraint(String tableName, String constraintClassName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException;
-
+
/**
* Remove a constraint from a table.
*
@@ -704,7 +701,7 @@ public interface TableOperations {
* @since 1.5.0
*/
public void removeConstraint(String tableName, int number) throws AccumuloException, AccumuloSecurityException;
-
+
/**
* List constraints on a table with their assigned numbers.
*
@@ -720,15 +717,15 @@ public interface TableOperations {
/**
* Gets the number of bytes being used in the files for a set of tables
- *
+ *
* @param tables
* a set of tables
- * @return a list of disk usage objects containing linked table names and sizes
+ * @return a list of disk usage objects containing linked table names and sizes
* @throws AccumuloException
* @throws AccumuloSecurityException
*/
public List<DiskUsage> getDiskUsage(Set<String> tables) throws AccumuloException, AccumuloSecurityException, TableNotFoundException;
-
+
/**
* Test to see if the instance can load the given class as the given type. This check uses the table classpath if it is set.
*
http://git-wip-us.apache.org/repos/asf/accumulo/blob/3c920943/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 f017df4..2067762 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
@@ -23,8 +23,6 @@ import java.util.SortedMap;
import java.util.TreeMap;
import java.util.concurrent.atomic.AtomicLong;
-import jline.internal.Log;
-
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.NamespaceNotFoundException;
@@ -34,11 +32,13 @@ import org.apache.accumulo.core.metadata.MetadataTable;
import org.apache.accumulo.core.metadata.RootTable;
import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.fate.zookeeper.ZooCache;
+import org.apache.log4j.Logger;
public class Tables {
private static SecurityPermission TABLES_PERMISSION = new SecurityPermission("tablesPermission");
private static AtomicLong cacheResetCount = new AtomicLong(0);
-
+ private static final Logger log = Logger.getLogger(Tables.class);
+
private static ZooCache getZooCache(Instance instance) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
@@ -46,14 +46,14 @@ public class Tables {
}
return ZooCache.getInstance(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut());
}
-
+
private static SortedMap<String,String> getMap(Instance instance, boolean nameAsKey) {
ZooCache zc = getZooCache(instance);
-
+
List<String> tableIds = zc.getChildren(ZooUtil.getRoot(instance) + Constants.ZTABLES);
-
+
TreeMap<String,String> tableMap = new TreeMap<String,String>();
-
+
for (String tableId : tableIds) {
byte[] tblPath = zc.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_NAME);
byte[] nId = zc.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_NAMESPACE);
@@ -65,7 +65,7 @@ public class Tables {
try {
name += Namespaces.getNamespaceName(instance, namespaceId) + ".";
} catch (NamespaceNotFoundException e) {
- Log.error("Table (" + tableId + ") contains reference to namespace (" + namespaceId + ") that doesn't exist");
+ log.error("Table (" + tableId + ") contains reference to namespace (" + namespaceId + ") that doesn't exist");
continue;
}
}
@@ -78,54 +78,54 @@ public class Tables {
tableMap.put(tableId, name);
}
}
-
+
return tableMap;
}
-
+
public static String getTableId(Instance instance, String tableName) throws TableNotFoundException {
String tableId = getNameToIdMap(instance).get(tableName);
if (tableId == null)
throw new TableNotFoundException(tableId, tableName, null);
return tableId;
}
-
+
public static String getTableName(Instance instance, String tableId) throws TableNotFoundException {
String tableName = getIdToNameMap(instance).get(tableId);
if (tableName == null)
throw new TableNotFoundException(tableId, tableName, null);
return tableName;
}
-
+
public static SortedMap<String,String> getNameToIdMap(Instance instance) {
return getMap(instance, true);
}
-
+
public static SortedMap<String,String> getIdToNameMap(Instance instance) {
return getMap(instance, false);
}
-
+
public static boolean exists(Instance instance, String tableId) {
ZooCache zc = getZooCache(instance);
List<String> tableIds = zc.getChildren(ZooUtil.getRoot(instance) + Constants.ZTABLES);
return tableIds.contains(tableId);
}
-
+
public static void clearCache(Instance instance) {
cacheResetCount.incrementAndGet();
getZooCache(instance).clear(ZooUtil.getRoot(instance) + Constants.ZTABLES);
getZooCache(instance).clear(ZooUtil.getRoot(instance) + Constants.ZNAMESPACES);
}
-
+
public static String getPrintableTableNameFromId(Map<String,String> tidToNameMap, String tableId) {
String tableName = tidToNameMap.get(tableId);
return tableName == null ? "(ID:" + tableId + ")" : tableName;
}
-
+
public static String getPrintableTableIdFromName(Map<String,String> nameToIdMap, String tableName) {
String tableId = nameToIdMap.get(tableName);
return tableId == null ? "(NAME:" + tableName + ")" : tableId;
}
-
+
public static String getPrintableTableInfoFromId(Instance instance, String tableId) {
String tableName = null;
try {
@@ -135,7 +135,7 @@ public class Tables {
}
return tableName == null ? String.format("?(ID:%s)", tableId) : String.format("%s(ID:%s)", tableName, tableId);
}
-
+
public static String getPrintableTableInfoFromName(Instance instance, String tableName) {
String tableId = null;
try {
@@ -145,17 +145,17 @@ public class Tables {
}
return tableId == null ? String.format("%s(?)", tableName) : String.format("%s(ID:%s)", tableName, tableId);
}
-
+
public static TableState getTableState(Instance instance, String tableId) {
String statePath = ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_STATE;
ZooCache zc = getZooCache(instance);
byte[] state = zc.get(statePath);
if (state == null)
return TableState.UNKNOWN;
-
+
return TableState.valueOf(new String(state));
}
-
+
public static long getCacheResetCount() {
return cacheResetCount.get();
}
@@ -170,7 +170,7 @@ public class Tables {
return Constants.DEFAULT_NAMESPACE;
}
}
-
+
public static String extractTableName(String tableName) {
String[] s = tableName.split("\\.");
if (s.length == 2 && !s[1].isEmpty() && !s[0].isEmpty()) {
@@ -179,7 +179,7 @@ public class Tables {
return tableName;
}
}
-
+
public static String getNamespace(Instance instance, String tableId) {
ZooCache zc = getZooCache(instance);
byte[] n = zc.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_NAMESPACE);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/3c920943/core/src/main/java/org/apache/accumulo/core/client/mock/MockNamespaceOperations.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/MockNamespaceOperations.java b/core/src/main/java/org/apache/accumulo/core/client/mock/MockNamespaceOperations.java
index fc76daa..5719317 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockNamespaceOperations.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockNamespaceOperations.java
@@ -16,9 +16,7 @@
*/
package org.apache.accumulo.core.client.mock;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.SortedSet;
@@ -30,10 +28,7 @@ import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.NamespaceExistsException;
import org.apache.accumulo.core.client.NamespaceNotEmptyException;
import org.apache.accumulo.core.client.NamespaceNotFoundException;
-import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.client.admin.DiskUsage;
import org.apache.accumulo.core.client.admin.NamespaceOperationsHelper;
-import org.apache.accumulo.core.client.admin.TimeType;
import org.apache.accumulo.core.client.impl.Tables;
import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
@@ -53,57 +48,25 @@ public class MockNamespaceOperations extends NamespaceOperationsHelper {
}
@Override
- public boolean exists(String tableName) {
- return acu.namespaces.containsKey(tableName);
+ public boolean exists(String namespace) {
+ return acu.namespaces.containsKey(namespace);
}
@Override
- public void create(String tableName) throws AccumuloException, AccumuloSecurityException, NamespaceExistsException {
- create(tableName, true, TimeType.MILLIS);
- }
-
- @Override
- public void create(String tableName, boolean versioningIter) throws AccumuloException, AccumuloSecurityException, NamespaceExistsException {
- create(tableName, versioningIter, TimeType.MILLIS);
- }
-
- @Override
- public void create(String namespace, boolean versioningIter, TimeType timeType) throws AccumuloException, AccumuloSecurityException,
- NamespaceExistsException {
- if (!namespace.matches(Constants.VALID_NAMESPACE_REGEX)) {
+ public void create(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceExistsException {
+ if (!namespace.matches(Constants.VALID_NAMESPACE_REGEX))
throw new IllegalArgumentException();
- }
if (exists(namespace))
throw new NamespaceExistsException(namespace, namespace, "");
-
- if (!exists(namespace)) {
+ else
acu.createNamespace(username, namespace);
- }
- acu.createTable(username, namespace, versioningIter, timeType);
}
@Override
- public void delete(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException, NamespaceNotEmptyException,
- TableNotFoundException {
- delete(namespace, false);
- }
-
- @Override
- public void delete(String namespace, boolean deleteTables) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException,
- NamespaceNotEmptyException, TableNotFoundException {
- if (!exists(namespace))
- throw new NamespaceNotFoundException(namespace, namespace, "");
-
- MockNamespace n = acu.namespaces.get(namespace);
- if (!deleteTables) {
- if (n.getTables(acu).size() > 0) {
- throw new NamespaceNotEmptyException(null, namespace, null);
- }
- } else {
- for (String t : n.getTables(acu)) {
- new MockTableOperations(acu, username).delete(t);
- }
+ public void delete(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException, NamespaceNotEmptyException {
+ if (acu.namespaces.get(namespace).getTables(acu).size() > 0) {
+ throw new NamespaceNotEmptyException(null, namespace, null);
}
acu.namespaces.remove(namespace);
}
@@ -144,18 +107,6 @@ public class MockNamespaceOperations extends NamespaceOperationsHelper {
}
@Override
- public void offline(String namespace) throws AccumuloSecurityException, AccumuloException, NamespaceNotFoundException {
- if (!exists(namespace))
- throw new NamespaceNotFoundException(namespace, namespace, "");
- }
-
- @Override
- public void online(String namespace) throws AccumuloSecurityException, AccumuloException, NamespaceNotFoundException {
- if (!exists(namespace))
- throw new NamespaceNotFoundException(namespace, namespace, "");
- }
-
- @Override
public Map<String,String> namespaceIdMap() {
Map<String,String> result = new HashMap<String,String>();
for (String table : acu.tables.keySet()) {
@@ -165,15 +116,6 @@ public class MockNamespaceOperations extends NamespaceOperationsHelper {
}
@Override
- public List<DiskUsage> getDiskUsage(String namespace) throws AccumuloException, AccumuloSecurityException {
-
- List<DiskUsage> diskUsages = new ArrayList<DiskUsage>();
- diskUsages.add(new DiskUsage(new TreeSet<String>(acu.namespaces.get(namespace).getTables(acu)), 0l));
-
- return diskUsages;
- }
-
- @Override
public boolean testClassLoad(String namespace, String className, String asTypeName) throws AccumuloException, AccumuloSecurityException,
NamespaceNotFoundException {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/3c920943/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteNamespaceCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteNamespaceCommand.java b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteNamespaceCommand.java
index 26473ed..756e85d 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteNamespaceCommand.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DeleteNamespaceCommand.java
@@ -69,11 +69,12 @@ public class DeleteNamespaceCommand extends Command {
List<String> tables = Namespaces.getTableNames(shellState.getInstance(), namespaceId);
resetContext = tables.contains(currentTable);
- if (force) {
- shellState.getConnector().namespaceOperations().delete(namespace, true);
- } else {
- shellState.getConnector().namespaceOperations().delete(namespace);
- }
+ if (force)
+ for (String table : shellState.getConnector().tableOperations().list())
+ if (table.startsWith(namespace + "."))
+ shellState.getConnector().tableOperations().delete(table);
+
+ shellState.getConnector().namespaceOperations().delete(namespace);
if (namespace.equals(Constants.SYSTEM_NAMESPACE)) {
shellState.getReader().println("Namespace: [" + namespace + "], can't delete system or default namespace.");
} else {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/3c920943/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OptUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OptUtil.java b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OptUtil.java
index 24b6b9d..9915bdf 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OptUtil.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OptUtil.java
@@ -18,6 +18,8 @@ package org.apache.accumulo.core.util.shell.commands;
import java.io.UnsupportedEncodingException;
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.NamespaceNotFoundException;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.util.shell.Shell;
@@ -46,7 +48,8 @@ public abstract class OptUtil {
return tableName;
}
- public static String getNamespaceOpt(final CommandLine cl, final Shell shellState) throws NamespaceNotFoundException {
+ public static String getNamespaceOpt(final CommandLine cl, final Shell shellState) throws NamespaceNotFoundException, AccumuloException,
+ AccumuloSecurityException {
String namespace = null;
if (cl.hasOption(Shell.namespaceOption)) {
namespace = cl.getOptionValue(Shell.namespaceOption);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/3c920943/core/src/test/java/org/apache/accumulo/core/client/mock/MockNamespacesTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mock/MockNamespacesTest.java b/core/src/test/java/org/apache/accumulo/core/client/mock/MockNamespacesTest.java
index cbca7c3..ad03551 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mock/MockNamespacesTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mock/MockNamespacesTest.java
@@ -27,6 +27,7 @@ import java.util.Random;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.BatchWriter;
import org.apache.accumulo.core.client.BatchWriterConfig;
import org.apache.accumulo.core.client.Connector;
@@ -293,7 +294,8 @@ public class MockNamespacesTest {
return false;
}
- private boolean checkNamespaceHasProp(Connector c, String n, String propKey, String propVal) throws AccumuloException, NamespaceNotFoundException {
+ private boolean checkNamespaceHasProp(Connector c, String n, String propKey, String propVal) throws AccumuloException, NamespaceNotFoundException,
+ AccumuloSecurityException {
for (Entry<String,String> e : c.namespaceOperations().getProperties(n)) {
if (e.getKey().equals(propKey) && e.getValue().equals(propVal)) {
return true;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/3c920943/server/base/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java b/server/base/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java
index f2a7ac8..29db1d8 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java
@@ -824,9 +824,4 @@ public class SecurityOperation {
|| hasSystemPermission(credentials, SystemPermission.ALTER_NAMESPACE, false);
}
- public boolean canCloneNamespace(TCredentials credentials, String namespaceId, String namespace) throws ThriftSecurityException {
- authenticate(credentials);
- return hasNamespacePermission(credentials, namespaceId, NamespacePermission.READ, false)
- && hasSystemPermission(credentials, SystemPermission.CREATE_NAMESPACE, false);
- }
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/3c920943/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DeleteNamespace.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DeleteNamespace.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DeleteNamespace.java
index f7c813a..c31e6b5 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DeleteNamespace.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DeleteNamespace.java
@@ -39,7 +39,7 @@ public class DeleteNamespace extends Test {
String namespace = namespaces.get(rand.nextInt(namespaces.size()));
try {
- conn.namespaceOperations().delete(namespace, true);
+ conn.namespaceOperations().delete(namespace);
log.debug("Deleted namespace " + namespace);
} catch (NamespaceNotFoundException e) {
log.debug("Delete namespace " + namespace + " failed, doesnt exist");
http://git-wip-us.apache.org/repos/asf/accumulo/blob/3c920943/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/OfflineNamespace.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/OfflineNamespace.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/OfflineNamespace.java
deleted file mode 100644
index e689921..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/OfflineNamespace.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.test.randomwalk.concurrent;
-
-import java.util.List;
-import java.util.Properties;
-import java.util.Random;
-
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.NamespaceNotFoundException;
-import org.apache.accumulo.core.util.UtilWaitThread;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-
-public class OfflineNamespace extends Test {
-
- @Override
- public void visit(State state, Properties props) throws Exception {
- Connector conn = state.getConnector();
-
- Random rand = (Random) state.get("rand");
-
- @SuppressWarnings("unchecked")
- List<String> namespaces = (List<String>) state.get("namespaces");
-
- String namespace = namespaces.get(rand.nextInt(namespaces.size()));
-
- try {
- conn.namespaceOperations().offline(namespace);
- log.debug("Offlined namespace " + namespace);
- UtilWaitThread.sleep(rand.nextInt(200));
- conn.namespaceOperations().online(namespace);
- log.debug("Onlined namespace " + namespace);
- } catch (NamespaceNotFoundException tne) {
- log.debug("offline or online failed " + namespace + ", doesnt exist");
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/3c920943/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java b/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
index 5b7d11d..5695c51 100644
--- a/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
@@ -295,8 +295,8 @@ public class NamespacesIT {
assertTrue(checkTableHasProp(c, t2, propKey, propVal2));
- c.namespaceOperations().delete(n1, true);
- c.namespaceOperations().delete(n2, true);
+ c.namespaceOperations().delete(n1);
+ c.namespaceOperations().delete(n2);
}
/**
@@ -564,7 +564,8 @@ public class NamespacesIT {
return false;
}
- private boolean checkNamespaceHasProp(Connector c, String n, String propKey, String propVal) throws AccumuloException, NamespaceNotFoundException {
+ private boolean checkNamespaceHasProp(Connector c, String n, String propKey, String propVal) throws AccumuloException, NamespaceNotFoundException,
+ AccumuloSecurityException {
for (Entry<String,String> e : c.namespaceOperations().getProperties(n)) {
if (e.getKey().equals(propKey) && e.getValue().equals(propVal)) {
return true;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/3c920943/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java b/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
index f21dfd9..7951c80 100644
--- a/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
@@ -273,7 +273,7 @@ public class ShellServerIT extends SimpleMacIT {
shell.execCommand("du -h", false, false);
String o = output.get();
// for some reason, there's a bit of fluctuation
- assertTrue("Output did not match regex: '" + o + "'", o.matches(".*[1-9][0-9][0-9]\\s\\[t\\]\\n"));
+ assertTrue("Output did not match regex: '" + o + "'", o.matches(".*[1-9][0-9][0-9]\\s\\[t\\]\\n"));
exec("deletetable -f t");
}
@@ -784,12 +784,12 @@ public class ShellServerIT extends SimpleMacIT {
exec("config -t ptc -s " + Property.TABLE_CLASSPATH.getKey() + "=cx1", true);
UtilWaitThread.sleep(200);
-
- // We can't use the setiter command as Filter implements OptionDescriber which
+
+ // We can't use the setiter command as Filter implements OptionDescriber which
// forces us to enter more input that I don't know how to input
// Instead, we can just manually set the property on the table.
exec("config -t ptc -s " + Property.TABLE_ITERATOR_PREFIX.getKey() + "scan.foo=10,org.apache.accumulo.test.FooFilter");
-
+
exec("insert foo f q v", true);
UtilWaitThread.sleep(100);
@@ -804,7 +804,7 @@ public class ShellServerIT extends SimpleMacIT {
exec("table ptc", true);
exec("insert foo f q v", false);
exec("insert ok foo q v", true);
-
+
exec("deletetable -f ptc", true);
exec("config -d " + Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey() + "cx1");
@@ -850,60 +850,55 @@ public class ShellServerIT extends SimpleMacIT {
exec("y");
exec("namespaces", true, "thing2", true);
- exec("clonenamespace thing2 testers -e table.file.max", true);
- exec("namespaces", true, "testers", true);
- exec("tables", true, "testers.thingy", true);
- exec("clonenamespace thing2 testers2 -s table.file.max=42", true);
-
- exec("du -tn thing2", true, "thing2.thingy", true);
+ exec("du -ns thing2", true, "thing2.thingy", true);
// all "TableOperation" commands can take a namespace
- exec("offline -tn thing2", true);
- exec("online -tn thing2", true);
- exec("flush -tn thing2", true);
- exec("compact -tn thing2", true);
+ exec("offline -ns thing2", true);
+ exec("online -ns thing2", true);
+ exec("flush -ns thing2", true);
+ exec("compact -ns thing2", true);
exec("createnamespace testers3", true);
exec("createtable testers3.1", true);
exec("createtable testers3.2", true);
- exec("deletetable -tn testers3 -f", true);
+ exec("deletetable -ns testers3 -f", true);
exec("tables", true, "testers3.1", false);
exec("namespaces", true, "testers3", true);
exec("deletenamespace testers3 -f", true);
input.set("true\n\n\nSTRING\n");
- exec("setiter -tn thing2 -scan -class org.apache.accumulo.core.iterators.user.SummingCombiner -p 10 -n name", true);
- exec("listiter -tn thing2 -scan", true, "Summing", true);
- exec("deleteiter -tn thing2 -n name -scan", true);
+ exec("setiter -ns thing2 -scan -class org.apache.accumulo.core.iterators.user.SummingCombiner -p 10 -n name", true);
+ exec("listiter -ns thing2 -scan", true, "Summing", true);
+ exec("deleteiter -ns thing2 -n name -scan", true);
exec("createuser dude");
exec("pass");
exec("pass");
- exec("grant Namespace.CREATE_TABLE -tn thing2 -u dude", true);
- exec("revoke Namespace.CREATE_TABLE -tn thing2 -u dude", true);
+ exec("grant Namespace.CREATE_TABLE -ns thing2 -u dude", true);
+ exec("revoke Namespace.CREATE_TABLE -ns thing2 -u dude", true);
// properties override and such
- exec("config -tn thing2 -s table.file.max=44444", true);
- exec("config -tn thing2", true, "44444", true);
+ exec("config -ns thing2 -s table.file.max=44444", true);
+ exec("config -ns thing2", true, "44444", true);
exec("config -t thing2.thingy", true, "44444", true);
exec("config -t thing2.thingy -s table.file.max=55555", true);
exec("config -t thing2.thingy", true, "55555", true);
// can copy properties when creating
exec("createnamespace thing3 -cc thing2", true);
- exec("config -tn thing3", true, "44444", true);
+ exec("config -ns thing3", true, "44444", true);
exec("createnamespace thing4 -ctc thing2.thingy", true);
- exec("config -tn thing4", true, "55555", true);
+ exec("config -ns thing4", true, "55555", true);
exec("deletenamespace -f thing2", true);
exec("namespaces", true, "thing2", false);
exec("tables", true, "thing2.thingy", false);
// put constraints on a namespace
- exec("constraint -tn thing4 -a org.apache.accumulo.examples.simple.constraints.NumericValueConstraint", true);
+ exec("constraint -ns thing4 -a org.apache.accumulo.examples.simple.constraints.NumericValueConstraint", true);
exec("createtable thing4.constrained", true);
exec("table thing4.constrained", true);
// should fail
exec("insert r cf cq abc", false);
exec("constraint -l", true, "NumericValueConstraint", true);
- exec("constraint -tn thing4 -d 2");
+ exec("constraint -ns thing4 -d 1");
exec("sleep 1");
exec("insert r cf cq abc", true);
}