You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2015/05/04 19:36:18 UTC

[1/6] accumulo git commit: ACCUMULO-3354 call deleteRows on offline table contains table name in TableOfflineException

Repository: accumulo
Updated Branches:
  refs/heads/1.6 bbcc6da44 -> a506c0bed
  refs/heads/1.7 2436eec23 -> 12366d4e6
  refs/heads/master 87af7f6d8 -> 5e15913d9


ACCUMULO-3354 call deleteRows on offline table contains table name in TableOfflineException

TableOperationsImpl.doFateOperation(...) is the only method that passed an explicitly null tableId to
the TableOfflineException constructor. Now checks the table's tableId and passes that to the
exception constructor.

Refactored doFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts, boolean wait)
to doFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts,
String tableOrNamespaceName, boolean wait). The table/namespace name is then pushed down explicitly.

Signed-off-by: Josh Elser <el...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/a506c0be
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/a506c0be
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/a506c0be

Branch: refs/heads/1.6
Commit: a506c0bedb5a6b5794e995b68a7710bd8bfb69eb
Parents: bbcc6da
Author: Jacob Meisler <ja...@gmail.com>
Authored: Tue Apr 28 20:42:17 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Mon May 4 11:41:22 2015 -0400

----------------------------------------------------------------------
 .../client/impl/NamespaceOperationsImpl.java    | 11 +++----
 .../core/client/impl/TableOperationsImpl.java   | 30 +++++++++-----------
 2 files changed, 20 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/a506c0be/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
index 19bc232..9a66fef 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
@@ -90,7 +90,8 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
     ArgumentChecker.notNull(namespace);
 
     try {
-      doNamespaceFateOperation(FateOperation.NAMESPACE_CREATE, Arrays.asList(ByteBuffer.wrap(namespace.getBytes())), Collections.<String,String> emptyMap());
+      doNamespaceFateOperation(FateOperation.NAMESPACE_CREATE, Arrays.asList(ByteBuffer.wrap(namespace.getBytes())), Collections.<String,String> emptyMap(),
+          namespace);
     } catch (NamespaceNotFoundException e) {
       // should not happen
       throw new AssertionError(e);
@@ -115,7 +116,7 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
     Map<String,String> opts = new HashMap<String,String>();
 
     try {
-      doNamespaceFateOperation(FateOperation.NAMESPACE_DELETE, args, opts);
+      doNamespaceFateOperation(FateOperation.NAMESPACE_DELETE, args, opts, namespace);
     } catch (NamespaceExistsException e) {
       // should not happen
       throw new AssertionError(e);
@@ -129,7 +130,7 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
 
     List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(oldNamespaceName.getBytes()), ByteBuffer.wrap(newNamespaceName.getBytes()));
     Map<String,String> opts = new HashMap<String,String>();
-    doNamespaceFateOperation(FateOperation.NAMESPACE_RENAME, args, opts);
+    doNamespaceFateOperation(FateOperation.NAMESPACE_RENAME, args, opts, oldNamespaceName);
   }
 
   @Override
@@ -229,10 +230,10 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
     return super.addConstraint(namespace, constraintClassName);
   }
 
-  private String doNamespaceFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts) throws AccumuloSecurityException,
+  private String doNamespaceFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts, String namespace) throws AccumuloSecurityException,
       AccumuloException, NamespaceExistsException, NamespaceNotFoundException {
     try {
-      return tableOps.doFateOperation(op, args, opts);
+      return tableOps.doFateOperation(op, args, opts, namespace);
     } catch (TableExistsException e) {
       // should not happen
       throw new AssertionError(e);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a506c0be/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
index 75dda1f..6e6ca19 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
@@ -95,7 +95,6 @@ import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException;
 import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
 import org.apache.accumulo.core.util.ArgumentChecker;
-import org.apache.accumulo.core.util.ByteBufferUtil;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.core.util.LocalityGroupUtil;
 import org.apache.accumulo.core.util.MapCounter;
@@ -290,13 +289,13 @@ public class TableOperationsImpl extends TableOperationsHelper {
     }
   }
 
-  String doFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts) throws AccumuloSecurityException, TableExistsException,
-      TableNotFoundException, AccumuloException, NamespaceExistsException, NamespaceNotFoundException {
-    return doFateOperation(op, args, opts, true);
+  String doFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts, String tableOrNamespaceName) throws AccumuloSecurityException,
+      TableExistsException, TableNotFoundException, AccumuloException, NamespaceExistsException, NamespaceNotFoundException {
+    return doFateOperation(op, args, opts, tableOrNamespaceName, true);
   }
 
