You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2017/04/08 00:08:22 UTC
[1/2] accumulo git commit: ACCUMULO-4619 fix split hanging on Error
Repository: accumulo
Updated Branches:
refs/heads/1.8 8d6b7299e -> ba3dea165
ACCUMULO-4619 fix split hanging on Error
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/8c0f03ac
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/8c0f03ac
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/8c0f03ac
Branch: refs/heads/1.8
Commit: 8c0f03ac2d8e06b220e2882d54914f2034625e15
Parents: 4ba5faf
Author: Keith Turner <kt...@apache.org>
Authored: Fri Apr 7 18:43:55 2017 -0400
Committer: Keith Turner <kt...@apache.org>
Committed: Fri Apr 7 18:43:55 2017 -0400
----------------------------------------------------------------------
.../core/client/impl/TableOperationsImpl.java | 39 +++++++++++---------
1 file changed, 21 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/8c0f03ac/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 1a7a38c..42afb9d 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
@@ -318,9 +318,9 @@ public class TableOperationsImpl extends TableOperationsHelper {
private String tableId;
private ExecutorService executor;
private CountDownLatch latch;
- private AtomicReference<Exception> exception;
+ private AtomicReference<Throwable> exception;
- SplitEnv(String tableName, String tableId, ExecutorService executor, CountDownLatch latch, AtomicReference<Exception> exception) {
+ SplitEnv(String tableName, String tableId, ExecutorService executor, CountDownLatch latch, AtomicReference<Throwable> exception) {
this.tableName = tableName;
this.tableId = tableId;
this.executor = executor;
@@ -359,11 +359,11 @@ public class TableOperationsImpl extends TableOperationsHelper {
addSplits(env.tableName, new TreeSet<>(splits.subList(mid, mid + 1)), env.tableId);
env.latch.countDown();
- env.executor.submit(new SplitTask(env, splits.subList(0, mid)));
- env.executor.submit(new SplitTask(env, splits.subList(mid + 1, splits.size())));
+ env.executor.execute(new SplitTask(env, splits.subList(0, mid)));
+ env.executor.execute(new SplitTask(env, splits.subList(mid + 1, splits.size())));
- } catch (Exception e) {
- env.exception.compareAndSet(null, e);
+ } catch (Throwable t) {
+ env.exception.compareAndSet(null, t);
}
}
@@ -379,26 +379,29 @@ public class TableOperationsImpl extends TableOperationsHelper {
Collections.sort(splits);
CountDownLatch latch = new CountDownLatch(splits.size());
- AtomicReference<Exception> exception = new AtomicReference<>(null);
+ AtomicReference<Throwable> exception = new AtomicReference<>(null);
ExecutorService executor = Executors.newFixedThreadPool(16, new NamingThreadFactory("addSplits"));
try {
- executor.submit(new SplitTask(new SplitEnv(tableName, tableId, executor, latch, exception), splits));
+ executor.execute(new SplitTask(new SplitEnv(tableName, tableId, executor, latch, exception), splits));
while (!latch.await(100, TimeUnit.MILLISECONDS)) {
if (exception.get() != null) {
executor.shutdownNow();
- Exception excep = exception.get();
- if (excep instanceof TableNotFoundException)
- throw (TableNotFoundException) excep;
- else if (excep instanceof AccumuloException)
- throw (AccumuloException) excep;
- else if (excep instanceof AccumuloSecurityException)
- throw (AccumuloSecurityException) excep;
- else if (excep instanceof RuntimeException)
- throw (RuntimeException) excep;
+ Throwable excep = exception.get();
+ // Below all exceptions are wrapped and rethrown. This is done so that the user knows what code path got them here. If the wrapping was not done, the
+ // user would only have the stack trace for the background thread.
+ if (excep instanceof TableNotFoundException) {
+ TableNotFoundException tnfe = (TableNotFoundException) excep;
+ throw new TableNotFoundException(tableId, tableName, "Table not found by background thread", tnfe);
+ } else if (excep instanceof AccumuloSecurityException) {
+ // base == background accumulo security exception
+ AccumuloSecurityException base = (AccumuloSecurityException) excep;
+ throw new AccumuloSecurityException(base.getUser(), base.asThriftException().getCode(), base.getTableInfo(), excep);
+ } else if (excep instanceof Error)
+ throw new Error(excep);
else
- throw new RuntimeException(excep);
+ throw new AccumuloException(excep);
}
}
} catch (InterruptedException e) {
[2/2] accumulo git commit: Merge branch '1.7' into 1.8
Posted by kt...@apache.org.
Merge branch '1.7' into 1.8
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/ba3dea16
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/ba3dea16
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/ba3dea16
Branch: refs/heads/1.8
Commit: ba3dea165b42c3150eed60489ee8a8b98c8b47be
Parents: 8d6b729 8c0f03a
Author: Keith Turner <kt...@apache.org>
Authored: Fri Apr 7 19:03:49 2017 -0400
Committer: Keith Turner <kt...@apache.org>
Committed: Fri Apr 7 19:03:49 2017 -0400
----------------------------------------------------------------------
.../core/client/impl/TableOperationsImpl.java | 39 +++++++++++---------
1 file changed, 21 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ba3dea16/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
----------------------------------------------------------------------