This is an automated email from the ASF dual-hosted git repository.
ctubbsii pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push:
new 59b1eca06e Clean up some Throwables (#6157)
59b1eca06e is described below
commit 59b1eca06e124b09bf613cf0c9a44337ae8b0808
Author: Christopher Tubbs <[email protected]>
AuthorDate: Fri Feb 27 16:25:47 2026 -0500
Clean up some Throwables (#6157)
* Remove unnecessary UnsatisfiedLinkError and NoClassDefFoundError
catches (added in #925 and #1644 to address issues before the reliance
on the UEH), relying on the AccumuloUncaughtExceptionHandler (UEH)
instead for MinorCompactor
* Rename incorrectly named internal LocalityGroupConfigurationError to
LocalityGroupConfigurationException
* Replace `new Error` with `new IllegalStateException` for critical
threads
* Make TabletServerLogger.startLogMaker use a critical thread instead of
a fixed size thread pool, removing dead code and being more specific
with exceptions
* Make critical thread halt logic the same as for the UEH, best effort
to see the error message (like showing the thread id and flushing
STDERR)
* Remove Error catch from tserver.tablet.Tablet and clean up some
exception handling, deleting some throws statements for exceptions not
thrown in the implementation
* (trivial) fix typo in UEH comment
* (trivial) remove unused logger in EventQueue
---
.../core/client/admin/NewTableConfiguration.java | 4 +-
.../core/clientImpl/InstanceOperationsImpl.java | 4 +-
.../core/clientImpl/NamespaceOperationsImpl.java | 4 +-
.../clientImpl/ResourceGroupOperationsImpl.java | 4 +-
.../core/clientImpl/TableOperationsImpl.java | 4 +-
.../accumulo/core/util/LocalityGroupUtil.java | 27 +++---
.../threads/AccumuloUncaughtExceptionHandler.java | 2 +-
.../apache/accumulo/core/util/threads/Threads.java | 13 ++-
.../accumulo/core/util/LocalityGroupUtilTest.java | 6 +-
.../org/apache/accumulo/server/AbstractServer.java | 5 +-
.../accumulo/server/compaction/FileCompactor.java | 4 +-
.../accumulo/tserver/log/TabletServerLogger.java | 99 ++++++++--------------
.../accumulo/tserver/tablet/MinorCompactor.java | 4 +-
.../org/apache/accumulo/tserver/tablet/Tablet.java | 20 ++---
14 files changed, 91 insertions(+), 109 deletions(-)
diff --git
a/core/src/main/java/org/apache/accumulo/core/client/admin/NewTableConfiguration.java
b/core/src/main/java/org/apache/accumulo/core/client/admin/NewTableConfiguration.java
index eab83fcea2..11602878f5 100644
---
a/core/src/main/java/org/apache/accumulo/core/client/admin/NewTableConfiguration.java
+++
b/core/src/main/java/org/apache/accumulo/core/client/admin/NewTableConfiguration.java
@@ -48,7 +48,7 @@ import
org.apache.accumulo.core.iteratorsImpl.IteratorConfigUtil;
import org.apache.accumulo.core.sample.impl.SamplerConfigurationImpl;
import org.apache.accumulo.core.summary.SummarizerConfigurationUtil;
import org.apache.accumulo.core.util.LocalityGroupUtil;
-import
org.apache.accumulo.core.util.LocalityGroupUtil.LocalityGroupConfigurationError;
+import
org.apache.accumulo.core.util.LocalityGroupUtil.LocalityGroupConfigurationException;
import org.apache.hadoop.io.Text;
import com.google.common.base.Preconditions;
@@ -157,7 +157,7 @@ public class NewTableConfiguration {
try {
LocalityGroupUtil.checkLocalityGroups(props);
- } catch (LocalityGroupConfigurationError e) {
+ } catch (LocalityGroupConfigurationException e) {
throw new IllegalArgumentException(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 bf72a7c21f..af9c4e3ca4 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
@@ -70,7 +70,7 @@ import
org.apache.accumulo.core.tabletserver.thrift.TabletServerClientService.Cl
import org.apache.accumulo.core.trace.TraceUtil;
import org.apache.accumulo.core.util.AddressUtil;
import org.apache.accumulo.core.util.LocalityGroupUtil;
-import
org.apache.accumulo.core.util.LocalityGroupUtil.LocalityGroupConfigurationError;
+import
org.apache.accumulo.core.util.LocalityGroupUtil.LocalityGroupConfigurationException;
import org.apache.accumulo.core.util.Retry;
import org.apache.accumulo.core.util.compaction.ExternalCompactionUtil;
import org.apache.accumulo.core.util.threads.ThreadPoolNames;
@@ -194,7 +194,7 @@ public class InstanceOperationsImpl implements
InstanceOperations {
if (LocalityGroupUtil.isLocalityGroupProperty(propChanged)) {
try {
LocalityGroupUtil.checkLocalityGroups(getSystemConfiguration());
- } catch (LocalityGroupConfigurationError | RuntimeException e) {
+ } catch (LocalityGroupConfigurationException | RuntimeException e) {
LoggerFactory.getLogger(this.getClass()).warn("Changing '" +
propChanged
+ "' resulted in bad locality group config. This may be a
transient situation since "
+ "the config spreads over multiple properties. Setting properties
in a different "
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 8da6d30846..21cec3a8a1 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
@@ -57,7 +57,7 @@ import org.apache.accumulo.core.manager.thrift.TFateOperation;
import org.apache.accumulo.core.rpc.clients.ThriftClientTypes;
import org.apache.accumulo.core.trace.TraceUtil;
import org.apache.accumulo.core.util.LocalityGroupUtil;
-import
org.apache.accumulo.core.util.LocalityGroupUtil.LocalityGroupConfigurationError;
+import
org.apache.accumulo.core.util.LocalityGroupUtil.LocalityGroupConfigurationException;
import org.apache.accumulo.core.util.Retry;
import org.apache.accumulo.core.util.Timer;
import org.slf4j.Logger;
@@ -409,7 +409,7 @@ public class NamespaceOperationsImpl extends
NamespaceOperationsHelper {
Map<String,String> allProps = getConfiguration(namespace);
try {
LocalityGroupUtil.checkLocalityGroups(allProps);
- } catch (LocalityGroupConfigurationError | RuntimeException e) {
+ } catch (LocalityGroupConfigurationException | RuntimeException e) {
LoggerFactory.getLogger(this.getClass()).warn("Changing '" +
propChanged
+ "' for namespace '" + namespace
+ "'resulted in bad locality group config. This may be a transient
situation since the"
diff --git
a/core/src/main/java/org/apache/accumulo/core/clientImpl/ResourceGroupOperationsImpl.java
b/core/src/main/java/org/apache/accumulo/core/clientImpl/ResourceGroupOperationsImpl.java
index b1158a8be8..0693a18000 100644
---
a/core/src/main/java/org/apache/accumulo/core/clientImpl/ResourceGroupOperationsImpl.java
+++
b/core/src/main/java/org/apache/accumulo/core/clientImpl/ResourceGroupOperationsImpl.java
@@ -40,7 +40,7 @@ import org.apache.accumulo.core.data.ResourceGroupId;
import org.apache.accumulo.core.rpc.clients.ThriftClientTypes;
import org.apache.accumulo.core.trace.TraceUtil;
import org.apache.accumulo.core.util.LocalityGroupUtil;
-import
org.apache.accumulo.core.util.LocalityGroupUtil.LocalityGroupConfigurationError;
+import
org.apache.accumulo.core.util.LocalityGroupUtil.LocalityGroupConfigurationException;
import org.apache.accumulo.core.util.Retry;
import org.slf4j.LoggerFactory;
@@ -263,7 +263,7 @@ public class ResourceGroupOperationsImpl implements
ResourceGroupOperations {
try {
LocalityGroupUtil
.checkLocalityGroups(context.instanceOperations().getSystemConfiguration());
- } catch (LocalityGroupConfigurationError | RuntimeException e) {
+ } catch (LocalityGroupConfigurationException | RuntimeException e) {
LoggerFactory.getLogger(this.getClass()).warn("Changing '" +
propChanged
+ "' resulted in bad locality group config. This may be a
transient situation since "
+ "the config spreads over multiple properties. Setting properties
in a different "
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 5b7ccd1cb2..3a9d428649 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
@@ -156,7 +156,7 @@ import
org.apache.accumulo.core.summary.SummarizerConfigurationUtil;
import org.apache.accumulo.core.summary.SummaryCollection;
import org.apache.accumulo.core.trace.TraceUtil;
import org.apache.accumulo.core.util.LocalityGroupUtil;
-import
org.apache.accumulo.core.util.LocalityGroupUtil.LocalityGroupConfigurationError;
+import
org.apache.accumulo.core.util.LocalityGroupUtil.LocalityGroupConfigurationException;
import org.apache.accumulo.core.util.MapCounter;
import org.apache.accumulo.core.util.Pair;
import org.apache.accumulo.core.util.Retry;
@@ -1157,7 +1157,7 @@ public class TableOperationsImpl extends
TableOperationsHelper {
Map<String,String> allProps = getConfiguration(tableName);
try {
LocalityGroupUtil.checkLocalityGroups(allProps);
- } catch (LocalityGroupConfigurationError | RuntimeException e) {
+ } catch (LocalityGroupConfigurationException | RuntimeException e) {
LoggerFactory.getLogger(this.getClass()).warn(
"Changing '{}' for table '{}' resulted in bad locality group
config. This may be a transient situation since the config spreads over
multiple properties. Setting properties in a different order may help. Even
though this warning was displayed, the property was updated. Please check your
config to ensure consistency.",
propChanged, tableName, e);
diff --git
a/core/src/main/java/org/apache/accumulo/core/util/LocalityGroupUtil.java
b/core/src/main/java/org/apache/accumulo/core/util/LocalityGroupUtil.java
index ee27c22091..aa22b983bf 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/LocalityGroupUtil.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/LocalityGroupUtil.java
@@ -76,10 +76,10 @@ public class LocalityGroupUtil {
.collect(toUnmodifiableSet());
}
- public static class LocalityGroupConfigurationError extends
AccumuloException {
- private static final long serialVersionUID = 855450342044719186L;
+ public static class LocalityGroupConfigurationException extends
AccumuloException {
+ private static final long serialVersionUID = 1L;
- LocalityGroupConfigurationError(String why) {
+ LocalityGroupConfigurationException(String why) {
super(why);
}
}
@@ -90,7 +90,7 @@ public class LocalityGroupUtil {
}
public static void checkLocalityGroups(Map<String,String> config)
- throws LocalityGroupConfigurationError {
+ throws LocalityGroupConfigurationException {
ConfigurationCopy cc = new ConfigurationCopy(config);
if (cc.get(Property.TABLE_LOCALITY_GROUPS) != null) {
getLocalityGroups(cc);
@@ -101,7 +101,7 @@ public class LocalityGroupUtil {
getLocalityGroupsIgnoringErrors(AccumuloConfiguration acuconf, TableId
tableId) {
try {
return getLocalityGroups(acuconf);
- } catch (LocalityGroupConfigurationError | RuntimeException e) {
+ } catch (LocalityGroupConfigurationException | RuntimeException e) {
log.warn("Failed to get locality group config for tableId:" + tableId
+ ", proceeding without locality groups.", e);
}
@@ -110,7 +110,7 @@ public class LocalityGroupUtil {
}
public static Map<String,Set<ByteSequence>>
getLocalityGroups(AccumuloConfiguration acuconf)
- throws LocalityGroupConfigurationError {
+ throws LocalityGroupConfigurationException {
Map<String,Set<ByteSequence>> result = new HashMap<>();
String[] groups = acuconf.get(Property.TABLE_LOCALITY_GROUPS).split(",");
for (String group : groups) {
@@ -132,8 +132,8 @@ public class LocalityGroupUtil {
Set<ByteSequence> colFamsSet = decodeColumnFamilies(value);
if (!Collections.disjoint(all, colFamsSet)) {
colFamsSet.retainAll(all);
- throw new LocalityGroupConfigurationError("Column families " +
colFamsSet + " in group "
- + group + " is already used by another locality group");
+ throw new LocalityGroupConfigurationException("Column families " +
colFamsSet
+ + " in group " + group + " is already used by another locality
group");
}
all.addAll(colFamsSet);
@@ -145,7 +145,7 @@ public class LocalityGroupUtil {
Set<Entry<String,Set<ByteSequence>>> es = result.entrySet();
for (Entry<String,Set<ByteSequence>> entry : es) {
if (entry.getValue().isEmpty()) {
- throw new LocalityGroupConfigurationError(
+ throw new LocalityGroupConfigurationException(
"Locality group " + entry.getKey() + " specified but not
declared");
}
}
@@ -155,7 +155,7 @@ public class LocalityGroupUtil {
}
public static Set<ByteSequence> decodeColumnFamilies(String colFams)
- throws LocalityGroupConfigurationError {
+ throws LocalityGroupConfigurationException {
HashSet<ByteSequence> colFamsSet = new HashSet<>();
for (String family : colFams.split(",")) {
@@ -167,7 +167,7 @@ public class LocalityGroupUtil {
}
public static ByteSequence decodeColumnFamily(String colFam)
- throws LocalityGroupConfigurationError {
+ throws LocalityGroupConfigurationException {
byte[] output = new byte[colFam.length()];
int pos = 0;
@@ -179,7 +179,8 @@ public class LocalityGroupUtil {
i++;
if (i >= colFam.length()) {
- throw new LocalityGroupConfigurationError("Expected 'x' or '\' after
'\' in " + colFam);
+ throw new LocalityGroupConfigurationException(
+ "Expected 'x' or '\' after '\' in " + colFam);
}
char nc = colFam.charAt(i);
@@ -195,7 +196,7 @@ public class LocalityGroupUtil {
i++;
break;
default:
- throw new LocalityGroupConfigurationError(
+ throw new LocalityGroupConfigurationException(
"Expected 'x' or '\' after '\' in " + colFam);
}
} else {
diff --git
a/core/src/main/java/org/apache/accumulo/core/util/threads/AccumuloUncaughtExceptionHandler.java
b/core/src/main/java/org/apache/accumulo/core/util/threads/AccumuloUncaughtExceptionHandler.java
index 3faa6e1e0e..39eaa00780 100644
---
a/core/src/main/java/org/apache/accumulo/core/util/threads/AccumuloUncaughtExceptionHandler.java
+++
b/core/src/main/java/org/apache/accumulo/core/util/threads/AccumuloUncaughtExceptionHandler.java
@@ -70,7 +70,7 @@ class AccumuloUncaughtExceptionHandler implements
UncaughtExceptionHandler {
System.err.println("Error thrown in thread: " + t + ", halting VM.");
System.err.flush();
} catch (Throwable e1) {
- // If e == OutOfMemoryError, then it's probably that another Error
might be
+ // If e == OutOfMemoryError, then it's probable that another Error
might be
// thrown when trying to print to System.err.
} finally {
Runtime.getRuntime().halt(-1);
diff --git
a/core/src/main/java/org/apache/accumulo/core/util/threads/Threads.java
b/core/src/main/java/org/apache/accumulo/core/util/threads/Threads.java
index 611f7a6755..8512d28d50 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/threads/Threads.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/threads/Threads.java
@@ -75,9 +75,16 @@ public class Threads {
try {
r.run();
} catch (RuntimeException e) {
- System.err.println("Critical thread " + name + " died");
- e.printStackTrace();
- Runtime.getRuntime().halt(-1);
+ try {
+ e.printStackTrace();
+ System.err.println("Critical thread died: " + Thread.currentThread()
+ ", halting VM.");
+ System.err.flush();
+ } catch (Throwable e1) {
+ // If e == OutOfMemoryError, then it's probable that another Error
might be
+ // thrown when trying to print to System.err.
+ } finally {
+ Runtime.getRuntime().halt(-1);
+ }
}
};
diff --git
a/core/src/test/java/org/apache/accumulo/core/util/LocalityGroupUtilTest.java
b/core/src/test/java/org/apache/accumulo/core/util/LocalityGroupUtilTest.java
index 5203f1b697..13b0c3ad77 100644
---
a/core/src/test/java/org/apache/accumulo/core/util/LocalityGroupUtilTest.java
+++
b/core/src/test/java/org/apache/accumulo/core/util/LocalityGroupUtilTest.java
@@ -31,7 +31,7 @@ import java.util.Set;
import org.apache.accumulo.core.conf.ConfigurationCopy;
import org.apache.accumulo.core.data.ArrayByteSequence;
import org.apache.accumulo.core.data.ByteSequence;
-import
org.apache.accumulo.core.util.LocalityGroupUtil.LocalityGroupConfigurationError;
+import
org.apache.accumulo.core.util.LocalityGroupUtil.LocalityGroupConfigurationException;
import org.apache.hadoop.io.Text;
import org.junit.jupiter.api.Test;
@@ -49,13 +49,13 @@ public class LocalityGroupUtilTest {
assertNotNull(groups.get("lg1"));
assertEquals(2, groups.get("lg1").size());
assertTrue(groups.get("lg1").contains(new ArrayByteSequence("cf1")));
- } catch (LocalityGroupConfigurationError err) {
+ } catch (LocalityGroupConfigurationException err) {
fail();
}
conf.set("table.group.lg2", "cf1");
conf.set("table.groups.enabled", "lg1,lg2");
- assertThrows(LocalityGroupConfigurationError.class,
+ assertThrows(LocalityGroupConfigurationException.class,
() -> LocalityGroupUtil.getLocalityGroups(conf));
}
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 6c59946891..db0fa6f818 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
@@ -449,8 +449,9 @@ public abstract class AbstractServer
Thread.sleep(interval);
} catch (InterruptedException e) {
if (serverThread.isAlive()) {
- // throw an Error, which will cause this process to be
terminated
- throw new Error("Sleep interrupted in ServiceLock
verification thread");
+ // this is marked as a critical thread, and will halt the
process when it dies
+ throw new IllegalStateException(
+ "Sleep interrupted in ServiceLock verification thread",
e);
}
}
}
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/compaction/FileCompactor.java
b/server/base/src/main/java/org/apache/accumulo/server/compaction/FileCompactor.java
index 1e5d204638..763855267d 100644
---
a/server/base/src/main/java/org/apache/accumulo/server/compaction/FileCompactor.java
+++
b/server/base/src/main/java/org/apache/accumulo/server/compaction/FileCompactor.java
@@ -73,7 +73,7 @@ import org.apache.accumulo.core.spi.crypto.CryptoService;
import org.apache.accumulo.core.tabletserver.thrift.TCompactionReason;
import org.apache.accumulo.core.trace.TraceUtil;
import org.apache.accumulo.core.util.LocalityGroupUtil;
-import
org.apache.accumulo.core.util.LocalityGroupUtil.LocalityGroupConfigurationError;
+import
org.apache.accumulo.core.util.LocalityGroupUtil.LocalityGroupConfigurationException;
import org.apache.accumulo.core.util.Timer;
import org.apache.accumulo.server.ServerContext;
import org.apache.accumulo.server.fs.VolumeManager;
@@ -303,7 +303,7 @@ public class FileCompactor implements
Callable<CompactionStats> {
throws IOException {
try {
return LocalityGroupUtil.getLocalityGroups(acuTableConf);
- } catch (LocalityGroupConfigurationError e) {
+ } catch (LocalityGroupConfigurationException e) {
throw new IOException(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 64bd7397f9..eccfff03ab 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
@@ -30,7 +30,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
@@ -50,15 +49,14 @@ import org.apache.accumulo.core.tabletserver.log.LogEntry;
import org.apache.accumulo.core.util.Halt;
import org.apache.accumulo.core.util.Retry;
import org.apache.accumulo.core.util.Retry.RetryFactory;
-import org.apache.accumulo.core.util.threads.ThreadPools;
+import org.apache.accumulo.core.util.threads.Threads;
import org.apache.accumulo.server.ServerContext;
-import org.apache.accumulo.server.fs.VolumeManager;
+import org.apache.accumulo.server.log.WalStateManager.WalMarkerException;
import org.apache.accumulo.tserver.TabletMutations;
import org.apache.accumulo.tserver.TabletServer;
import org.apache.accumulo.tserver.TabletServerResourceManager;
import org.apache.accumulo.tserver.log.DfsLogger.LoggerOperation;
import org.apache.accumulo.tserver.tablet.CommitSession;
-import org.apache.hadoop.fs.Path;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -87,7 +85,7 @@ public class TabletServerLogger {
// The current logger
private DfsLogger currentLog = null;
private final SynchronousQueue<Object> nextLog = new SynchronousQueue<>();
- private ThreadPoolExecutor nextLogMaker;
+ private Thread nextLogMaker = null;
// The current generation of logs.
// Because multiple threads can be using a log at one time, a log
@@ -271,45 +269,22 @@ public class TabletServerLogger {
if (nextLogMaker != null) {
return;
}
- nextLogMaker =
ThreadPools.getServerThreadPools().getPoolBuilder(TSERVER_WAL_CREATOR_POOL)
- .numCoreThreads(1).enableThreadPoolMetrics().build();
- nextLogMaker.execute(() -> {
- final VolumeManager fs = tserver.getVolumeManager();
- while (!nextLogMaker.isShutdown()) {
+ Thread newThread =
Threads.createCriticalThread(TSERVER_WAL_CREATOR_POOL.poolName, () -> {
+ while (true) {
log.debug("Creating next WAL");
- DfsLogger alog = null;
+ final DfsLogger alog;
try {
alog = DfsLogger.createNew(tserver.getContext(), syncCounter,
flushCounter,
tserver.getAdvertiseAddress().toString());
- } catch (Exception t) {
- log.error("Failed to open WAL", t);
- // the log is not advertised in ZK yet, so we can just delete it if
it exists
- if (alog != null) {
- try {
- alog.close();
- } catch (Exception e) {
- log.error("Failed to close WAL after it failed to open", e);
- }
-
- try {
- Path path = alog.getPath();
- if (fs.exists(path)) {
- fs.delete(path);
- }
- } catch (Exception e) {
- log.warn("Failed to delete a WAL that failed to open", e);
- }
- }
-
+ } catch (IOException | RuntimeException e) {
+ log.error("Failed to open WAL", e);
try {
- nextLog.offer(t, 12, TimeUnit.HOURS);
+ nextLog.offer(e, 12, TimeUnit.HOURS);
} catch (InterruptedException ex) {
- // 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);
+ // This is a critical thread, so dying will log this then halt the
VM.
+ throw new IllegalStateException("Next log maker thread
interrupted", ex);
}
-
continue;
}
@@ -317,15 +292,15 @@ public class TabletServerLogger {
try {
tserver.addNewLogMarker(alog);
- } catch (Exception t) {
- log.error("Failed to add new WAL marker for " + alog.getLogEntry(),
t);
+ } catch (Exception e) {
+ log.error("Failed to add new WAL marker for " + alog.getLogEntry(),
e);
try {
// Intentionally not deleting walog because it may have been
advertised in ZK. See
// #949
alog.close();
- } catch (Exception e) {
- log.error("Failed to close WAL after it failed to open", e);
+ } catch (IOException | RuntimeException e2) {
+ log.error("Failed to close WAL after it failed to open", e2);
}
// it's possible the log was advertised in ZK even though we got an
@@ -335,16 +310,15 @@ public class TabletServerLogger {
// expiration and the GC will also clean it up.
try {
tserver.walogClosed(alog);
- } catch (Exception e) {
- log.error("Failed to close WAL that failed to open: " +
alog.getLogEntry(), e);
+ } catch (WalMarkerException | RuntimeException e2) {
+ log.error("Failed to close WAL that failed to open: " +
alog.getLogEntry(), e2);
}
try {
- nextLog.offer(t, 12, TimeUnit.HOURS);
- } catch (InterruptedException ex) {
- // 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);
+ nextLog.offer(e, 12, TimeUnit.HOURS);
+ } catch (InterruptedException e2) {
+ // This is a critical thread, so dying will log this then halt the
VM.
+ throw new IllegalStateException("Next log maker thread
interrupted", e2);
}
continue;
@@ -355,34 +329,35 @@ public class TabletServerLogger {
log.info("Our WAL was not used for 12 hours: {}",
alog.getLogEntry());
}
} catch (InterruptedException e) {
- // 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);
+ // This is a critical thread, so dying will log this then halt the
VM.
+ throw new IllegalStateException("Next log maker thread interrupted",
e);
}
}
});
+ newThread.start();
+ nextLogMaker = newThread;
}
private synchronized void close() throws IOException {
if (!logIdLock.isWriteLockedByCurrentThread()) {
throw new IllegalStateException("close should be called with write lock
held!");
}
- try {
- if (currentLog != null) {
+ if (currentLog != null) {
+ try {
+ currentLog.close();
+ } catch (DfsLogger.LogClosedException ex) {
+ // ignore
+ } catch (IOException | RuntimeException ex) {
+ log.error("Unable to cleanly close log " + currentLog.getLogEntry() +
": " + ex, ex);
+ } finally {
try {
- currentLog.close();
- } catch (DfsLogger.LogClosedException ex) {
- // ignore
- } catch (Exception ex) {
- log.error("Unable to cleanly close log " + currentLog.getLogEntry()
+ ": " + ex, ex);
- } finally {
this.tserver.walogClosed(currentLog);
- currentLog = null;
- logSizeEstimate.set(0);
+ } catch (WalMarkerException | RuntimeException t) {
+ throw new IOException(t);
}
+ currentLog = null;
+ logSizeEstimate.set(0);
}
- } catch (Exception t) {
- throw new IOException(t);
}
}
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 113aa1928d..a30305c265 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
@@ -106,9 +106,9 @@ public class MinorCompactor extends FileCompactor {
}
return ret;
- } catch (IOException | ReflectiveOperationException |
UnsatisfiedLinkError e) {
+ } catch (IOException | ReflectiveOperationException e) {
log.warn("MinC failed ({}) to create {} retrying ...",
e.getMessage(), outputFileName);
- } catch (RuntimeException | NoClassDefFoundError e) {
+ } catch (RuntimeException e) {
// if this is coming from a user iterator, it is possible that the
user could change the
// iterator config and that the minor compaction would succeed
// If the minor compaction stalls for too long during recovery, it
can interfere with
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 e680276633..fa38dceeb8 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
@@ -222,7 +222,7 @@ public class Tablet extends TabletBase {
public boolean closed = false;
}
- ReferencedTabletFile getNextDataFilename(FilePrefix prefix) throws
IOException {
+ ReferencedTabletFile getNextDataFilename(FilePrefix prefix) {
return TabletNameGenerator.getNextDataFilename(prefix, context, extent,
getMetadata().getDirName(), dir -> checkTabletDir(new Path(dir)));
}
@@ -249,8 +249,7 @@ public class Tablet extends TabletBase {
}
public Tablet(final TabletServer tabletServer, final KeyExtent extent,
- final TabletResourceManager trm, TabletMetadata metadata)
- throws IOException, IllegalArgumentException {
+ final TabletResourceManager trm, TabletMetadata metadata) {
super(tabletServer, extent);
@@ -322,7 +321,7 @@ public class Tablet extends TabletBase {
logEntries.clear();
}
- } catch (Exception t) {
+ } catch (IOException | RuntimeException t) {
String msg = "Error recovering tablet " + extent + " from log files";
if (tableConfiguration.getBoolean(Property.TABLE_FAILURES_IGNORE)) {
log.warn(msg, t);
@@ -399,7 +398,7 @@ public class Tablet extends TabletBase {
MinorCompactor compactor = new MinorCompactor(tabletServer, this,
memTable, tmpDatafile,
mincReason, tableConfiguration);
stats = compactor.call();
- } catch (Exception e) {
+ } catch (RuntimeException e) {
TraceUtil.setException(span, e, true);
throw e;
} finally {
@@ -411,7 +410,7 @@ public class Tablet extends TabletBase {
bringMinorCompactionOnline(tmpDatafile, newDatafile,
new DataFileValue(stats.getFileSize(), stats.getEntriesWritten()),
commitSession,
flushId, mincReason);
- } catch (Exception e) {
+ } catch (RuntimeException e) {
final ServiceLock tserverLock = tabletServer.getLock();
if (tserverLock == null || !tserverLock.verifyLockAtSource()) {
log.error("Minor compaction of {} has failed and TabletServer lock
does not exist."
@@ -426,14 +425,14 @@ public class Tablet extends TabletBase {
}
return new DataFileValue(stats.getFileSize(), stats.getEntriesWritten());
- } catch (Exception | Error e) {
+ } catch (RuntimeException e) {
failed = true;
throw new RuntimeException("Exception occurred during minor compaction
on " + extent, e);
} finally {
Thread.currentThread().setName(oldName);
try {
getTabletMemory().finalizeMinC();
- } catch (Exception t) {
+ } catch (RuntimeException t) {
log.error("Failed to free tablet memory on {}", extent, t);
}
@@ -1010,7 +1009,7 @@ public class Tablet extends TabletBase {
try {
getTabletMemory().getMemTable().delete(0);
- } catch (Exception t) {
+ } catch (RuntimeException t) {
log.error("Failed to delete mem table : " + t.getMessage() + " for
tablet " + extent, t);
}
@@ -1054,11 +1053,10 @@ public class Tablet extends TabletBase {
log.error(msg);
throw new RuntimeException(msg);
}
- } catch (Exception e) {
+ } catch (RuntimeException e) {
String msg = "Failed to do close consistency check for tablet " + extent;
log.error(msg, e);
throw new RuntimeException(msg, e);
-
}
if (!otherLogs.isEmpty() || !currentLogs.isEmpty() ||
!referencedLogs.isEmpty()) {