diff --git a/core/src/main/java/org/apache/accumulo/core/clientImpl/ConditionalWriterImpl.java b/core/src/main/java/org/apache/accumulo/core/clientImpl/ConditionalWriterImpl.java index fb24b15b888..3d4853816a0 100644 --- a/core/src/main/java/org/apache/accumulo/core/clientImpl/ConditionalWriterImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/ConditionalWriterImpl.java @@ -155,6 +155,7 @@ public Result next() { count--; return result; } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } } diff --git a/core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java index c11b6f3c210..4f865ee808c 100644 --- a/core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java @@ -154,6 +154,7 @@ public Map modifyProperties(final Consumer> ma "Unable to modify instance properties for because of concurrent modification"); retry.waitForNextAttempt(log, "Modify instance properties"); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } } finally { @@ -349,6 +350,9 @@ public List getActiveCompactions() try { ret.addAll(future.get()); } catch (InterruptedException | ExecutionException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } if (e.getCause() instanceof ThriftSecurityException) { ThriftSecurityException tse = (ThriftSecurityException) e.getCause(); throw new AccumuloSecurityException(tse.user, tse.code, e); diff --git a/core/src/main/java/org/apache/accumulo/core/clientImpl/NamespaceOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/clientImpl/NamespaceOperationsImpl.java index d58c6772b27..f8e3b4a0677 100644 --- a/core/src/main/java/org/apache/accumulo/core/clientImpl/NamespaceOperationsImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/NamespaceOperationsImpl.java @@ -257,6 +257,7 @@ public Map modifyProperties(final String namespace, + " because of concurrent modification"); retry.waitForNextAttempt(log, "Modify namespace properties for " + namespace); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } } finally { diff --git a/core/src/main/java/org/apache/accumulo/core/clientImpl/TableOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/clientImpl/TableOperationsImpl.java index 669a09570b5..ee12b6ebab2 100644 --- a/core/src/main/java/org/apache/accumulo/core/clientImpl/TableOperationsImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/TableOperationsImpl.java @@ -530,6 +530,7 @@ public void addSplits(String tableName, SortedSet partitionKeys) } } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } finally { executor.shutdown(); @@ -1065,6 +1066,7 @@ public Map modifyProperties(String tableName, + " because of concurrent modification"); retry.waitForNextAttempt(log, "modify table properties for " + tableName); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } } finally { @@ -1956,6 +1958,7 @@ public Locations locate(String tableName, Collection ranges) String.format("locating tablets in table %s(%s) for %d ranges", tableName, tableId, rangeList.size())); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } locator.invalidateCache(); diff --git a/core/src/main/java/org/apache/accumulo/core/clientImpl/TabletServerBatchReaderIterator.java b/core/src/main/java/org/apache/accumulo/core/clientImpl/TabletServerBatchReaderIterator.java index 53a44dc0bf1..7dcda72b9df 100644 --- a/core/src/main/java/org/apache/accumulo/core/clientImpl/TabletServerBatchReaderIterator.java +++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/TabletServerBatchReaderIterator.java @@ -156,6 +156,7 @@ public TabletServerBatchReaderIterator(ClientContext context, TableId tableId, S try { resultsQueue.put(entries); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); if (TabletServerBatchReaderIterator.this.queryThreadPool.isShutdown()) { log.debug("Failed to add Batch Scan result", e); } else { @@ -215,6 +216,7 @@ public boolean hasNext() { batchIterator = batch.iterator(); return batch != LAST_BATCH; } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } } @@ -288,6 +290,7 @@ private void binRanges(TabletLocator tabletLocator, List ranges, try { retry.waitForNextAttempt(log, "binRanges retry failures"); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } @@ -491,6 +494,7 @@ public void run() { try { resultsQueue.put(LAST_BATCH); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); fatalException = e; if (!resultsQueue.offer(LAST_BATCH)) { log.debug("Could not add to result queue after seeing fatalException", diff --git a/core/src/main/java/org/apache/accumulo/core/clientImpl/TabletServerBatchWriter.java b/core/src/main/java/org/apache/accumulo/core/clientImpl/TabletServerBatchWriter.java index 43ba332221e..f5938b21870 100644 --- a/core/src/main/java/org/apache/accumulo/core/clientImpl/TabletServerBatchWriter.java +++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/TabletServerBatchWriter.java @@ -507,6 +507,7 @@ private void waitRTE(WaitCondition condition) { wait(); } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } } @@ -1074,6 +1075,7 @@ public void close() throws ThriftSecurityException { try { cancelSession(); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new IllegalStateException(e); } } diff --git a/core/src/main/java/org/apache/accumulo/core/clientImpl/ThriftScanner.java b/core/src/main/java/org/apache/accumulo/core/clientImpl/ThriftScanner.java index e4186429135..b4d10c48736 100644 --- a/core/src/main/java/org/apache/accumulo/core/clientImpl/ThriftScanner.java +++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/ThriftScanner.java @@ -298,6 +298,7 @@ static Optional waitUntil(Supplier> condition, Duration maxWa retry.waitForNextAttempt(log, String.format( "For tableId %s scan server selector is waiting for '%s'", tableId, description)); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } @@ -550,6 +551,7 @@ public static List scan(ClientContext context, ScanState scanState, Du return results; } catch (InterruptedException ex) { + Thread.currentThread().interrupt(); TraceUtil.setException(parent, ex, true); throw new AccumuloException(ex); } finally { diff --git a/core/src/main/java/org/apache/accumulo/core/clientImpl/ThriftTransportPool.java b/core/src/main/java/org/apache/accumulo/core/clientImpl/ThriftTransportPool.java index 75db7bffeda..59a3b9d8c2a 100644 --- a/core/src/main/java/org/apache/accumulo/core/clientImpl/ThriftTransportPool.java +++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/ThriftTransportPool.java @@ -258,6 +258,7 @@ void shutdown() { try { checkThread.join(); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } } diff --git a/core/src/main/java/org/apache/accumulo/core/clientImpl/bulk/BulkImport.java b/core/src/main/java/org/apache/accumulo/core/clientImpl/bulk/BulkImport.java index 1c155cd5102..51a23026526 100644 --- a/core/src/main/java/org/apache/accumulo/core/clientImpl/bulk/BulkImport.java +++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/bulk/BulkImport.java @@ -182,6 +182,7 @@ public void load() try { retry.waitForNextAttempt(log, String.format("bulk import to %s(%s)", tableName, tableId)); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } log.info(ae.getMessage() + ". Retrying bulk import to " + tableName); diff --git a/core/src/main/java/org/apache/accumulo/core/fate/AdminUtil.java b/core/src/main/java/org/apache/accumulo/core/fate/AdminUtil.java index c1acd45fe25..001e1092df6 100644 --- a/core/src/main/java/org/apache/accumulo/core/fate/AdminUtil.java +++ b/core/src/main/java/org/apache/accumulo/core/fate/AdminUtil.java @@ -564,6 +564,7 @@ public boolean checkGlobalLock(ZooReaderWriter zk, ServiceLockPath zLockManagerP return false; } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); System.err.println("ERROR: Could not read manager lock, not running" + e.getMessage()); if (this.exitOnError) { System.exit(1); diff --git a/core/src/main/java/org/apache/accumulo/core/fate/Fate.java b/core/src/main/java/org/apache/accumulo/core/fate/Fate.java index a138534a598..0059787b1b3 100644 --- a/core/src/main/java/org/apache/accumulo/core/fate/Fate.java +++ b/core/src/main/java/org/apache/accumulo/core/fate/Fate.java @@ -483,6 +483,7 @@ public void shutdown(boolean wait) { try { executor.awaitTermination(1, SECONDS); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new IllegalStateException(e); } } diff --git a/core/src/main/java/org/apache/accumulo/core/fate/ZooStore.java b/core/src/main/java/org/apache/accumulo/core/fate/ZooStore.java index 1a989c310bd..ead5818993a 100644 --- a/core/src/main/java/org/apache/accumulo/core/fate/ZooStore.java +++ b/core/src/main/java/org/apache/accumulo/core/fate/ZooStore.java @@ -238,6 +238,9 @@ public long reserve() { } } } catch (InterruptedException | KeeperException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException(e); } } @@ -251,6 +254,7 @@ public void reserve(long tid) { try { this.wait(1000); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } } @@ -451,6 +455,7 @@ public TStatus waitForStatusChange(long tid, EnumSet expected) { try { this.wait(5000); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } } @@ -567,6 +572,9 @@ public List> getStack(long tid) { } catch (KeeperException.NoNodeException e) { return Collections.emptyList(); } catch (KeeperException | InterruptedException e1) { + if (e1 instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException(e1); } @@ -587,6 +595,9 @@ public List> getStack(long tid) { // children changed so start over continue outer; } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException(e); } } diff --git a/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ServiceLock.java b/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ServiceLock.java index 14af3daa251..95ff12ce0ce 100644 --- a/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ServiceLock.java +++ b/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ServiceLock.java @@ -414,6 +414,9 @@ public void process(WatchedEvent event) { LOG.debug("[{}] Renewed watch on prior node {}", vmLockPrefix, nodeToWatch); } } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } lw.failedToAcquireLock( new Exception("Failed to renew watch on prior node: " + nodeToWatch, e)); } @@ -575,6 +578,9 @@ public void process(WatchedEvent event) { determineLockOwnership(lw); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } lw.failedToAcquireLock(e); } } @@ -915,6 +921,9 @@ public boolean verifyLockAtSource() { try { return null != this.zooKeeper.exists(lockPath, false); } catch (KeeperException | InterruptedException | RuntimeException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } LOG.error("Error verfiying lock at {}", lockPath, e); return false; } diff --git a/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ServiceLockSupport.java b/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ServiceLockSupport.java index 8bc892f7b1e..cc0701f1770 100644 --- a/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ServiceLockSupport.java +++ b/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ServiceLockSupport.java @@ -103,7 +103,7 @@ public synchronized void waitForChange() { LOG.info("{} lock held by someone else, waiting for a change in state", serviceName); wait(); } catch (InterruptedException e) { - // empty + Thread.currentThread().interrupt(); } } } diff --git a/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ZooCache.java b/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ZooCache.java index 1c380de2312..714bbb17c72 100644 --- a/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ZooCache.java +++ b/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ZooCache.java @@ -263,6 +263,7 @@ public T retry() { log.warn("Zookeeper error, will retry", e); } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.info("Zookeeper error, will retry", e); } catch (ConcurrentModificationException e) { log.debug("Zookeeper was modified, will retry"); @@ -272,6 +273,7 @@ public T retry() { // do not hold lock while sleeping Thread.sleep(sleepTime); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.debug("Wait in retry() was interrupted.", e); } LockSupport.parkNanos(sleepTime); diff --git a/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ZooSession.java b/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ZooSession.java index 00db63999c9..7b7faf60f28 100644 --- a/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ZooSession.java +++ b/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ZooSession.java @@ -148,6 +148,7 @@ static ZooKeeper connect(String host, int timeout, String scheme, byte[] auth, W zooKeeper.close(); zooKeeper = null; } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.warn("interrupted", e); } } diff --git a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCache.java b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCache.java index dc85350405a..eaebdfcd545 100644 --- a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCache.java +++ b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCache.java @@ -154,6 +154,7 @@ public LruBlockCache(final LruBlockCacheConfiguration conf) { try { Thread.sleep(10); } catch (InterruptedException ex) { + Thread.currentThread().interrupt(); throw new RuntimeException(ex); } } @@ -533,7 +534,7 @@ public void run() { try { this.wait(); } catch (InterruptedException e) { - // empty + Thread.currentThread().interrupt(); } } LruBlockCache cache = this.cache.get(); diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/schema/TabletsMetadata.java b/core/src/main/java/org/apache/accumulo/core/metadata/schema/TabletsMetadata.java index 41189e8d663..6cff9ae59fd 100644 --- a/core/src/main/java/org/apache/accumulo/core/metadata/schema/TabletsMetadata.java +++ b/core/src/main/java/org/apache/accumulo/core/metadata/schema/TabletsMetadata.java @@ -557,6 +557,9 @@ private static TabletMetadata getRootMetadata(ClientContext ctx, byte[] bytes = zooReader.getData(path); return new RootTabletMetadata(new String(bytes, UTF_8)).toTabletMetadata(); } catch (InterruptedException | KeeperException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException(e); } default: diff --git a/core/src/main/java/org/apache/accumulo/core/rpc/UGIAssumingTransport.java b/core/src/main/java/org/apache/accumulo/core/rpc/UGIAssumingTransport.java index 913cd19109d..953e909588c 100644 --- a/core/src/main/java/org/apache/accumulo/core/rpc/UGIAssumingTransport.java +++ b/core/src/main/java/org/apache/accumulo/core/rpc/UGIAssumingTransport.java @@ -57,6 +57,9 @@ public void open() throws TTransportException { return null; }); } catch (IOException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException(e); } diff --git a/core/src/main/java/org/apache/accumulo/core/rpc/clients/ReplicationCoordinatorThriftClient.java b/core/src/main/java/org/apache/accumulo/core/rpc/clients/ReplicationCoordinatorThriftClient.java index da6457d0aec..64733db3a82 100644 --- a/core/src/main/java/org/apache/accumulo/core/rpc/clients/ReplicationCoordinatorThriftClient.java +++ b/core/src/main/java/org/apache/accumulo/core/rpc/clients/ReplicationCoordinatorThriftClient.java @@ -75,6 +75,9 @@ public Client getConnection(ClientContext context) { ZooReader reader = context.getZooReader(); replCoordinatorAddr = new String(reader.getData(zkPath), UTF_8); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } LOG.error("Could not fetch remote coordinator port", e); return null; } @@ -109,6 +112,7 @@ public Client getConnectionWithRetry(ClientContext context) { try { Thread.sleep(attempts * 250L); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } } @@ -130,6 +134,7 @@ public R execute(ClientContext context, Exec exec) try { Thread.sleep(100); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new AccumuloException(e); } } catch (ThriftSecurityException e) { diff --git a/core/src/main/java/org/apache/accumulo/core/util/CleanUp.java b/core/src/main/java/org/apache/accumulo/core/util/CleanUp.java index 0324a3bb1d1..c983f1c315a 100644 --- a/core/src/main/java/org/apache/accumulo/core/util/CleanUp.java +++ b/core/src/main/java/org/apache/accumulo/core/util/CleanUp.java @@ -77,6 +77,7 @@ private static void waitForZooKeeperClientThreads() { try { Thread.sleep(100); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("{}", e.getMessage(), e); } } diff --git a/core/src/main/java/org/apache/accumulo/core/util/UtilWaitThread.java b/core/src/main/java/org/apache/accumulo/core/util/UtilWaitThread.java index a05e1d265bb..08af3a867c6 100644 --- a/core/src/main/java/org/apache/accumulo/core/util/UtilWaitThread.java +++ b/core/src/main/java/org/apache/accumulo/core/util/UtilWaitThread.java @@ -32,6 +32,7 @@ public static void sleep(long millis) { try { Thread.sleep(millis); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("{}", e.getMessage(), e); } } @@ -57,6 +58,7 @@ public static void sleepUninterruptibly(long sleepFor, TimeUnit unit) { NANOSECONDS.sleep(remainingNanos); return; } catch (InterruptedException e) { + Thread.currentThread().interrupt(); interrupted = true; remainingNanos = end - System.nanoTime(); } diff --git a/core/src/main/java/org/apache/accumulo/core/util/compaction/ExternalCompactionUtil.java b/core/src/main/java/org/apache/accumulo/core/util/compaction/ExternalCompactionUtil.java index b3e4a99a7cc..db6f4ac15af 100644 --- a/core/src/main/java/org/apache/accumulo/core/util/compaction/ExternalCompactionUtil.java +++ b/core/src/main/java/org/apache/accumulo/core/util/compaction/ExternalCompactionUtil.java @@ -244,6 +244,9 @@ public static List getCompactionsRunningOnCompactors(ClientCo results.add(new RunningCompaction(job, compactorAddress, rcf.getQueue())); } } catch (InterruptedException | ExecutionException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException(e); } }); @@ -272,6 +275,9 @@ public static List getCompactionsRunningOnCompactors(ClientCo runningIds.add(ceid); } } catch (InterruptedException | ExecutionException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException(e); } }); diff --git a/core/src/main/java/org/apache/accumulo/core/util/threads/ThreadPools.java b/core/src/main/java/org/apache/accumulo/core/util/threads/ThreadPools.java index 376a192ce34..98da4842f43 100644 --- a/core/src/main/java/org/apache/accumulo/core/util/threads/ThreadPools.java +++ b/core/src/main/java/org/apache/accumulo/core/util/threads/ThreadPools.java @@ -181,6 +181,7 @@ private static boolean checkTaskFailed(ScheduledFuture future, // the list of critical tasks return true; } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); // current thread was interrupted waiting for get to return, which in theory, // shouldn't happen since the task is done. LOG.info("Interrupted while waiting to check on scheduled background task."); diff --git a/core/src/test/java/org/apache/accumulo/core/data/TableIdTest.java b/core/src/test/java/org/apache/accumulo/core/data/TableIdTest.java index f7ce7cf6c17..7092be4f4b6 100644 --- a/core/src/test/java/org/apache/accumulo/core/data/TableIdTest.java +++ b/core/src/test/java/org/apache/accumulo/core/data/TableIdTest.java @@ -116,6 +116,7 @@ static void tryToGc() { try { Thread.sleep(100); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); fail("Thread interrupted while waiting for GC"); } } diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiThreadedRFileTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiThreadedRFileTest.java index 1651b8031d9..8bc20a1f937 100644 --- a/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiThreadedRFileTest.java +++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiThreadedRFileTest.java @@ -257,6 +257,7 @@ public void testMultipleReaders() throws IOException { try { pool.awaitTermination(Long.MAX_VALUE, MILLISECONDS); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); e.printStackTrace(); } } diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloRunner.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloRunner.java index b2333c32b7d..9cbde8c842b 100644 --- a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloRunner.java +++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloRunner.java @@ -239,6 +239,7 @@ public static void main(String[] args) throws IOException, InterruptedException log.error("IOException attempting to stop Accumulo.", e); return; } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("InterruptedException attempting to stop Accumulo.", e); return; } diff --git a/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java b/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java index 45731998384..ba7b9545640 100644 --- a/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java +++ b/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java @@ -542,6 +542,7 @@ public synchronized void start() throws IOException, InterruptedException { } catch (IOException e) { log.error("IOException while attempting to stop the MiniAccumuloCluster.", e); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("The stopping of MiniAccumuloCluster was interrupted.", e); } })); @@ -719,6 +720,9 @@ private void verifyUp() throws InterruptedException, IOException { (rc, path, ctx, name) -> log.warn("{}", path)); log.warn("******* END ZK DUMP ************"); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("Error dumping zk", e); } } diff --git a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterStartStopTest.java b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterStartStopTest.java index 549bb50e009..8d7d3084529 100644 --- a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterStartStopTest.java +++ b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterStartStopTest.java @@ -55,6 +55,9 @@ public void teardownTestCluster() { try { accumulo.stop(); } catch (IOException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.warn("Failure during tear down", e); } } diff --git a/server/base/src/main/java/org/apache/accumulo/server/AbstractServer.java b/server/base/src/main/java/org/apache/accumulo/server/AbstractServer.java index 7d29d914d48..f3c8d58698b 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/AbstractServer.java +++ b/server/base/src/main/java/org/apache/accumulo/server/AbstractServer.java @@ -113,6 +113,9 @@ protected AbstractServer(String appName, ServerOpts opts, String[] args) { + upgradePrepNode); } } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException( "Error checking for upgrade preparation node (" + upgradePrepNode + ") in zookeeper", e); } @@ -312,6 +315,7 @@ public void startServiceLockVerificationThread() { interval); Thread.sleep(interval); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); if (serverThread.isAlive()) { // throw an Error, which will cause this process to be terminated throw new Error("Sleep interrupted in ServiceLock verification thread"); diff --git a/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java b/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java index 30543aac24a..9f1a0f607df 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java +++ b/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java @@ -316,6 +316,9 @@ public void waitForZookeeperAndHdfs() { getZooReaderWriter().getChildren(Constants.ZROOT); break; } catch (InterruptedException | KeeperException ex) { + if (ex instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.info("Waiting for accumulo to be initialized"); sleepUninterruptibly(1, SECONDS); } diff --git a/server/base/src/main/java/org/apache/accumulo/server/client/BulkImporter.java b/server/base/src/main/java/org/apache/accumulo/server/client/BulkImporter.java index 679941fafd7..8d224b6b450 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/client/BulkImporter.java +++ b/server/base/src/main/java/org/apache/accumulo/server/client/BulkImporter.java @@ -165,6 +165,7 @@ public AssignmentStats importFiles(List files) { try { threadPool.awaitTermination(60, TimeUnit.SECONDS); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } } @@ -420,6 +421,7 @@ private Map> estimateSizes(final VolumeManager vm, try { threadPool.awaitTermination(60, TimeUnit.SECONDS); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("Encountered InterruptedException while waiting for the threadPool to terminate.", e); throw new RuntimeException(e); @@ -568,6 +570,7 @@ private Map> assignMapFiles(Map> try { threadPool.awaitTermination(60, TimeUnit.SECONDS); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error( "Encountered InterruptedException while waiting for the thread pool to terminate.", e); throw new RuntimeException(e); diff --git a/server/base/src/main/java/org/apache/accumulo/server/compaction/RetryableThriftCall.java b/server/base/src/main/java/org/apache/accumulo/server/compaction/RetryableThriftCall.java index 020e436af6d..dbaae7dbd78 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/compaction/RetryableThriftCall.java +++ b/server/base/src/main/java/org/apache/accumulo/server/compaction/RetryableThriftCall.java @@ -114,6 +114,7 @@ public T run() throws RetriesExceededException { try { this.retry.waitForNextAttempt(LOG, "making a thrift RPC"); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); LOG.error("Error waiting for next attempt: {}, retrying now.", e.getMessage(), e); } } else { diff --git a/server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropLoader.java b/server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropLoader.java index c5842e5b663..7c568424e93 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropLoader.java +++ b/server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropLoader.java @@ -132,6 +132,9 @@ public CompletableFuture asyncReload(PropStoreKey propSt log.trace("Updated value {}", updatedValue == null ? "null" : updatedValue.print(true)); return updatedValue; } catch (RuntimeException | KeeperException | InterruptedException ex) { + if (ex instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.warn("async exception occurred reading properties from ZooKeeper for: {} returning null", propCacheId, ex); propStoreWatcher.signalZkChangeEvent(propCacheId); diff --git a/server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropStore.java b/server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropStore.java index 6168e18d8c1..e1931aba0bf 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropStore.java +++ b/server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropStore.java @@ -144,6 +144,9 @@ public void create(PropStoreKey propStoreKey, Map props) { String path = propStoreKey.getPath(); zrw.putPrivatePersistentData(path, codec.toBytes(vProps), ZooUtil.NodeExistsPolicy.FAIL); } catch (IOException | KeeperException | InterruptedException ex) { + if (ex instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Failed to serialize properties for " + propStoreKey, ex); } } @@ -254,6 +257,9 @@ public void delete(@NonNull PropStoreKey propStoreKey) { zrw.delete(path); cache.remove(propStoreKey); } catch (KeeperException | InterruptedException ex) { + if (ex instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Failed to delete properties for propCacheId " + propStoreKey, ex); } diff --git a/server/base/src/main/java/org/apache/accumulo/server/conf/util/ConfigPropertyUpgrader.java b/server/base/src/main/java/org/apache/accumulo/server/conf/util/ConfigPropertyUpgrader.java index b6400e56673..243cebc1cd1 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/conf/util/ConfigPropertyUpgrader.java +++ b/server/base/src/main/java/org/apache/accumulo/server/conf/util/ConfigPropertyUpgrader.java @@ -115,6 +115,7 @@ void upgradeNamespaceProps(final InstanceId instanceId, final ZooReaderWriter zr throw new IllegalStateException( "Failed to read namespaces from ZooKeeper for path: " + zkPathNamespaceBase, ex); } catch (InterruptedException ex) { + Thread.currentThread().interrupt(); throw new IllegalStateException( "Interrupted reading namespaces from ZooKeeper for path: " + zkPathNamespaceBase, ex); } @@ -136,6 +137,7 @@ void upgradeTableProps(final InstanceId instanceId, final ZooReaderWriter zrw, throw new IllegalStateException( "Failed to read tables from ZooKeeper for path: " + zkPathTableBase, ex); } catch (InterruptedException ex) { + Thread.currentThread().interrupt(); throw new IllegalStateException( "Interrupted reading tables from ZooKeeper for path: " + zkPathTableBase, ex); } diff --git a/server/base/src/main/java/org/apache/accumulo/server/conf/util/ZooPropEditor.java b/server/base/src/main/java/org/apache/accumulo/server/conf/util/ZooPropEditor.java index c8e9da32ea3..59215f0a2bb 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/conf/util/ZooPropEditor.java +++ b/server/base/src/main/java/org/apache/accumulo/server/conf/util/ZooPropEditor.java @@ -205,6 +205,9 @@ private VersionedProperties readPropNode(final PropStoreKey propKey, try { return ZooPropStore.readFromZk(propKey, nullWatcher, zooReader); } catch (IOException | KeeperException | InterruptedException ex) { + if (ex instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException(ex); } } diff --git a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java index 0fa7d7b7d37..0a0b612a43f 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java +++ b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java @@ -355,6 +355,9 @@ public void bulkRename(Map oldToNewPathMap, int poolSize, String pool future.get(); } } catch (InterruptedException | ExecutionException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IOException(e); } } diff --git a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java index bd8d7d3fd51..0e4275db52f 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java +++ b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java @@ -246,6 +246,9 @@ private static boolean zookeeperAvailable(ZooReaderWriter zoo) { try { return zoo.exists("/"); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } return false; } } diff --git a/server/base/src/main/java/org/apache/accumulo/server/init/ZooKeeperInitializer.java b/server/base/src/main/java/org/apache/accumulo/server/init/ZooKeeperInitializer.java index 5a74a2d3633..9f8ad0b04f0 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/init/ZooKeeperInitializer.java +++ b/server/base/src/main/java/org/apache/accumulo/server/init/ZooKeeperInitializer.java @@ -84,6 +84,9 @@ void initializeConfig(final InstanceId instanceId, final ZooReaderWriter zoo) { "Failed to create default system props during initialization at: {}" + sysPropPath); } } catch (IOException | KeeperException | InterruptedException ex) { + if (ex instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Failed to initialize configuration for prop store", ex); } } diff --git a/server/base/src/main/java/org/apache/accumulo/server/log/WalStateManager.java b/server/base/src/main/java/org/apache/accumulo/server/log/WalStateManager.java index 4ad40e07808..e76aa1182b1 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/log/WalStateManager.java +++ b/server/base/src/main/java/org/apache/accumulo/server/log/WalStateManager.java @@ -110,6 +110,9 @@ private String root() throws WalMarkerException { checkedExistance = true; } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new WalMarkerException(e); } @@ -123,6 +126,9 @@ public void initWalMarker(TServerInstance tsi) throws WalMarkerException { try { zoo.putPersistentData(root() + "/" + tsi, data, NodeExistsPolicy.FAIL); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new WalMarkerException(e); } } @@ -143,6 +149,9 @@ private void updateState(TServerInstance tsi, Path path, WalState state) log.debug("Setting {} to {}", path.getName(), state); zoo.putPersistentData(root() + "/" + tsi + "/" + path.getName(), data, policy); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new WalMarkerException(e); } } @@ -185,6 +194,9 @@ public List getWalsInUse(TServerInstance tsi) throws WalMarkerException { } catch (KeeperException.NoNodeException e) { log.debug("{} has no wal entry in zookeeper, assuming no logs", tsi); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new WalMarkerException(e); } return result; @@ -206,6 +218,9 @@ public Map> getAllMarkers() throws WalMarkerException } } } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new WalMarkerException(e); } return result; @@ -217,6 +232,9 @@ public Pair state(TServerInstance instance, UUID uuid) throws Wal String path = root() + "/" + instance + "/" + uuid; return parse(zoo.getData(path)); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new WalMarkerException(e); } } @@ -242,6 +260,9 @@ public void removeWalMarker(TServerInstance instance, UUID uuid) throws WalMarke String path = root() + "/" + instance + "/" + uuid; zoo.delete(path); } catch (InterruptedException | KeeperException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new WalMarkerException(e); } } @@ -252,6 +273,9 @@ public void forget(TServerInstance instance) throws WalMarkerException { try { zoo.recursiveDelete(path, NodeMissingPolicy.FAIL); } catch (InterruptedException | KeeperException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new WalMarkerException(e); } } diff --git a/server/base/src/main/java/org/apache/accumulo/server/metadata/ServerAmpleImpl.java b/server/base/src/main/java/org/apache/accumulo/server/metadata/ServerAmpleImpl.java index 22cb7a941fb..04babd2c867 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/metadata/ServerAmpleImpl.java +++ b/server/base/src/main/java/org/apache/accumulo/server/metadata/ServerAmpleImpl.java @@ -257,6 +257,9 @@ public Iterator getGcCandidates(DataLevel level) { jsonBytes = zooReader.getData(context.getZooKeeperRoot() + RootTable.ZROOT_TABLET_GC_CANDIDATES); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException(e); } return new RootGcCandidates(new String(jsonBytes, UTF_8)).sortedStream().iterator(); diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/delegation/AuthenticationTokenKeyManager.java b/server/base/src/main/java/org/apache/accumulo/server/security/delegation/AuthenticationTokenKeyManager.java index 5348e3bb9bd..c98c861ac5c 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/security/delegation/AuthenticationTokenKeyManager.java +++ b/server/base/src/main/java/org/apache/accumulo/server/security/delegation/AuthenticationTokenKeyManager.java @@ -87,6 +87,7 @@ public void run() { try { Thread.sleep(5000); } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); log.debug("Interrupted waiting for next update", ie); } } @@ -119,6 +120,9 @@ void updateStateFromCurrentKeys() { } } } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.warn("Failed to fetch existing AuthenticationKeys from ZooKeeper"); } } @@ -161,6 +165,9 @@ void _run(long now) { try { keyDistributor.advertise(newKey); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("Failed to advertise AuthenticationKey in ZooKeeper. Exiting.", e); throw new RuntimeException(e); } diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/delegation/AuthenticationTokenSecretManager.java b/server/base/src/main/java/org/apache/accumulo/server/security/delegation/AuthenticationTokenSecretManager.java index b88bebfd5fe..c6ba813275d 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/security/delegation/AuthenticationTokenSecretManager.java +++ b/server/base/src/main/java/org/apache/accumulo/server/security/delegation/AuthenticationTokenSecretManager.java @@ -257,6 +257,9 @@ synchronized int removeExpiredKeys(ZooAuthenticationKeyDistributor keyDistributo try { keyDistributor.remove(key); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("Failed to remove AuthenticationKey from ZooKeeper. Exiting", e); throw new RuntimeException(e); } diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/delegation/ZooAuthenticationKeyWatcher.java b/server/base/src/main/java/org/apache/accumulo/server/security/delegation/ZooAuthenticationKeyWatcher.java index abc060da49a..a32d488b5e7 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/security/delegation/ZooAuthenticationKeyWatcher.java +++ b/server/base/src/main/java/org/apache/accumulo/server/security/delegation/ZooAuthenticationKeyWatcher.java @@ -67,6 +67,9 @@ public void process(WatchedEvent event) { try { updateAuthKeys(); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("Failed to update secret manager after ZooKeeper reconnect; {}", event, e); } break; @@ -95,6 +98,9 @@ public void process(WatchedEvent event) { processChildNode(event); } } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("Failed to communicate with ZooKeeper processing {}", event, e); } } diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosAuthenticator.java b/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosAuthenticator.java index 45104f3a789..f998f148839 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosAuthenticator.java +++ b/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosAuthenticator.java @@ -102,6 +102,9 @@ public void initializeSecurity(String principal, byte[] token) { createUserNodeInZk(Base64.getEncoder().encodeToString(principalData)); } } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("Failed to initialize security", e); throw new RuntimeException(e); } @@ -158,6 +161,7 @@ public synchronized void createUser(String principal, AuthenticationToken token) log.error("Failed to create user in ZooKeeper", e); throw new AccumuloSecurityException(principal, SecurityErrorCode.CONNECTION_ERROR, e); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("Interrupted trying to create node for user", e); throw new RuntimeException(e); } diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java b/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java index 86fa5a0688c..bdd41135b31 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java +++ b/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java @@ -101,6 +101,9 @@ public void initializeSecurity(String principal, byte[] token) { constructUser(principal, ZKSecurityTool.createPass(token)); } } catch (KeeperException | AccumuloException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("{}", e.getMessage(), e); throw new RuntimeException(e); } @@ -139,6 +142,7 @@ public void createUser(String principal, AuthenticationToken token) } throw new AccumuloSecurityException(principal, SecurityErrorCode.CONNECTION_ERROR, e); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("{}", e.getMessage(), e); throw new RuntimeException(e); } catch (AccumuloException e) { @@ -156,6 +160,7 @@ public void dropUser(String user) throws AccumuloSecurityException { NodeMissingPolicy.FAIL); } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("{}", e.getMessage(), e); throw new RuntimeException(e); } catch (KeeperException e) { @@ -185,6 +190,7 @@ public void changePassword(String principal, AuthenticationToken token) log.error("{}", e.getMessage(), e); throw new AccumuloSecurityException(principal, SecurityErrorCode.CONNECTION_ERROR, e); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("{}", e.getMessage(), e); throw new RuntimeException(e); } catch (AccumuloException e) { diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java b/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java index e23b13e25e8..8f964e1d4b2 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java +++ b/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java @@ -83,6 +83,9 @@ public void initializeSecurity(TCredentials itw, String rootuser) zoo.putPersistentData(ZKUserPath + "/" + rootuser + ZKUserAuths, ZKSecurityTool.convertAuthorizations(Authorizations.EMPTY), NodeExistsPolicy.FAIL); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("{}", e.getMessage(), e); throw new RuntimeException(e); } @@ -97,6 +100,7 @@ public void initUser(String user) throws AccumuloSecurityException { log.error("{}", e.getMessage(), e); throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("{}", e.getMessage(), e); throw new RuntimeException(e); } @@ -111,6 +115,7 @@ public void dropUser(String user) throws AccumuloSecurityException { zooCache.clear(ZKUserPath + "/" + user); } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("{}", e.getMessage(), e); throw new RuntimeException(e); } catch (KeeperException e) { @@ -136,6 +141,7 @@ public void changeAuthorizations(String user, Authorizations authorizations) log.error("{}", e.getMessage(), e); throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("{}", e.getMessage(), e); throw new RuntimeException(e); } diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java b/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java index ea306f15166..96bb92079e2 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java +++ b/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java @@ -90,6 +90,7 @@ public boolean hasTablePermission(String user, String table, TablePermission per // it's there, you don't have permission return false; } catch (InterruptedException ex) { + Thread.currentThread().interrupt(); log.warn("Unhandled InterruptedException, failing closed for table permission check", e); return false; } catch (KeeperException ex) { @@ -104,6 +105,7 @@ public boolean hasTablePermission(String user, String table, TablePermission per log.warn("Unhandled KeeperException, failing closed for table permission check", e); return false; } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.warn("Unhandled InterruptedException, failing closed for table permission check", e); return false; } @@ -139,6 +141,7 @@ public boolean hasNamespacePermission(String user, String namespace, // it's there, you don't have permission return false; } catch (InterruptedException ex) { + Thread.currentThread().interrupt(); log.warn("Unhandled InterruptedException, failing closed for namespace permission check", e); return false; @@ -154,6 +157,7 @@ public boolean hasNamespacePermission(String user, String namespace, log.warn("Unhandled KeeperException, failing closed for table permission check", e); return false; } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.warn("Unhandled InterruptedException, failing closed for table permission check", e); return false; } @@ -197,6 +201,7 @@ public void grantSystemPermission(String user, SystemPermission permission) log.error("{}", e.getMessage(), e); throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("{}", e.getMessage(), e); throw new RuntimeException(e); } @@ -225,6 +230,7 @@ public void grantTablePermission(String user, String table, TablePermission perm log.error("{}", e.getMessage(), e); throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("{}", e.getMessage(), e); throw new RuntimeException(e); } @@ -255,6 +261,7 @@ public void grantNamespacePermission(String user, String namespace, log.error("{}", e.getMessage(), e); throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("{}", e.getMessage(), e); throw new RuntimeException(e); } @@ -284,6 +291,7 @@ public void revokeSystemPermission(String user, SystemPermission permission) log.error("{}", e.getMessage(), e); throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("{}", e.getMessage(), e); throw new RuntimeException(e); } @@ -315,6 +323,7 @@ public void revokeTablePermission(String user, String table, TablePermission per log.error("{}", e.getMessage(), e); throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("{}", e.getMessage(), e); throw new RuntimeException(e); } @@ -349,6 +358,7 @@ public void revokeNamespacePermission(String user, String namespace, log.error("{}", e.getMessage(), e); throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("{}", e.getMessage(), e); throw new RuntimeException(e); } @@ -368,6 +378,7 @@ public void cleanTablePermissions(String table) throws AccumuloSecurityException log.error("{}", e.getMessage(), e); throw new AccumuloSecurityException("unknownUser", SecurityErrorCode.CONNECTION_ERROR, e); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("{}", e.getMessage(), e); throw new RuntimeException(e); } @@ -387,6 +398,7 @@ public void cleanNamespacePermissions(String namespace) throws AccumuloSecurityE log.error("{}", e.getMessage(), e); throw new AccumuloSecurityException("unknownUser", SecurityErrorCode.CONNECTION_ERROR, e); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("{}", e.getMessage(), e); throw new RuntimeException(e); } @@ -427,6 +439,9 @@ public void initializeSecurity(TCredentials itw, String rootuser) createNamespacePerm(rootuser, entry.getKey(), entry.getValue()); } } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("{}", e.getMessage(), e); throw new RuntimeException(e); } @@ -444,6 +459,7 @@ public void initUser(String user) throws AccumuloSecurityException { log.error("{}", e.getMessage(), e); throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("{}", e.getMessage(), e); throw new RuntimeException(e); } @@ -485,6 +501,7 @@ public void cleanUser(String user) throws AccumuloSecurityException { zooCache.clear(ZKUserPath + "/" + user); } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("{}", e.getMessage(), e); throw new RuntimeException(e); } catch (KeeperException e) { @@ -511,6 +528,7 @@ public boolean hasSystemPermission(String user, SystemPermission permission) { log.warn("Unhandled KeeperException, failing closed for table permission check", e); return false; } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.warn("Unhandled InterruptedException, failing closed for table permission check", e); return false; } diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/AccumuloStatus.java b/server/base/src/main/java/org/apache/accumulo/server/util/AccumuloStatus.java index 3d0d1b9732e..d01bdc002e4 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/AccumuloStatus.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/AccumuloStatus.java @@ -49,6 +49,9 @@ public static boolean isAccumuloOffline(ZooReader reader, String rootPath) throw return false; } } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IOException("Issues contacting ZooKeeper to get Accumulo status.", e); } return true; diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/UpgradeUtil.java b/server/base/src/main/java/org/apache/accumulo/server/util/UpgradeUtil.java index b4d6002a36f..34356f6f507 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/UpgradeUtil.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/UpgradeUtil.java @@ -146,6 +146,9 @@ public void execute(String[] args) throws Exception { zoo.delete(zUpgradepath); } } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Error creating or checking for " + zUpgradepath + " node in zookeeper: " + e.getMessage(), e); } @@ -159,6 +162,9 @@ public void execute(String[] args) throws Exception { "Manager is running, shut it down and retry this operation"); } } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Error trying to determine if Manager lock is held", e); } @@ -174,6 +180,9 @@ public void execute(String[] args) throws Exception { + " retry this operation."); } } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Error checking for existing FATE transactions", e); } @@ -182,6 +191,9 @@ public void execute(String[] args) throws Exception { try { zoo.putPersistentData(zUpgradepath, new byte[0], NodeExistsPolicy.SKIP); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Error creating " + zUpgradepath + " node in zookeeper. Check for any issues and retry.", e); } diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java b/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java index 2869e8e2c21..1f73f592874 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java @@ -172,6 +172,9 @@ public void zap(SiteConfiguration siteConf, String... args) { try { removeSingletonLock(zoo, managerLockPath, hostPortPredicate, opts); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("Error deleting manager lock", e); } } @@ -182,6 +185,9 @@ public void zap(SiteConfiguration siteConf, String... args) { ServiceLock.deleteLock(zoo, gcLockPath, ServerServices.Service.GC_CLIENT, hostPortPredicate, m -> message(m, opts), opts.dryRun); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("Error deleting gc lock", e); } } @@ -191,6 +197,9 @@ public void zap(SiteConfiguration siteConf, String... args) { try { removeSingletonLock(zoo, monitorLockPath, hostPortPredicate, opts); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("Error deleting monitor lock", e); } } @@ -212,6 +221,9 @@ public void zap(SiteConfiguration siteConf, String... args) { opts.dryRun); } } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("Error deleting tserver locks", e); } } @@ -230,6 +242,9 @@ public void zap(SiteConfiguration siteConf, String... args) { try { removeSingletonLock(zoo, coordinatorPath, hostPortPredicate, opts); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("Error deleting coordinator from zookeeper", e); } } @@ -240,6 +255,9 @@ public void zap(SiteConfiguration siteConf, String... args) { removeCompactorGroupedLocks(zoo, compactorsBasepath, groupPredicate, hostPortPredicate, opts); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("Error deleting compactors from zookeeper", e); } @@ -254,6 +272,9 @@ public void zap(SiteConfiguration siteConf, String... args) { removeScanServerGroupLocks(zoo, sserversPath, hostPortPredicate, groupPredicate, opts); } } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("Error deleting scan server locks", e); } } diff --git a/server/base/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java b/server/base/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java index 968f45618c9..d16948aed80 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java +++ b/server/base/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java @@ -157,6 +157,7 @@ public void run() { } catch (KeeperException e) { log.error("Failed to look for work", e); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.info("Interrupted looking for work", e); } } @@ -219,6 +220,7 @@ public void process(WatchedEvent event) { } catch (KeeperException e) { log.error("Failed to look for work at path {}; {}", path, event, e); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.info("Interrupted looking for work at path {}; {}", path, event, e); } } else { @@ -246,6 +248,7 @@ public void run() { } catch (KeeperException e) { log.error("Failed to look for work", e); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.info("Interrupted looking for work", e); } } diff --git a/server/base/src/test/java/org/apache/accumulo/server/conf/store/impl/ReadyMonitorTest.java b/server/base/src/test/java/org/apache/accumulo/server/conf/store/impl/ReadyMonitorTest.java index 25a94c839cf..f3f934a3923 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/conf/store/impl/ReadyMonitorTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/conf/store/impl/ReadyMonitorTest.java @@ -71,6 +71,7 @@ public void teardown() { boolean terminated = workerPool.awaitTermination(2000, MILLISECONDS); log.trace("Worked pool successfully terminated: {}", terminated); } catch (InterruptedException ex) { + Thread.currentThread().interrupt(); // don't care. workerPool.shutdownNow(); } @@ -145,6 +146,9 @@ public void isReadyMultiThread() throws Exception { log.debug("waiting: {}", NANOSECONDS.toSeconds(timeWaiting)); assertTrue(timeWaiting < MILLISECONDS.toNanos(readyTestTimeout)); } catch (ExecutionException | InterruptedException ex) { + if (ex instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.warn("Task failed", ex); fail("Task failed with exception - " + ex.getMessage()); } diff --git a/server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CompactionCoordinator.java b/server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CompactionCoordinator.java index dcbdc0e2de6..a389ee6b0e6 100644 --- a/server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CompactionCoordinator.java +++ b/server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CompactionCoordinator.java @@ -303,6 +303,7 @@ public void run() { try { waitForUpgrade(); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); LOG.error("Interrupted while waiting for upgrade to complete, exiting..."); System.exit(1); } @@ -319,6 +320,9 @@ public void run() { try { getCoordinatorLock(clientAddress); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Exception getting Coordinator lock", e); } @@ -380,6 +384,7 @@ public void run() { Thread.sleep(checkInterval - duration); } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); LOG.info("Interrupt Exception received, shutting down"); gracefulShutdown(getContext().rpcCreds()); } diff --git a/server/compactor/src/main/java/org/apache/accumulo/compactor/Compactor.java b/server/compactor/src/main/java/org/apache/accumulo/compactor/Compactor.java index 65432852be4..bc6d7e2bb78 100644 --- a/server/compactor/src/main/java/org/apache/accumulo/compactor/Compactor.java +++ b/server/compactor/src/main/java/org/apache/accumulo/compactor/Compactor.java @@ -812,6 +812,9 @@ public void run() { try { announceExistence(clientAddress); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException("Error registering compactor in ZooKeeper", e); } @@ -1012,6 +1015,7 @@ public void run() { } } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); LOG.info("Interrupt Exception received, shutting down"); gracefulShutdown(getContext().rpcCreds()); } diff --git a/server/gc/src/main/java/org/apache/accumulo/gc/GCRun.java b/server/gc/src/main/java/org/apache/accumulo/gc/GCRun.java index 9c8b1da8b5b..5e7dae341c7 100644 --- a/server/gc/src/main/java/org/apache/accumulo/gc/GCRun.java +++ b/server/gc/src/main/java/org/apache/accumulo/gc/GCRun.java @@ -392,6 +392,7 @@ public void deleteConfirmedCandidates(SortedMap confirmedDel } } } catch (InterruptedException e1) { + Thread.currentThread().interrupt(); log.error("{}", e1.getMessage(), e1); } diff --git a/server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectWriteAheadLogs.java b/server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectWriteAheadLogs.java index 39aec22ca2a..f0125f9069e 100644 --- a/server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectWriteAheadLogs.java +++ b/server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectWriteAheadLogs.java @@ -314,6 +314,9 @@ private long removeFiles(Collection> collection, final GCSta iter.remove(); f.getValue().get(); } catch (InterruptedException | ExecutionException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException("Uncaught exception deleting wal file" + f.getKey(), e); } } @@ -354,6 +357,9 @@ private long removeFiles(Collection values) { iter.remove(); f.getValue().get(); } catch (InterruptedException | ExecutionException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException( "Uncaught exception deleting recovery log file" + f.getKey(), e); } diff --git a/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java b/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java index 902642a6c03..81a6f6964c9 100644 --- a/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java +++ b/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java @@ -156,6 +156,7 @@ public void run() { try { waitForUpgrade(); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); LOG.error("Interrupted while waiting for upgrade to complete, exiting..."); System.exit(1); } @@ -186,6 +187,7 @@ public void run() { log.debug("Sleeping for {} milliseconds before beginning garbage collection cycles", delay); Thread.sleep(delay); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.warn("{}", e.getMessage(), e); return; } @@ -336,10 +338,12 @@ public void run() { log.debug("Sleeping for {} milliseconds", gcDelay); Thread.sleep(gcDelay); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.warn("{}", e.getMessage(), e); throw e; } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.info("Interrupt Exception received, shutting down"); gracefulShutdown(getContext().rpcCreds()); } diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/EventCoordinator.java b/server/manager/src/main/java/org/apache/accumulo/manager/EventCoordinator.java index 4145f581894..cda9d07ff9f 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/EventCoordinator.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/EventCoordinator.java @@ -36,6 +36,7 @@ synchronized long waitForEvents(long millis, long lastEvent) { try { wait(millis); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.debug("ignoring InterruptedException", e); } } diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java b/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java index 01399b8d1f5..558d1eff11d 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java @@ -810,7 +810,6 @@ public void run() { } catch (KeeperException e) { log.error("Exception trying to delete empty scan server ZNodes, will retry", e); } catch (InterruptedException e) { - Thread.interrupted(); log.error("Interrupted trying to delete empty scan server ZNodes, will retry", e); } finally { // sleep for 5 mins @@ -1250,6 +1249,9 @@ public synchronized boolean shouldForceHalt() { tserverHaltRpcAttempts.remove(server); badServers.remove(server); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("Failed to delete zlock for server {}", server, e); } } else { @@ -1280,6 +1282,7 @@ public synchronized boolean shouldForceHalt() { try { tp.awaitTermination(Math.max(10000, rpcTimeout / 3), MILLISECONDS); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.debug("Interrupted while fetching status"); } @@ -1344,6 +1347,9 @@ public void run() { try { getManagerLock(ServiceLock.path(zroot + Constants.ZMANAGER_LOCK), clientAddress); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Exception getting manager lock", e); } @@ -1390,6 +1396,9 @@ public void process(WatchedEvent event) { } }); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Unable to read " + zroot + Constants.ZRECOVERY, e); } @@ -1433,6 +1442,9 @@ boolean canSuspendTablets() { upgradeMetadataFuture.get(); } } catch (ExecutionException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Metadata upgrade failed", e); } @@ -1454,6 +1466,9 @@ boolean canSuspendTablets() { ThreadPools.watchCriticalScheduledTask(context.getScheduledExecutor() .scheduleWithFixedDelay(store::ageOff, 63000, 63000, MILLISECONDS)); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Exception setting up FaTE cleanup thread", e); } @@ -1470,6 +1485,9 @@ boolean canSuspendTablets() { try { keyDistributor.initialize(); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Exception setting up delegation-token key manager", e); } authenticationTokenKeyManagerThread = Threads @@ -1493,6 +1511,9 @@ boolean canSuspendTablets() { try { managerLock.replaceLockData(address.getBytes(UTF_8)); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Exception updating manager lock", e); } @@ -1511,6 +1532,9 @@ boolean canSuspendTablets() { replServer.set(setupReplication()); } } catch (UnknownHostException | KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("Error occurred starting replication services. ", e); } }, 0, 5000, MILLISECONDS); @@ -1530,6 +1554,7 @@ boolean canSuspendTablets() { try { Thread.sleep(500); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.info("Interrupt Exception received, shutting down"); gracefulShutdown(context.rpcCreds()); } @@ -1551,6 +1576,7 @@ boolean canSuspendTablets() { replicationWorkThread.join(remaining(deadline)); } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new IllegalStateException("Exception stopping replication workers", e); } var nullableReplServer = replServer.get(); @@ -1566,6 +1592,7 @@ boolean canSuspendTablets() { authenticationTokenKeyManagerThread.join(remaining(deadline)); } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new IllegalStateException("Exception waiting on delegation-token key manager", e); } } @@ -1576,6 +1603,7 @@ boolean canSuspendTablets() { try { watcher.join(remaining(deadline)); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new IllegalStateException("Exception waiting on watcher", e); } } @@ -1595,6 +1623,9 @@ private void initializeZkForReplication(ZooReaderWriter zReaderWriter, String zr org.apache.accumulo.server.replication.ZooKeeperInitialization .ensureZooKeeperInitialized(zReaderWriter, zroot); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Exception while ensuring ZooKeeper is initialized", e); } } @@ -1921,6 +1952,7 @@ public void waitForBalance() { try { balancedNotifier.wait(); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.debug(e.toString(), e); } } while (displayUnassigned() > 0 || !migrations.isEmpty() diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/replication/ManagerReplicationCoordinator.java b/server/manager/src/main/java/org/apache/accumulo/manager/replication/ManagerReplicationCoordinator.java index 48aebf42dbe..c92699f1c56 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/replication/ManagerReplicationCoordinator.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/replication/ManagerReplicationCoordinator.java @@ -87,6 +87,9 @@ public String getServicerAddress(String remoteTableId, TCredentials creds) replServiceAddr = new String(reader.getData(manager.getZooKeeperRoot() + ReplicationConstants.ZOO_TSERVERS + "/" + tserver.getHostPort()), UTF_8); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("Could not fetch replication service port for tserver", e); throw new ReplicationCoordinatorException( ReplicationCoordinatorErrorCode.SERVICE_CONFIGURATION_UNAVAILABLE, diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/replication/ReplicationDriver.java b/server/manager/src/main/java/org/apache/accumulo/manager/replication/ReplicationDriver.java index c1ee41be59c..9c1f0ec0040 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/replication/ReplicationDriver.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/replication/ReplicationDriver.java @@ -123,6 +123,7 @@ public void run() { try { Thread.sleep(sleepMillis); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("Interrupted while sleeping", e); } } diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/replication/SequentialWorkAssigner.java b/server/manager/src/main/java/org/apache/accumulo/manager/replication/SequentialWorkAssigner.java index 8ddf4d515da..79f07a8c5c7 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/replication/SequentialWorkAssigner.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/replication/SequentialWorkAssigner.java @@ -91,6 +91,9 @@ protected void initializeQueuedWork() { try { existingWork = workQueue.getWorkQueued(); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException("Error reading existing queued replication work", e); } @@ -178,6 +181,9 @@ protected boolean queueWork(Path path, ReplicationTarget target) { workQueue.addWork(queueKey, path.toString()); workForPeer.put(target.getSourceTableId(), queueKey); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.warn("Could not queue work for {} to {}", path, target, e); return false; } diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/replication/UnorderedWorkAssigner.java b/server/manager/src/main/java/org/apache/accumulo/manager/replication/UnorderedWorkAssigner.java index 0c905db228d..11e0f54dbea 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/replication/UnorderedWorkAssigner.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/replication/UnorderedWorkAssigner.java @@ -100,6 +100,7 @@ protected void initializeQueuedWork() { throw new RuntimeException("Error reading existing queued replication work from ZooKeeper", e); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("Error reading existing queued replication work from ZooKeeper", e); throw new RuntimeException("Error reading existing queued replication work from ZooKeeper", e); @@ -126,6 +127,9 @@ protected boolean queueWork(Path path, ReplicationTarget target) { workQueue.addWork(queueKey, path.toString()); queuedWork.add(queueKey); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.warn("Could not queue work for {}", path, e); return false; } diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/Utils.java b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/Utils.java index 766332df287..2c94674de2f 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/Utils.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/Utils.java @@ -92,6 +92,9 @@ public static void checkTableNameDoesNotExist(ServerContext context, String tabl } } } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("Error checking to see if tableId {} exists in ZooKeeper", tableId, e); throw new AcceptableThriftTableOperationException(null, tableName, TableOperation.CREATE, TableOperationExceptionType.OTHER, e.getMessage()); diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/RenameMasterDirInZK.java b/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/RenameMasterDirInZK.java index 3db373f45a7..b0a240ef584 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/RenameMasterDirInZK.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/RenameMasterDirInZK.java @@ -65,6 +65,9 @@ public static boolean renameMasterDirInZK(ServerContext context) { } return mastersDirExists; } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException("Unable to rename " + mastersZooDir + " in ZooKeeper", e); } } diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader9to10.java b/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader9to10.java index 6bf9e3292b5..9250d3a9ca4 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader9to10.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader9to10.java @@ -176,6 +176,9 @@ private void validateACLs(ServerContext context) { aclErrorOccurred.set(true); } } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("Error getting ACL for path: {}", path, e); aclErrorOccurred.set(true); } @@ -187,6 +190,9 @@ private void validateACLs(ServerContext context) { + "for instructions on how to fix."); } } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException("Upgrade Failed! Error validating nodes under " + rootPath, e); } } @@ -245,6 +251,9 @@ private void createScanServerNodes(ServerContext context) { context.getZooKeeperRoot() + Constants.ZSSERVERS, EMPTY_BYTE_ARRAY, NodeExistsPolicy.SKIP); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException("Unable to create scan server paths", e); } } @@ -263,6 +272,9 @@ private void createExternalCompactionNodes(ServerContext context) { context.getZooKeeperRoot() + Constants.ZCOMPACTORS, EMPTY_BYTE_ARRAY, NodeExistsPolicy.SKIP); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException("Unable to create external compaction paths", e); } } @@ -315,6 +327,9 @@ private void upgradeRootTabletMetadata(ServerContext context) { context.getZooKeeperRoot() + ZROOT_TABLET_GC_CANDIDATES, new RootGcCandidates().toJson().getBytes(UTF_8), NodeExistsPolicy.SKIP); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException(e); } @@ -410,6 +425,9 @@ static List getRootLogEntries(ServerContext context) { return result; } catch (KeeperException | InterruptedException | IOException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException(e); } } @@ -425,6 +443,9 @@ private String getFromZK(ServerContext context, String relpath) { } catch (NoNodeException e) { return null; } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException(e); } } @@ -434,6 +455,9 @@ private void delete(ServerContext context, String relpath) { context.getZooReaderWriter().recursiveDelete(context.getZooKeeperRoot() + relpath, NodeMissingPolicy.SKIP); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException(e); } } diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java index 122d8c927de..d3558f7606f 100644 --- a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java @@ -512,6 +512,9 @@ public void run() { try { monitorLock.replaceLockData(monitorHostAndPort.toString().getBytes(UTF_8)); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Exception updating monitor lock with host and port", e); } @@ -558,6 +561,7 @@ public void run() { try { Thread.sleep(1000); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); LOG.info("Interrupt Exception received, shutting down"); gracefulShutdown(context.rpcCreds()); } diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/ScanServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/ScanServer.java index 53b121f08d5..0748887eeeb 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/ScanServer.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/ScanServer.java @@ -395,6 +395,7 @@ public void run() { try { waitForUpgrade(); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); LOG.error("Interrupted while waiting for upgrade to complete, exiting..."); System.exit(1); } @@ -438,6 +439,7 @@ public void run() { && tabletMetadataCache.estimatedSize() == 0); updateAllowedTables(false); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); LOG.info("Interrupt Exception received, shutting down"); gracefulShutdown(getContext().rpcCreds()); } @@ -742,6 +744,7 @@ private Map reserveFilesInner(Collection ex // file from the metadata table or the reservedFiles map influxFiles.addAll(allFiles.keySet()); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } finally { reservationsWriteLock.unlock(); diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java index 25ea5276729..b6fc4695f4f 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java @@ -728,6 +728,9 @@ private void initializeZkForReplication() { org.apache.accumulo.server.replication.ZooKeeperInitialization.ensureZooKeeperInitialized( getContext().getZooReaderWriter(), getContext().getZooKeeperRoot()); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Exception while ensuring ZooKeeper is initialized", e); } } @@ -746,6 +749,9 @@ public void run() { try { authKeyWatcher.updateAuthKeys(); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } // TODO Does there need to be a better check? What are the error conditions that we'd fall // out here? AUTH_FAILURE? // If we get the error, do we just put it on a timer and retry the exists(String, Watcher) @@ -941,6 +947,7 @@ public void run() { sleepUninterruptibly(1, TimeUnit.SECONDS); } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.info("Interrupt Exception received, shutting down"); gracefulShutdown(getContext().rpcCreds()); } catch (Exception e) { diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java index 748d74705bd..7b3ec10e86a 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java @@ -525,6 +525,7 @@ private void processTabletMemStats() { } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.warn("Interrupted processing tablet memory statistics", e); } } @@ -632,7 +633,9 @@ void waitUntilCommitsAreEnabled() { throw new HoldTimeoutException("Commits are held"); } commitHold.wait(1000); - } catch (InterruptedException e) {} + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } } } } diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/UnloadTabletHandler.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/UnloadTabletHandler.java index d454d0d79cf..2000f40b99c 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/UnloadTabletHandler.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/UnloadTabletHandler.java @@ -67,7 +67,9 @@ public void run() { try { log.info("Waiting for tablet {} to finish opening before unloading.", extent); server.openingTablets.wait(); - } catch (InterruptedException e) {} + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } } } synchronized (server.onlineTablets) { diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/WriteTracker.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/WriteTracker.java index ba254a85441..2aeee583395 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/WriteTracker.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/WriteTracker.java @@ -83,6 +83,7 @@ synchronized void waitForWrites(TabletType ttype) { try { this.wait(); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("{}", e.getMessage(), e); } } diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/compactions/CompactionManager.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/compactions/CompactionManager.java index 5d201e04fa9..6e14324e47f 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/compactions/CompactionManager.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/compactions/CompactionManager.java @@ -171,6 +171,7 @@ private void mainLoop() { try { retry.waitForNextAttempt(log, "compaction initiation loop"); } catch (InterruptedException e1) { + Thread.currentThread().interrupt(); log.debug("Retry interrupted", e1); } } diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java index 1971535b622..c404214bac9 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java @@ -145,6 +145,7 @@ public void run() { try { work.add(workQueue.take()); } catch (InterruptedException ex) { + Thread.currentThread().interrupt(); continue; } workQueue.drainTo(work); @@ -251,6 +252,7 @@ public void await() throws IOException { try { work.latch.await(); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } @@ -539,6 +541,7 @@ public void close() throws IOException { try { syncThread.join(); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } } diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java index 5cc5c26e56d..7c7dc3e6706 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java @@ -300,6 +300,7 @@ public void run() { try { nextLog.offer(t, 12, TimeUnit.HOURS); } catch (InterruptedException ex) { + Thread.currentThread().interrupt(); // Throw an Error, not an Exception, so the AccumuloUncaughtExceptionHandler // will log this then halt the VM. throw new Error("Next log maker thread interrupted", ex); @@ -338,6 +339,7 @@ public void run() { try { nextLog.offer(t, 12, TimeUnit.HOURS); } catch (InterruptedException ex) { + Thread.currentThread().interrupt(); // Throw an Error, not an Exception, so the AccumuloUncaughtExceptionHandler // will log this then halt the VM. throw new Error("Next log maker thread interrupted", ex); @@ -351,6 +353,7 @@ public void run() { log.info("Our WAL was not used for 12 hours: {}", fileName); } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); // Throw an Error, not an Exception, so the AccumuloUncaughtExceptionHandler // will log this then halt the VM. throw new Error("Next log maker thread interrupted", e); diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/replication/ReplicationWorker.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/replication/ReplicationWorker.java index cd733d4baed..5e3fa74adb0 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/replication/ReplicationWorker.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/replication/ReplicationWorker.java @@ -73,6 +73,9 @@ public void run() { workQueue.startProcessing(new ReplicationProcessor(server.getContext()), executor); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException(e); } } diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/session/SessionManager.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/session/SessionManager.java index 0726c1997cb..01adc3cad0d 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/session/SessionManager.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/session/SessionManager.java @@ -139,6 +139,7 @@ public Session reserveSession(long sessionId, boolean wait) { try { session.wait(1000); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(); } } diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CommitSession.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CommitSession.java index 26dd6a1c8b8..d838e0702e0 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CommitSession.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CommitSession.java @@ -73,6 +73,7 @@ public void waitForCommitsToFinish() { try { committer.wait(50); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.warn("InterruptedException", e); } } diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/DatafileManager.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/DatafileManager.java index 255fcbdcfae..fd0b116d5dc 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/DatafileManager.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/DatafileManager.java @@ -209,6 +209,7 @@ private TreeSet waitForScansToFinish(Set pat try { tablet.wait(100); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.warn("{}", e.getMessage(), e); } } diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/MinorCompactor.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/MinorCompactor.java index 93f73dbd2ed..aac2be3dd5e 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/MinorCompactor.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/MinorCompactor.java @@ -138,6 +138,9 @@ public CompactionStats call() { reportedProblem = true; retryCounter++; } catch (CompactionCanceledException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException(e); } diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Scanner.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Scanner.java index 9e2a7c7af03..37c1160ebf3 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Scanner.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Scanner.java @@ -103,6 +103,7 @@ private Pair readInternal() throws IOException, Tablet // would not handle that well. readInProgress = true; } catch (InterruptedException e) { + Thread.currentThread().interrupt(); sawException = true; } @@ -232,6 +233,7 @@ public boolean close() { isolatedDataSource.close(false); } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); return false; } finally { if (obtainedLock) { diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java index 8798abde4c4..32d21c1db56 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java @@ -719,6 +719,9 @@ public long getFlushID() throws NoNodeException { String id = new String(context.getZooReaderWriter().getData(zTablePath), UTF_8); return Long.parseLong(id); } catch (InterruptedException | NumberFormatException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException("Exception on " + extent + " getting flush ID", e); } catch (KeeperException ke) { if (ke instanceof NoNodeException) { @@ -769,6 +772,9 @@ public Pair getCompactionID() throws NoNodeException { return new Pair<>(compactID, overlappingConfig); } catch (InterruptedException | DecoderException | NumberFormatException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException("Exception on " + extent + " getting compaction ID", e); } catch (KeeperException ke) { if (ke instanceof NoNodeException) { @@ -1024,6 +1030,7 @@ void initiateClose(boolean saveState) { try { this.wait(50); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error(e.toString()); } } @@ -1093,6 +1100,7 @@ synchronized void completeClose(boolean saveState, boolean completeClose) throws runningScans.size()); this.wait(50); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("Interrupted waiting to completeClose for extent {}", extent, e); } } diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletMemory.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletMemory.java index f5b81ff8a79..3f0a3840864 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletMemory.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletMemory.java @@ -136,6 +136,7 @@ public void waitForMinC() { try { tablet.wait(50); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.warn("{}", e.getMessage(), e); } } diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoader.java b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoader.java index 4dccc077a39..22e576d492b 100644 --- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoader.java +++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoader.java @@ -102,6 +102,7 @@ public void run() { currentSleepMillis = Math.min(maxWaitInterval, currentSleepMillis + sleepInterval); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.error("VFS Retry Interrupted", e); throw new RuntimeException(e); } @@ -135,6 +136,7 @@ public void run() { try { Thread.sleep(DEFAULT_TIMEOUT); } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); log.error("{}", ie.getMessage(), ie); } } diff --git a/test/src/main/java/org/apache/accumulo/test/BatchWriterIterator.java b/test/src/main/java/org/apache/accumulo/test/BatchWriterIterator.java index 2b009f909e7..f74bc7fbd5a 100644 --- a/test/src/main/java/org/apache/accumulo/test/BatchWriterIterator.java +++ b/test/src/main/java/org/apache/accumulo/test/BatchWriterIterator.java @@ -227,7 +227,9 @@ private void processNext() { if (sleepAfterFirstWrite > 0) { try { Thread.sleep(sleepAfterFirstWrite); - } catch (InterruptedException ignored) {} + } catch (InterruptedException ignored) { + Thread.currentThread().interrupt(); + } } firstWrite = false; } diff --git a/test/src/main/java/org/apache/accumulo/test/MultiTableRecoveryIT.java b/test/src/main/java/org/apache/accumulo/test/MultiTableRecoveryIT.java index 255676bd3ed..c30f4d632e0 100644 --- a/test/src/main/java/org/apache/accumulo/test/MultiTableRecoveryIT.java +++ b/test/src/main/java/org/apache/accumulo/test/MultiTableRecoveryIT.java @@ -138,6 +138,9 @@ private Thread agitator(final AtomicBoolean stop) { } System.out.println("Restarted " + i + " times"); } catch (IOException | InterruptedException | TableNotFoundException ex) { + if (ex instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } log.error("{}", ex.getMessage(), ex); } }); diff --git a/test/src/main/java/org/apache/accumulo/test/ScanConsistencyIT.java b/test/src/main/java/org/apache/accumulo/test/ScanConsistencyIT.java index 0c03de99b02..c75f5c413f3 100644 --- a/test/src/main/java/org/apache/accumulo/test/ScanConsistencyIT.java +++ b/test/src/main/java/org/apache/accumulo/test/ScanConsistencyIT.java @@ -261,6 +261,7 @@ synchronized void reserveForDelete() { try { wait(50); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } } diff --git a/test/src/main/java/org/apache/accumulo/test/ScanServerMultipleScansIT.java b/test/src/main/java/org/apache/accumulo/test/ScanServerMultipleScansIT.java index 6283037c801..50c7400a36a 100644 --- a/test/src/main/java/org/apache/accumulo/test/ScanServerMultipleScansIT.java +++ b/test/src/main/java/org/apache/accumulo/test/ScanServerMultipleScansIT.java @@ -131,6 +131,7 @@ public void testMultipleScansSameTablet() throws Exception { try { latch.await(); } catch (InterruptedException e1) { + Thread.currentThread().interrupt(); fail("InterruptedException waiting for latch"); } try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) { @@ -199,6 +200,7 @@ public void testMultipleScansDifferentTablets() throws Exception { try { latch.await(); } catch (InterruptedException e1) { + Thread.currentThread().interrupt(); fail("InterruptedException waiting for latch"); } try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) { @@ -254,6 +256,7 @@ public void testMultipleBatchScansSameTablet() throws Exception { try { latch.await(); } catch (InterruptedException e1) { + Thread.currentThread().interrupt(); fail("InterruptedException waiting for latch"); } try (BatchScanner scanner = client.createBatchScanner(tableName, Authorizations.EMPTY)) { @@ -321,6 +324,7 @@ public void testMultipleBatchScansDifferentTablets() throws Exception { try { latch.await(); } catch (InterruptedException e1) { + Thread.currentThread().interrupt(); fail("InterruptedException waiting for latch"); } try (BatchScanner scanner = client.createBatchScanner(tableName, Authorizations.EMPTY)) { diff --git a/test/src/main/java/org/apache/accumulo/test/ZombieScanIT.java b/test/src/main/java/org/apache/accumulo/test/ZombieScanIT.java index 82788054105..6edfffb8343 100644 --- a/test/src/main/java/org/apache/accumulo/test/ZombieScanIT.java +++ b/test/src/main/java/org/apache/accumulo/test/ZombieScanIT.java @@ -129,6 +129,7 @@ public boolean hasTop() { semaphore.acquire(6); return ht; } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); throw new IllegalStateException(ie); } } diff --git a/test/src/main/java/org/apache/accumulo/test/ZooKeeperPropertiesIT.java b/test/src/main/java/org/apache/accumulo/test/ZooKeeperPropertiesIT.java index 99b120e9bf5..fc6e2f9dd30 100644 --- a/test/src/main/java/org/apache/accumulo/test/ZooKeeperPropertiesIT.java +++ b/test/src/main/java/org/apache/accumulo/test/ZooKeeperPropertiesIT.java @@ -81,6 +81,7 @@ public void testTablePropUtils() throws AccumuloException, TableExistsException, try { Thread.sleep(250); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); fail("Thread interrupted while waiting for tablePropUtil update"); } properties = client.tableOperations().getConfiguration(tableName); @@ -94,6 +95,7 @@ public void testTablePropUtils() throws AccumuloException, TableExistsException, try { Thread.sleep(250); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); fail("Thread interrupted while waiting for tablePropUtil update"); } properties = client.tableOperations().getConfiguration(tableName); @@ -134,6 +136,7 @@ public void testNamespacePropUtils() throws AccumuloException, AccumuloSecurityE try { Thread.sleep(250); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); fail("Thread interrupted while waiting for namespacePropUtil update"); } properties = client.namespaceOperations().getConfiguration(namespace); @@ -147,6 +150,7 @@ public void testNamespacePropUtils() throws AccumuloException, AccumuloSecurityE try { Thread.sleep(250); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); fail("Thread interrupted while waiting for namespacePropUtil update"); } properties = client.namespaceOperations().getConfiguration(namespace); diff --git a/test/src/main/java/org/apache/accumulo/test/conf/store/PropCacheCaffeineImplZkIT.java b/test/src/main/java/org/apache/accumulo/test/conf/store/PropCacheCaffeineImplZkIT.java index 22d06b83a18..24be32b9c46 100644 --- a/test/src/main/java/org/apache/accumulo/test/conf/store/PropCacheCaffeineImplZkIT.java +++ b/test/src/main/java/org/apache/accumulo/test/conf/store/PropCacheCaffeineImplZkIT.java @@ -133,6 +133,9 @@ public void cleanupZnodes() { try { ZKUtil.deleteRecursive(zooKeeper, "/accumulo"); } catch (KeeperException | InterruptedException ex) { + if (ex instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Failed to clean-up test zooKeeper nodes.", ex); } } diff --git a/test/src/main/java/org/apache/accumulo/test/conf/store/PropStoreZooKeeperIT.java b/test/src/main/java/org/apache/accumulo/test/conf/store/PropStoreZooKeeperIT.java index 55c5b193aca..a20b241e4da 100644 --- a/test/src/main/java/org/apache/accumulo/test/conf/store/PropStoreZooKeeperIT.java +++ b/test/src/main/java/org/apache/accumulo/test/conf/store/PropStoreZooKeeperIT.java @@ -134,6 +134,9 @@ public void cleanupZnodes() { try { ZKUtil.deleteRecursive(zooKeeper, "/accumulo"); } catch (KeeperException | InterruptedException ex) { + if (ex instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Failed to clean-up test zooKeeper nodes.", ex); } } diff --git a/test/src/main/java/org/apache/accumulo/test/conf/store/ZooBasedConfigIT.java b/test/src/main/java/org/apache/accumulo/test/conf/store/ZooBasedConfigIT.java index 2004d09af8a..b884111b4f5 100644 --- a/test/src/main/java/org/apache/accumulo/test/conf/store/ZooBasedConfigIT.java +++ b/test/src/main/java/org/apache/accumulo/test/conf/store/ZooBasedConfigIT.java @@ -173,6 +173,9 @@ public void cleanupZnodes() { try { ZKUtil.deleteRecursive(zooKeeper, "/accumulo"); } catch (KeeperException | InterruptedException ex) { + if (ex instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Failed to clean-up test zooKeeper nodes.", ex); } verify(context); diff --git a/test/src/main/java/org/apache/accumulo/test/conf/util/ConfigTransformerIT.java b/test/src/main/java/org/apache/accumulo/test/conf/util/ConfigTransformerIT.java index a3a59ca992d..ce2252a6611 100644 --- a/test/src/main/java/org/apache/accumulo/test/conf/util/ConfigTransformerIT.java +++ b/test/src/main/java/org/apache/accumulo/test/conf/util/ConfigTransformerIT.java @@ -121,6 +121,9 @@ public void cleanupZnodes() { try { ZKUtil.deleteRecursive(zooKeeper, Constants.ZROOT); } catch (KeeperException | InterruptedException ex) { + if (ex instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Failed to clean-up test zooKeeper nodes.", ex); } verify(context, watcher); diff --git a/test/src/main/java/org/apache/accumulo/test/fate/zookeeper/FateIT.java b/test/src/main/java/org/apache/accumulo/test/fate/zookeeper/FateIT.java index 6293ed601e3..f636cdfc339 100644 --- a/test/src/main/java/org/apache/accumulo/test/fate/zookeeper/FateIT.java +++ b/test/src/main/java/org/apache/accumulo/test/fate/zookeeper/FateIT.java @@ -570,6 +570,7 @@ private static void inCall() throws InterruptedException { // wait for the signal to exit the method finishCall.await(); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); LOG.debug("InterruptedException occurred inCall."); interruptedException.set(e); throw e; diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java index f1ab650525f..b51bde66d45 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java @@ -94,6 +94,9 @@ public void testConcurrentDeleteTablesOps() throws Exception { } catch (TableNotFoundException e) { // expected } catch (InterruptedException | AccumuloException | AccumuloSecurityException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException(e); } })); @@ -149,6 +152,9 @@ public void testConcurrentFateOpsWithDelete() throws Exception { } catch (TableNotFoundException | TableOfflineException e) { // expected } catch (InterruptedException | AccumuloException | AccumuloSecurityException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException(e); } })); diff --git a/test/src/main/java/org/apache/accumulo/test/functional/FateConcurrencyIT.java b/test/src/main/java/org/apache/accumulo/test/functional/FateConcurrencyIT.java index 6a910edb4a2..724d2918223 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/FateConcurrencyIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/FateConcurrencyIT.java @@ -359,6 +359,9 @@ private boolean lookupFateInZookeeper(final String tableName) throws KeeperExcep } } catch (TableNotFoundException | InterruptedException ex) { + if (ex instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException(ex); } diff --git a/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java b/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java index 75977c66e9d..358333f7ee5 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java @@ -222,6 +222,9 @@ private static FateStatus getFateStatus(AccumuloCluster cluster) { var lockPath = ServiceLock.path(context.getZooKeeperRoot() + Constants.ZTABLE_LOCKS); return admin.getStatus(zs, zk, lockPath, null, null); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new RuntimeException(e); } } diff --git a/test/src/main/java/org/apache/accumulo/test/functional/HalfDeadServerWatcherIT.java b/test/src/main/java/org/apache/accumulo/test/functional/HalfDeadServerWatcherIT.java index 355d3265ff6..e4a63f476d1 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/HalfDeadServerWatcherIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/HalfDeadServerWatcherIT.java @@ -105,6 +105,9 @@ protected TreeMap splitTablet(Tablet tablet, byte[] splitP try { this.getContext().getZooReaderWriter().exists(tableZPath, new StuckWatcher()); } catch (KeeperException | InterruptedException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } LOG.error("Error setting watch at: {}", tableZPath, e); } LOG.info("Set StuckWatcher at: {}", tableZPath); diff --git a/test/src/main/java/org/apache/accumulo/test/functional/SlowIterator.java b/test/src/main/java/org/apache/accumulo/test/functional/SlowIterator.java index d9c8ddca129..1a22a7d6622 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/SlowIterator.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/SlowIterator.java @@ -62,6 +62,7 @@ private void sleep(long time) throws IOException { try { Thread.sleep(sleepTime); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new IOException(e); } } diff --git a/test/src/main/java/org/apache/accumulo/test/replication/ReplicationOperationsImplIT.java b/test/src/main/java/org/apache/accumulo/test/replication/ReplicationOperationsImplIT.java index e84a1374401..8e880c8d1e1 100644 --- a/test/src/main/java/org/apache/accumulo/test/replication/ReplicationOperationsImplIT.java +++ b/test/src/main/java/org/apache/accumulo/test/replication/ReplicationOperationsImplIT.java @@ -200,6 +200,7 @@ public void waitsUntilEntriesAreReplicated() throws Exception { try { t.join(5000); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); fail("ReplicationOperations.drain did not complete"); } @@ -284,6 +285,7 @@ public void unrelatedReplicationRecordsDontBlockDrain() throws Exception { try { t.join(5000); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); fail("ReplicationOperations.drain did not complete"); } @@ -362,6 +364,7 @@ public void inprogressReplicationRecordsBlockExecution() throws Exception { try { t.join(5000); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); fail("ReplicationOperations.drain did not complete"); } @@ -445,6 +448,7 @@ public void laterCreatedLogsDontBlockExecution() throws Exception { try { t.join(5000); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); fail("ReplicationOperations.drain did not complete"); } diff --git a/test/src/main/java/org/apache/accumulo/test/upgrade/ConfigPropertyUpgraderIT.java b/test/src/main/java/org/apache/accumulo/test/upgrade/ConfigPropertyUpgraderIT.java index 51f17f1c496..848cc53149d 100644 --- a/test/src/main/java/org/apache/accumulo/test/upgrade/ConfigPropertyUpgraderIT.java +++ b/test/src/main/java/org/apache/accumulo/test/upgrade/ConfigPropertyUpgraderIT.java @@ -118,6 +118,9 @@ public void cleanupZnodes() { try { ZKUtil.deleteRecursive(zooKeeper, Constants.ZROOT); } catch (KeeperException | InterruptedException ex) { + if (ex instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } throw new IllegalStateException("Failed to clean-up test zooKeeper nodes.", ex); } }