-  String doFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts, boolean wait) throws AccumuloSecurityException,
-      TableExistsException, TableNotFoundException, AccumuloException, NamespaceExistsException, NamespaceNotFoundException {
+  String doFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts, String tableOrNamespaceName, boolean wait)
+      throws AccumuloSecurityException, TableExistsException, TableNotFoundException, AccumuloException, NamespaceExistsException, NamespaceNotFoundException {
     Long opid = null;
 
     try {
@@ -309,14 +308,13 @@ public class TableOperationsImpl extends TableOperationsHelper {
       String ret = waitForFateOperation(opid);
       return ret;
     } catch (ThriftSecurityException e) {
-      String tableName = ByteBufferUtil.toString(args.get(0));
       switch (e.getCode()) {
         case TABLE_DOESNT_EXIST:
-          throw new TableNotFoundException(null, tableName, "Target table does not exist");
+          throw new TableNotFoundException(null, tableOrNamespaceName, "Target table does not exist");
         case NAMESPACE_DOESNT_EXIST:
-          throw new NamespaceNotFoundException(null, tableName, "Target namespace does not exist");
+          throw new NamespaceNotFoundException(null, tableOrNamespaceName, "Target namespace does not exist");
         default:
-          String tableInfo = Tables.getPrintableTableInfoFromName(instance, tableName);
+          String tableInfo = Tables.getPrintableTableInfoFromName(instance, tableOrNamespaceName);
           throw new AccumuloSecurityException(e.user, e.code, tableInfo, e);
       }
     } catch (ThriftTableOperationException e) {
@@ -330,7 +328,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
         case NAMESPACE_NOTFOUND:
           throw new NamespaceNotFoundException(e);
         case OFFLINE:
-          throw new TableOfflineException(instance, null);
+          throw new TableOfflineException(instance, Tables.getTableId(instance, tableOrNamespaceName));
         default:
           throw new AccumuloException(e.description, e);
       }
@@ -796,7 +794,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
 
     Map<String,String> opts = new HashMap<String,String>();
     try {
-      doFateOperation(FateOperation.TABLE_COMPACT, args, opts, wait);
+      doFateOperation(FateOperation.TABLE_COMPACT, args, opts, tableName, wait);
     } catch (TableExistsException e) {
       // should not happen
       throw new AssertionError(e);
@@ -1588,10 +1586,10 @@ public class TableOperationsImpl extends TableOperationsHelper {
     return super.addConstraint(tableName, constraintClassName);
   }
 
-  private void doTableFateOperation(String tableName, Class<? extends Exception> namespaceNotFoundExceptionClass, FateOperation op, List<ByteBuffer> args,
-      Map<String,String> opts) throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException {
+  private void doTableFateOperation(String tableOrNamespaceName, Class<? extends Exception> namespaceNotFoundExceptionClass, FateOperation op,
+      List<ByteBuffer> args, Map<String,String> opts) throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException {
     try {
-      doFateOperation(op, args, opts);
+      doFateOperation(op, args, opts, tableOrNamespaceName);
     } catch (NamespaceExistsException e) {
       // should not happen
       throw new AssertionError(e);
@@ -1602,7 +1600,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
       } else if (AccumuloException.class.isAssignableFrom(namespaceNotFoundExceptionClass)) {
         throw new AccumuloException("Cannot create table in non-existent namespace", e);
       } else if (TableNotFoundException.class.isAssignableFrom(namespaceNotFoundExceptionClass)) {
-        throw new TableNotFoundException(null, tableName, "Namespace not found", e);
+        throw new TableNotFoundException(null, tableOrNamespaceName, "Namespace not found", e);
       } else {
         // should not happen
         throw new AssertionError(e);


[6/6] accumulo git commit: Merge branch '1.7'

Posted by el...@apache.org.
Merge branch '1.7'


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/5e15913d
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/5e15913d
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/5e15913d

Branch: refs/heads/master
Commit: 5e15913d9739c2005aeb893424821583eb4dd977
Parents: 87af7f6 12366d4
Author: Josh Elser <el...@apache.org>
Authored: Mon May 4 12:56:40 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Mon May 4 12:56:40 2015 -0400

----------------------------------------------------------------------
 .../client/impl/NamespaceOperationsImpl.java    | 10 +++----
 .../core/client/impl/TableOperationsImpl.java   | 30 +++++++++-----------
 2 files changed, 19 insertions(+), 21 deletions(-)
----------------------------------------------------------------------



[2/6] accumulo git commit: ACCUMULO-3354 call deleteRows on offline table contains table name in TableOfflineException

Posted by el...@apache.org.
ACCUMULO-3354 call deleteRows on offline table contains table name in TableOfflineException

TableOperationsImpl.doFateOperation(...) is the only method that passed an explicitly null tableId to
the TableOfflineException constructor. Now checks the table's tableId and passes that to the
exception constructor.

Refactored doFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts, boolean wait)
to doFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts,
String tableOrNamespaceName, boolean wait). The table/namespace name is then pushed down explicitly.

Signed-off-by: Josh Elser <el...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/a506c0be
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/a506c0be
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/a506c0be

Branch: refs/heads/1.7
Commit: a506c0bedb5a6b5794e995b68a7710bd8bfb69eb
Parents: bbcc6da
Author: Jacob Meisler <ja...@gmail.com>
Authored: Tue Apr 28 20:42:17 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Mon May 4 11:41:22 2015 -0400

----------------------------------------------------------------------
 .../client/impl/NamespaceOperationsImpl.java    | 11 +++----
 .../core/client/impl/TableOperationsImpl.java   | 30 +++++++++-----------
 2 files changed, 20 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/a506c0be/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
index 19bc232..9a66fef 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
@@ -90,7 +90,8 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
     ArgumentChecker.notNull(namespace);
 
     try {
-      doNamespaceFateOperation(FateOperation.NAMESPACE_CREATE, Arrays.asList(ByteBuffer.wrap(namespace.getBytes())), Collections.<String,String> emptyMap());
+      doNamespaceFateOperation(FateOperation.NAMESPACE_CREATE, Arrays.asList(ByteBuffer.wrap(namespace.getBytes())), Collections.<String,String> emptyMap(),
+          namespace);
     } catch (NamespaceNotFoundException e) {
       // should not happen
       throw new AssertionError(e);
@@ -115,7 +116,7 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
     Map<String,String> opts = new HashMap<String,String>();
 
     try {
-      doNamespaceFateOperation(FateOperation.NAMESPACE_DELETE, args, opts);
+      doNamespaceFateOperation(FateOperation.NAMESPACE_DELETE, args, opts, namespace);
     } catch (NamespaceExistsException e) {
       // should not happen
       throw new AssertionError(e);
@@ -129,7 +130,7 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
 
     List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(oldNamespaceName.getBytes()), ByteBuffer.wrap(newNamespaceName.getBytes()));
     Map<String,String> opts = new HashMap<String,String>();
-    doNamespaceFateOperation(FateOperation.NAMESPACE_RENAME, args, opts);
+    doNamespaceFateOperation(FateOperation.NAMESPACE_RENAME, args, opts, oldNamespaceName);
   }
 
   @Override
@@ -229,10 +230,10 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
     return super.addConstraint(namespace, constraintClassName);
   }
 
-  private String doNamespaceFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts) throws AccumuloSecurityException,
+  private String doNamespaceFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts, String namespace) throws AccumuloSecurityException,
       AccumuloException, NamespaceExistsException, NamespaceNotFoundException {
     try {
-      return tableOps.doFateOperation(op, args, opts);
+      return tableOps.doFateOperation(op, args, opts, namespace);
     } catch (TableExistsException e) {
       // should not happen
       throw new AssertionError(e);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a506c0be/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
index 75dda1f..6e6ca19 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
@@ -95,7 +95,6 @@ import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException;
 import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
 import org.apache.accumulo.core.util.ArgumentChecker;
-import org.apache.accumulo.core.util.ByteBufferUtil;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.core.util.LocalityGroupUtil;
 import org.apache.accumulo.core.util.MapCounter;
@@ -290,13 +289,13 @@ public class TableOperationsImpl extends TableOperationsHelper {
     }
   }
 
-  String doFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts) throws AccumuloSecurityException, TableExistsException,
-      TableNotFoundException, AccumuloException, NamespaceExistsException, NamespaceNotFoundException {
-    return doFateOperation(op, args, opts, true);
+  String doFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts, String tableOrNamespaceName) throws AccumuloSecurityException,
+      TableExistsException, TableNotFoundException, AccumuloException, NamespaceExistsException, NamespaceNotFoundException {
+    return doFateOperation(op, args, opts, tableOrNamespaceName, true);
   }
 
-  String doFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts, boolean wait) throws AccumuloSecurityException,
-      TableExistsException, TableNotFoundException, AccumuloException, NamespaceExistsException, NamespaceNotFoundException {
+  String doFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts, String tableOrNamespaceName, boolean wait)
+      throws AccumuloSecurityException, TableExistsException, TableNotFoundException, AccumuloException, NamespaceExistsException, NamespaceNotFoundException {
     Long opid = null;
 
     try {
@@ -309,14 +308,13 @@ public class TableOperationsImpl extends TableOperationsHelper {
       String ret = waitForFateOperation(opid);
       return ret;
     } catch (ThriftSecurityException e) {
-      String tableName = ByteBufferUtil.toString(args.get(0));
       switch (e.getCode()) {
         case TABLE_DOESNT_EXIST:
-          throw new TableNotFoundException(null, tableName, "Target table does not exist");
+          throw new TableNotFoundException(null, tableOrNamespaceName, "Target table does not exist");
         case NAMESPACE_DOESNT_EXIST:
-          throw new NamespaceNotFoundException(null, tableName, "Target namespace does not exist");
+          throw new NamespaceNotFoundException(null, tableOrNamespaceName, "Target namespace does not exist");
         default:
-          String tableInfo = Tables.getPrintableTableInfoFromName(instance, tableName);
+          String tableInfo = Tables.getPrintableTableInfoFromName(instance, tableOrNamespaceName);
           throw new AccumuloSecurityException(e.user, e.code, tableInfo, e);
       }
     } catch (ThriftTableOperationException e) {
@@ -330,7 +328,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
         case NAMESPACE_NOTFOUND:
           throw new NamespaceNotFoundException(e);
         case OFFLINE:
-          throw new TableOfflineException(instance, null);
+          throw new TableOfflineException(instance, Tables.getTableId(instance, tableOrNamespaceName));
         default:
           throw new AccumuloException(e.description, e);
       }
@@ -796,7 +794,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
 
     Map<String,String> opts = new HashMap<String,String>();
     try {
-      doFateOperation(FateOperation.TABLE_COMPACT, args, opts, wait);
+      doFateOperation(FateOperation.TABLE_COMPACT, args, opts, tableName, wait);
     } catch (TableExistsException e) {
       // should not happen
       throw new AssertionError(e);
@@ -1588,10 +1586,10 @@ public class TableOperationsImpl extends TableOperationsHelper {
     return super.addConstraint(tableName, constraintClassName);
   }
 
-  private void doTableFateOperation(String tableName, Class<? extends Exception> namespaceNotFoundExceptionClass, FateOperation op, List<ByteBuffer> args,
-      Map<String,String> opts) throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException {
+  private void doTableFateOperation(String tableOrNamespaceName, Class<? extends Exception> namespaceNotFoundExceptionClass, FateOperation op,
+      List<ByteBuffer> args, Map<String,String> opts) throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException {
     try {
-      doFateOperation(op, args, opts);
+      doFateOperation(op, args, opts, tableOrNamespaceName);
     } catch (NamespaceExistsException e) {
       // should not happen
       throw new AssertionError(e);
@@ -1602,7 +1600,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
       } else if (AccumuloException.class.isAssignableFrom(namespaceNotFoundExceptionClass)) {
         throw new AccumuloException("Cannot create table in non-existent namespace", e);
       } else if (TableNotFoundException.class.isAssignableFrom(namespaceNotFoundExceptionClass)) {
-        throw new TableNotFoundException(null, tableName, "Namespace not found", e);
+        throw new TableNotFoundException(null, tableOrNamespaceName, "Namespace not found", e);
       } else {
         // should not happen
         throw new AssertionError(e);


[4/6] accumulo git commit: Merge branch '1.6' into 1.7

Posted by el...@apache.org.
Merge branch '1.6' into 1.7

Conflicts:
	core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
	core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/12366d4e
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/12366d4e
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/12366d4e

Branch: refs/heads/master
Commit: 12366d4e672a004e9324adc87d4e94907530a770
Parents: 2436eec a506c0b
Author: Josh Elser <el...@apache.org>
Authored: Mon May 4 12:08:09 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Mon May 4 12:27:51 2015 -0400

----------------------------------------------------------------------
 .../client/impl/NamespaceOperationsImpl.java    | 10 +++----
 .../core/client/impl/TableOperationsImpl.java   | 30 +++++++++-----------
 2 files changed, 19 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/12366d4e/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
index ce6bc09,9a66fef..b087c73
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
@@@ -85,11 -87,11 +85,11 @@@ public class NamespaceOperationsImpl ex
  
    @Override
    public void create(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceExistsException {
 -    ArgumentChecker.notNull(namespace);
 +    checkArgument(namespace != null, "namespace is null");
  
      try {
 -      doNamespaceFateOperation(FateOperation.NAMESPACE_CREATE, Arrays.asList(ByteBuffer.wrap(namespace.getBytes())), Collections.<String,String> emptyMap(),
 -          namespace);
 +      doNamespaceFateOperation(FateOperation.NAMESPACE_CREATE, Arrays.asList(ByteBuffer.wrap(namespace.getBytes(UTF_8))),
-           Collections.<String,String> emptyMap());
++          Collections.<String,String> emptyMap(), namespace);
      } catch (NamespaceNotFoundException e) {
        // should not happen
        throw new AssertionError(e);
@@@ -127,9 -128,9 +127,9 @@@
    public void rename(String oldNamespaceName, String newNamespaceName) throws AccumuloSecurityException, NamespaceNotFoundException, AccumuloException,
        NamespaceExistsException {
  
 -    List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(oldNamespaceName.getBytes()), ByteBuffer.wrap(newNamespaceName.getBytes()));
 +    List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(oldNamespaceName.getBytes(UTF_8)), ByteBuffer.wrap(newNamespaceName.getBytes(UTF_8)));
      Map<String,String> opts = new HashMap<String,String>();
-     doNamespaceFateOperation(FateOperation.NAMESPACE_RENAME, args, opts);
+     doNamespaceFateOperation(FateOperation.NAMESPACE_RENAME, args, opts, oldNamespaceName);
    }
  
    @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/12366d4e/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
index 0e30d52,6e6ca19..6f9ea29
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
@@@ -92,12 -90,11 +92,11 @@@ import org.apache.accumulo.core.metadat
  import org.apache.accumulo.core.metadata.MetadataTable;
  import org.apache.accumulo.core.metadata.RootTable;
  import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
 +import org.apache.accumulo.core.rpc.ThriftUtil;
  import org.apache.accumulo.core.security.Authorizations;
 -import org.apache.accumulo.core.security.Credentials;
  import org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException;
  import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
 -import org.apache.accumulo.core.util.ArgumentChecker;
 +import org.apache.accumulo.core.trace.Tracer;
- import org.apache.accumulo.core.util.ByteBufferUtil;
  import org.apache.accumulo.core.util.CachedConfiguration;
  import org.apache.accumulo.core.util.LocalityGroupUtil;
  import org.apache.accumulo.core.util.MapCounter;
@@@ -276,14 -308,13 +275,13 @@@ public class TableOperationsImpl extend
        String ret = waitForFateOperation(opid);
        return ret;
      } catch (ThriftSecurityException e) {
-       String tableName = ByteBufferUtil.toString(args.get(0));
        switch (e.getCode()) {
          case TABLE_DOESNT_EXIST:
-           throw new TableNotFoundException(null, tableName, "Target table does not exist");
+           throw new TableNotFoundException(null, tableOrNamespaceName, "Target table does not exist");
          case NAMESPACE_DOESNT_EXIST:
-           throw new NamespaceNotFoundException(null, tableName, "Target namespace does not exist");
+           throw new NamespaceNotFoundException(null, tableOrNamespaceName, "Target namespace does not exist");
          default:
-           String tableInfo = Tables.getPrintableTableInfoFromName(context.getInstance(), tableName);
 -          String tableInfo = Tables.getPrintableTableInfoFromName(instance, tableOrNamespaceName);
++          String tableInfo = Tables.getPrintableTableInfoFromName(context.getInstance(), tableOrNamespaceName);
            throw new AccumuloSecurityException(e.user, e.code, tableInfo, e);
        }
      } catch (ThriftTableOperationException e) {
@@@ -297,7 -328,7 +295,7 @@@
          case NAMESPACE_NOTFOUND:
            throw new NamespaceNotFoundException(e);
          case OFFLINE:
-           throw new TableOfflineException(context.getInstance(), null);
 -          throw new TableOfflineException(instance, Tables.getTableId(instance, tableOrNamespaceName));
++          throw new TableOfflineException(context.getInstance(), Tables.getTableId(context.getInstance(), tableOrNamespaceName));
          default:
            throw new AccumuloException(e.description, e);
        }
@@@ -727,7 -794,7 +725,7 @@@
  
      Map<String,String> opts = new HashMap<String,String>();
      try {
-       doFateOperation(FateOperation.TABLE_COMPACT, args, opts, config.getWait());
 -      doFateOperation(FateOperation.TABLE_COMPACT, args, opts, tableName, wait);
++      doFateOperation(FateOperation.TABLE_COMPACT, args, opts, tableName, config.getWait());
      } catch (TableExistsException e) {
        // should not happen
        throw new AssertionError(e);


[5/6] accumulo git commit: Merge branch '1.6' into 1.7

Posted by el...@apache.org.
Merge branch '1.6' into 1.7

Conflicts:
	core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
	core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/12366d4e
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/12366d4e
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/12366d4e

Branch: refs/heads/1.7
Commit: 12366d4e672a004e9324adc87d4e94907530a770
Parents: 2436eec a506c0b
Author: Josh Elser <el...@apache.org>
Authored: Mon May 4 12:08:09 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Mon May 4 12:27:51 2015 -0400

----------------------------------------------------------------------
 .../client/impl/NamespaceOperationsImpl.java    | 10 +++----
 .../core/client/impl/TableOperationsImpl.java   | 30 +++++++++-----------
 2 files changed, 19 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/12366d4e/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
index ce6bc09,9a66fef..b087c73
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
@@@ -85,11 -87,11 +85,11 @@@ public class NamespaceOperationsImpl ex
  
    @Override
    public void create(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceExistsException {
 -    ArgumentChecker.notNull(namespace);
 +    checkArgument(namespace != null, "namespace is null");
  
      try {
 -      doNamespaceFateOperation(FateOperation.NAMESPACE_CREATE, Arrays.asList(ByteBuffer.wrap(namespace.getBytes())), Collections.<String,String> emptyMap(),
 -          namespace);
 +      doNamespaceFateOperation(FateOperation.NAMESPACE_CREATE, Arrays.asList(ByteBuffer.wrap(namespace.getBytes(UTF_8))),
-           Collections.<String,String> emptyMap());
++          Collections.<String,String> emptyMap(), namespace);
      } catch (NamespaceNotFoundException e) {
        // should not happen
        throw new AssertionError(e);
@@@ -127,9 -128,9 +127,9 @@@
    public void rename(String oldNamespaceName, String newNamespaceName) throws AccumuloSecurityException, NamespaceNotFoundException, AccumuloException,
        NamespaceExistsException {
  
 -    List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(oldNamespaceName.getBytes()), ByteBuffer.wrap(newNamespaceName.getBytes()));
 +    List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(oldNamespaceName.getBytes(UTF_8)), ByteBuffer.wrap(newNamespaceName.getBytes(UTF_8)));
      Map<String,String> opts = new HashMap<String,String>();
-     doNamespaceFateOperation(FateOperation.NAMESPACE_RENAME, args, opts);
+     doNamespaceFateOperation(FateOperation.NAMESPACE_RENAME, args, opts, oldNamespaceName);
    }
  
    @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/12366d4e/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
index 0e30d52,6e6ca19..6f9ea29
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
@@@ -92,12 -90,11 +92,11 @@@ import org.apache.accumulo.core.metadat
  import org.apache.accumulo.core.metadata.MetadataTable;
  import org.apache.accumulo.core.metadata.RootTable;
  import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
 +import org.apache.accumulo.core.rpc.ThriftUtil;
  import org.apache.accumulo.core.security.Authorizations;
 -import org.apache.accumulo.core.security.Credentials;
  import org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException;
  import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
 -import org.apache.accumulo.core.util.ArgumentChecker;
 +import org.apache.accumulo.core.trace.Tracer;
- import org.apache.accumulo.core.util.ByteBufferUtil;
  import org.apache.accumulo.core.util.CachedConfiguration;
  import org.apache.accumulo.core.util.LocalityGroupUtil;
  import org.apache.accumulo.core.util.MapCounter;
@@@ -276,14 -308,13 +275,13 @@@ public class TableOperationsImpl extend
        String ret = waitForFateOperation(opid);
        return ret;
      } catch (ThriftSecurityException e) {
-       String tableName = ByteBufferUtil.toString(args.get(0));
        switch (e.getCode()) {
          case TABLE_DOESNT_EXIST:
-           throw new TableNotFoundException(null, tableName, "Target table does not exist");
+           throw new TableNotFoundException(null, tableOrNamespaceName, "Target table does not exist");
          case NAMESPACE_DOESNT_EXIST:
-           throw new NamespaceNotFoundException(null, tableName, "Target namespace does not exist");
+           throw new NamespaceNotFoundException(null, tableOrNamespaceName, "Target namespace does not exist");
          default:
-           String tableInfo = Tables.getPrintableTableInfoFromName(context.getInstance(), tableName);
 -          String tableInfo = Tables.getPrintableTableInfoFromName(instance, tableOrNamespaceName);
++          String tableInfo = Tables.getPrintableTableInfoFromName(context.getInstance(), tableOrNamespaceName);
            throw new AccumuloSecurityException(e.user, e.code, tableInfo, e);
        }
      } catch (ThriftTableOperationException e) {
@@@ -297,7 -328,7 +295,7 @@@
          case NAMESPACE_NOTFOUND:
            throw new NamespaceNotFoundException(e);
          case OFFLINE:
-           throw new TableOfflineException(context.getInstance(), null);
 -          throw new TableOfflineException(instance, Tables.getTableId(instance, tableOrNamespaceName));
++          throw new TableOfflineException(context.getInstance(), Tables.getTableId(context.getInstance(), tableOrNamespaceName));
          default:
            throw new AccumuloException(e.description, e);
        }
@@@ -727,7 -794,7 +725,7 @@@
  
      Map<String,String> opts = new HashMap<String,String>();
      try {
-       doFateOperation(FateOperation.TABLE_COMPACT, args, opts, config.getWait());
 -      doFateOperation(FateOperation.TABLE_COMPACT, args, opts, tableName, wait);
++      doFateOperation(FateOperation.TABLE_COMPACT, args, opts, tableName, config.getWait());
      } catch (TableExistsException e) {
        // should not happen
        throw new AssertionError(e);


[3/6] accumulo git commit: ACCUMULO-3354 call deleteRows on offline table contains table name in TableOfflineException

Posted by el...@apache.org.
ACCUMULO-3354 call deleteRows on offline table contains table name in TableOfflineException

TableOperationsImpl.doFateOperation(...) is the only method that passed an explicitly null tableId to
the TableOfflineException constructor. Now checks the table's tableId and passes that to the
exception constructor.

Refactored doFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts, boolean wait)
to doFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts,
String tableOrNamespaceName, boolean wait). The table/namespace name is then pushed down explicitly.

Signed-off-by: Josh Elser <el...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/a506c0be
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/a506c0be
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/a506c0be

Branch: refs/heads/master
Commit: a506c0bedb5a6b5794e995b68a7710bd8bfb69eb
Parents: bbcc6da
Author: Jacob Meisler <ja...@gmail.com>
Authored: Tue Apr 28 20:42:17 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Mon May 4 11:41:22 2015 -0400

----------------------------------------------------------------------
 .../client/impl/NamespaceOperationsImpl.java    | 11 +++----
 .../core/client/impl/TableOperationsImpl.java   | 30 +++++++++-----------
 2 files changed, 20 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/a506c0be/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
index 19bc232..9a66fef 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
@@ -90,7 +90,8 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
     ArgumentChecker.notNull(namespace);
 
     try {
-      doNamespaceFateOperation(FateOperation.NAMESPACE_CREATE, Arrays.asList(ByteBuffer.wrap(namespace.getBytes())), Collections.<String,String> emptyMap());
+      doNamespaceFateOperation(FateOperation.NAMESPACE_CREATE, Arrays.asList(ByteBuffer.wrap(namespace.getBytes())), Collections.<String,String> emptyMap(),
+          namespace);
     } catch (NamespaceNotFoundException e) {
       // should not happen
       throw new AssertionError(e);
@@ -115,7 +116,7 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
     Map<String,String> opts = new HashMap<String,String>();
 
     try {
-      doNamespaceFateOperation(FateOperation.NAMESPACE_DELETE, args, opts);
+      doNamespaceFateOperation(FateOperation.NAMESPACE_DELETE, args, opts, namespace);
     } catch (NamespaceExistsException e) {
       // should not happen
       throw new AssertionError(e);
@@ -129,7 +130,7 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
 
     List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(oldNamespaceName.getBytes()), ByteBuffer.wrap(newNamespaceName.getBytes()));
     Map<String,String> opts = new HashMap<String,String>();
-    doNamespaceFateOperation(FateOperation.NAMESPACE_RENAME, args, opts);
+    doNamespaceFateOperation(FateOperation.NAMESPACE_RENAME, args, opts, oldNamespaceName);
   }
 
   @Override
@@ -229,10 +230,10 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
     return super.addConstraint(namespace, constraintClassName);
   }
 
-  private String doNamespaceFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts) throws AccumuloSecurityException,
+  private String doNamespaceFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts, String namespace) throws AccumuloSecurityException,
       AccumuloException, NamespaceExistsException, NamespaceNotFoundException {
     try {
-      return tableOps.doFateOperation(op, args, opts);
+      return tableOps.doFateOperation(op, args, opts, namespace);
     } catch (TableExistsException e) {
       // should not happen
       throw new AssertionError(e);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a506c0be/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
index 75dda1f..6e6ca19 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
@@ -95,7 +95,6 @@ import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException;
 import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
 import org.apache.accumulo.core.util.ArgumentChecker;
-import org.apache.accumulo.core.util.ByteBufferUtil;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.core.util.LocalityGroupUtil;
 import org.apache.accumulo.core.util.MapCounter;
@@ -290,13 +289,13 @@ public class TableOperationsImpl extends TableOperationsHelper {
     }
   }
 
-  String doFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts) throws AccumuloSecurityException, TableExistsException,
-      TableNotFoundException, AccumuloException, NamespaceExistsException, NamespaceNotFoundException {
-    return doFateOperation(op, args, opts, true);
+  String doFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts, String tableOrNamespaceName) throws AccumuloSecurityException,
+      TableExistsException, TableNotFoundException, AccumuloException, NamespaceExistsException, NamespaceNotFoundException {
+    return doFateOperation(op, args, opts, tableOrNamespaceName, true);
   }
 
-  String doFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts, boolean wait) throws AccumuloSecurityException,
-      TableExistsException, TableNotFoundException, AccumuloException, NamespaceExistsException, NamespaceNotFoundException {
+  String doFateOperation(FateOperation op, List<ByteBuffer> args, Map<String,String> opts, String tableOrNamespaceName, boolean wait)
+      throws AccumuloSecurityException, TableExistsException, TableNotFoundException, AccumuloException, NamespaceExistsException, NamespaceNotFoundException {
     Long opid = null;
 
     try {
@@ -309,14 +308,13 @@ public class TableOperationsImpl extends TableOperationsHelper {
       String ret = waitForFateOperation(opid);
       return ret;
     } catch (ThriftSecurityException e) {
-      String tableName = ByteBufferUtil.toString(args.get(0));
       switch (e.getCode()) {
         case TABLE_DOESNT_EXIST:
-          throw new TableNotFoundException(null, tableName, "Target table does not exist");
+          throw new TableNotFoundException(null, tableOrNamespaceName, "Target table does not exist");
         case NAMESPACE_DOESNT_EXIST:
-          throw new NamespaceNotFoundException(null, tableName, "Target namespace does not exist");
+          throw new NamespaceNotFoundException(null, tableOrNamespaceName, "Target namespace does not exist");
         default:
-          String tableInfo = Tables.getPrintableTableInfoFromName(instance, tableName);
+          String tableInfo = Tables.getPrintableTableInfoFromName(instance, tableOrNamespaceName);
           throw new AccumuloSecurityException(e.user, e.code, tableInfo, e);
       }
     } catch (ThriftTableOperationException e) {
@@ -330,7 +328,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
         case NAMESPACE_NOTFOUND:
           throw new NamespaceNotFoundException(e);
         case OFFLINE:
-          throw new TableOfflineException(instance, null);
+          throw new TableOfflineException(instance, Tables.getTableId(instance, tableOrNamespaceName));
         default:
           throw new AccumuloException(e.description, e);
       }
@@ -796,7 +794,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
 
     Map<String,String> opts = new HashMap<String,String>();
     try {
-      doFateOperation(FateOperation.TABLE_COMPACT, args, opts, wait);
+      doFateOperation(FateOperation.TABLE_COMPACT, args, opts, tableName, wait);
     } catch (TableExistsException e) {
       // should not happen
       throw new AssertionError(e);
@@ -1588,10 +1586,10 @@ public class TableOperationsImpl extends TableOperationsHelper {
     return super.addConstraint(tableName, constraintClassName);
   }
 
-  private void doTableFateOperation(String tableName, Class<? extends Exception> namespaceNotFoundExceptionClass, FateOperation op, List<ByteBuffer> args,
-      Map<String,String> opts) throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException {
+  private void doTableFateOperation(String tableOrNamespaceName, Class<? extends Exception> namespaceNotFoundExceptionClass, FateOperation op,
+      List<ByteBuffer> args, Map<String,String> opts) throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException {
     try {
-      doFateOperation(op, args, opts);
+      doFateOperation(op, args, opts, tableOrNamespaceName);
     } catch (NamespaceExistsException e) {
       // should not happen
       throw new AssertionError(e);
@@ -1602,7 +1600,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
       } else if (AccumuloException.class.isAssignableFrom(namespaceNotFoundExceptionClass)) {
         throw new AccumuloException("Cannot create table in non-existent namespace", e);
       } else if (TableNotFoundException.class.isAssignableFrom(namespaceNotFoundExceptionClass)) {
-        throw new TableNotFoundException(null, tableName, "Namespace not found", e);
+        throw new TableNotFoundException(null, tableOrNamespaceName, "Namespace not found", e);
       } else {
         // should not happen
         throw new AssertionError(e);