This is an automated email from the ASF dual-hosted git repository.
dlmarion 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 93e12de006 Changed return type of CheckRunner.runCheck to a boolean
(#6167)
93e12de006 is described below
commit 93e12de0067b4ed2e07c37958a41b3fc43d8a657
Author: Dave Marion <[email protected]>
AuthorDate: Wed Mar 4 14:47:20 2026 -0500
Changed return type of CheckRunner.runCheck to a boolean (#6167)
Closes #6110
---
.../server/util/adminCommand/SystemCheck.java | 3 +-
.../server/util/checkCommand/CheckRunner.java | 10 +++---
.../util/checkCommand/MetadataCheckRunner.java | 18 +++++-----
.../checkCommand/MetadataTableCheckRunner.java | 15 ++++----
.../util/checkCommand/RootMetadataCheckRunner.java | 20 +++++------
.../util/checkCommand/RootTableCheckRunner.java | 15 ++++----
.../util/checkCommand/ServerConfigCheckRunner.java | 9 +++--
.../util/checkCommand/SystemConfigCheckRunner.java | 40 ++++++++++------------
.../util/checkCommand/SystemFilesCheckRunner.java | 7 ++--
.../util/checkCommand/TableLocksCheckRunner.java | 14 ++++----
.../util/checkCommand/UserFilesCheckRunner.java | 7 ++--
.../org/apache/accumulo/test/SystemCheckIT.java | 8 ++---
12 files changed, 78 insertions(+), 88 deletions(-)
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/util/adminCommand/SystemCheck.java
b/server/base/src/main/java/org/apache/accumulo/server/util/adminCommand/SystemCheck.java
index af043fd4a9..0fa57b6f82 100644
---
a/server/base/src/main/java/org/apache/accumulo/server/util/adminCommand/SystemCheck.java
+++
b/server/base/src/main/java/org/apache/accumulo/server/util/adminCommand/SystemCheck.java
@@ -241,7 +241,8 @@ public class SystemCheck extends
ServerKeywordExecutable<CheckCommandOpts> {
checkStatus.put(check, CheckStatus.SKIPPED_DEPENDENCY_FAILED);
} else {
if (givenChecks.contains(check)) {
- checkStatus.put(check, cmd.getCheckRunner(check).runCheck(context,
cmd, cmd.fixFiles));
+ checkStatus.put(check, cmd.getCheckRunner(check).runCheck(context,
cmd, cmd.fixFiles)
+ ? CheckStatus.OK : CheckStatus.FAILED);
} else {
checkStatus.put(check, CheckStatus.FILTERED_OUT);
}
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/CheckRunner.java
b/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/CheckRunner.java
index 75940b5574..0bb59e778b 100644
---
a/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/CheckRunner.java
+++
b/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/CheckRunner.java
@@ -35,10 +35,9 @@ public interface CheckRunner {
* @param opts server util opts. Only applicable for the checks on the root
and metadata tables
* @param fixFiles remove dangling file pointers. Only applicable for the
checks on the system and
* user files
- * @return the {@link
org.apache.accumulo.server.util.adminCommand.SystemCheck.CheckStatus}
- * resulting from running the check
+ * @return true if check passes, else false
*/
- CheckStatus runCheck(ServerContext context, ServerOpts opts, boolean
fixFiles) throws Exception;
+ boolean runCheck(ServerContext context, ServerOpts opts, boolean fixFiles)
throws Exception;
/**
*
@@ -53,8 +52,9 @@ public interface CheckRunner {
log.trace("-".repeat(running.length()));
}
- default void printCompleted(CheckStatus status) {
- String completed = "Check " + getCheck() + " completed with status " +
status;
+ default void printCompleted(boolean status) {
+ String completed = "Check " + getCheck() + " completed with status "
+ + (status ? CheckStatus.OK : CheckStatus.FAILED);
log.trace("-".repeat(completed.length()));
log.trace(completed);
log.trace("-".repeat(completed.length()));
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/MetadataCheckRunner.java
b/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/MetadataCheckRunner.java
index 042572cd2f..8c05dff1e0 100644
---
a/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/MetadataCheckRunner.java
+++
b/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/MetadataCheckRunner.java
@@ -40,7 +40,6 @@ import org.apache.accumulo.core.util.ColumnFQ;
import org.apache.accumulo.server.ServerContext;
import org.apache.accumulo.server.constraints.MetadataConstraints;
import org.apache.accumulo.server.constraints.SystemEnvironment;
-import org.apache.accumulo.server.util.adminCommand.SystemCheck.CheckStatus;
import org.apache.hadoop.io.Text;
public interface MetadataCheckRunner extends CheckRunner {
@@ -67,8 +66,7 @@ public interface MetadataCheckRunner extends CheckRunner {
* Ensures that the {@link #tableName()} table (either metadata or root
table) has all columns
* that are expected. For the root metadata, ensures that the expected
"columns" exist in ZK.
*/
- default CheckStatus checkRequiredColumns(ServerContext context, CheckStatus
status)
- throws Exception {
+ default boolean checkRequiredColumns(ServerContext context) throws Exception
{
Set<ColumnFQ> requiredColFQs;
Set<Text> requiredColFams;
boolean missingReqCol = false;
@@ -99,7 +97,6 @@ public interface MetadataCheckRunner extends CheckRunner {
if (!requiredColFQs.isEmpty() || !requiredColFams.isEmpty()) {
log.warn("Tablet {} is missing required columns: col FQs: {}, col
fams: {} in the {}\n",
entry.getKey().getRow(), requiredColFQs, requiredColFams,
scanning());
- status = CheckStatus.FAILED;
missingReqCol = true;
}
}
@@ -107,16 +104,18 @@ public interface MetadataCheckRunner extends CheckRunner {
if (!missingReqCol) {
log.trace("...The {} contains all required columns for all tablets\n",
scanning());
+ return true;
+ } else {
+ return false;
}
- return status;
}
/**
* Ensures each column in the root or metadata table (or in ZK for the root
metadata) is valid -
* no unexpected columns, and for the columns that are expected, ensures the
values are valid
*/
- default CheckStatus checkColumns(ServerContext context,
- Iterator<AbstractMap.SimpleImmutableEntry<Key,Value>> iter, CheckStatus
status) {
+ default boolean checkColumns(ServerContext context,
+ Iterator<AbstractMap.SimpleImmutableEntry<Key,Value>> iter) {
boolean invalidCol = false;
MetadataConstraints mc = new MetadataConstraints();
@@ -132,15 +131,16 @@ public interface MetadataCheckRunner extends CheckRunner {
var violations = mc.check(new ConstraintEnv(context), m);
if (!violations.isEmpty()) {
violations.forEach(violationCode ->
log.warn(mc.getViolationDescription(violationCode)));
- status = CheckStatus.FAILED;
invalidCol = true;
}
}
if (!invalidCol) {
log.trace("...All columns in the {} are valid\n", scanning());
+ return true;
+ } else {
+ return false;
}
- return status;
}
default void fetchRequiredColumns(Scanner scanner) {
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/MetadataTableCheckRunner.java
b/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/MetadataTableCheckRunner.java
index 3a56fcb2a1..41e825d4b2 100644
---
a/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/MetadataTableCheckRunner.java
+++
b/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/MetadataTableCheckRunner.java
@@ -30,7 +30,6 @@ import org.apache.accumulo.server.ServerContext;
import org.apache.accumulo.server.util.CheckForMetadataProblems;
import org.apache.accumulo.server.util.FindOfflineTablets;
import org.apache.accumulo.server.util.adminCommand.SystemCheck.Check;
-import org.apache.accumulo.server.util.adminCommand.SystemCheck.CheckStatus;
import org.apache.hadoop.io.Text;
public class MetadataTableCheckRunner implements MetadataCheckRunner {
@@ -52,14 +51,14 @@ public class MetadataTableCheckRunner implements
MetadataCheckRunner {
}
@Override
- public CheckStatus runCheck(ServerContext context, ServerOpts opts, boolean
fixFiles)
+ public boolean runCheck(ServerContext context, ServerOpts opts, boolean
fixFiles)
throws Exception {
- CheckStatus status = CheckStatus.OK;
+ boolean status = true;
printRunning();
log.trace("********** Looking for offline tablets **********");
if (FindOfflineTablets.findOffline(context, null, true, true, log::trace,
log::warn) != 0) {
- status = CheckStatus.FAILED;
+ status &= false;
} else {
log.trace("All good... No offline tablets found");
}
@@ -67,16 +66,16 @@ public class MetadataTableCheckRunner implements
MetadataCheckRunner {
log.trace("********** Checking some references **********");
if (CheckForMetadataProblems.checkMetadataAndRootTableEntries(context,
tableName(), opts,
log::trace, log::warn)) {
- status = CheckStatus.FAILED;
+ status &= false;
}
log.trace("********** Looking for missing columns **********");
- status = checkRequiredColumns(context, status);
+ status = checkRequiredColumns(context);
log.trace("********** Looking for invalid columns **********");
try (Scanner scanner = context.createScanner(tableName(),
Authorizations.EMPTY)) {
- status = checkColumns(context,
-
scanner.stream().map(AbstractMap.SimpleImmutableEntry::new).iterator(), status);
+ status &= checkColumns(context,
+
scanner.stream().map(AbstractMap.SimpleImmutableEntry::new).iterator());
}
printCompleted(status);
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/RootMetadataCheckRunner.java
b/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/RootMetadataCheckRunner.java
index 4916cd9972..68c5aeef1d 100644
---
a/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/RootMetadataCheckRunner.java
+++
b/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/RootMetadataCheckRunner.java
@@ -32,7 +32,6 @@ import org.apache.accumulo.core.util.ColumnFQ;
import org.apache.accumulo.server.ServerContext;
import org.apache.accumulo.server.util.FindOfflineTablets;
import org.apache.accumulo.server.util.adminCommand.SystemCheck.Check;
-import org.apache.accumulo.server.util.adminCommand.SystemCheck.CheckStatus;
import org.apache.hadoop.io.Text;
public class RootMetadataCheckRunner implements MetadataCheckRunner {
@@ -54,35 +53,34 @@ public class RootMetadataCheckRunner implements
MetadataCheckRunner {
}
@Override
- public CheckStatus runCheck(ServerContext context, ServerOpts opts, boolean
fixFiles)
+ public boolean runCheck(ServerContext context, ServerOpts opts, boolean
fixFiles)
throws Exception {
- CheckStatus status = CheckStatus.OK;
+ boolean status = true;
printRunning();
log.trace("********** Looking for offline tablets **********");
if (FindOfflineTablets.findOffline(context, SystemTables.ROOT.tableName(),
false, true,
log::trace, log::warn) != 0) {
- status = CheckStatus.FAILED;
+ status &= false;
} else {
log.trace("All good... No offline tablets found");
}
log.trace("********** Looking for missing columns **********");
- status = checkRequiredColumns(context, status);
+ status &= checkRequiredColumns(context);
log.trace("********** Looking for invalid columns **********");
final String json =
new
String(context.getZooSession().asReader().getData(RootTable.ZROOT_TABLET),
UTF_8);
final var rtm = new RootTabletMetadata(json);
- status = checkColumns(context, rtm.getKeyValues().iterator(), status);
+ status &= checkColumns(context, rtm.getKeyValues().iterator());
printCompleted(status);
return status;
}
@Override
- public CheckStatus checkRequiredColumns(ServerContext context, CheckStatus
status)
- throws Exception {
+ public boolean checkRequiredColumns(ServerContext context) throws Exception {
final String json =
new
String(context.getZooSession().asReader().getData(RootTable.ZROOT_TABLET),
UTF_8);
final var rtm = new RootTabletMetadata(json);
@@ -102,20 +100,20 @@ public class RootMetadataCheckRunner implements
MetadataCheckRunner {
});
if (rowsSeen.size() != 1) {
- status = CheckStatus.FAILED;
log.warn("Did not see one tablet for the root table!");
+ return false;
} else {
if (!requiredColFQs.isEmpty() || !requiredColFams.isEmpty()) {
log.warn("Tablet {} is missing required columns: col FQs: {}, col
fams: {} in the {}\n",
rowsSeen.stream().findFirst().orElseThrow(), requiredColFQs,
requiredColFams,
scanning());
- status = CheckStatus.FAILED;
+ return false;
} else {
log.trace("...The {} contains all required columns for the root
tablet\n", scanning());
}
}
- return status;
+ return true;
}
@Override
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/RootTableCheckRunner.java
b/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/RootTableCheckRunner.java
index 1204ad66a6..3898ee44b3 100644
---
a/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/RootTableCheckRunner.java
+++
b/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/RootTableCheckRunner.java
@@ -29,7 +29,6 @@ import org.apache.accumulo.server.ServerContext;
import org.apache.accumulo.server.util.CheckForMetadataProblems;
import org.apache.accumulo.server.util.FindOfflineTablets;
import org.apache.accumulo.server.util.adminCommand.SystemCheck.Check;
-import org.apache.accumulo.server.util.adminCommand.SystemCheck.CheckStatus;
public class RootTableCheckRunner implements MetadataCheckRunner {
private static final Check check = Check.ROOT_TABLE;
@@ -45,15 +44,15 @@ public class RootTableCheckRunner implements
MetadataCheckRunner {
}
@Override
- public CheckStatus runCheck(ServerContext context, ServerOpts opts, boolean
fixFiles)
+ public boolean runCheck(ServerContext context, ServerOpts opts, boolean
fixFiles)
throws Exception {
- CheckStatus status = CheckStatus.OK;
+ boolean status = true;
printRunning();
log.trace("********** Looking for offline tablets **********");
if (FindOfflineTablets.findOffline(context,
SystemTables.METADATA.tableName(), true, false,
log::trace, log::warn) != 0) {
- status = CheckStatus.FAILED;
+ status &= false;
} else {
log.trace("All good... No offline tablets found");
}
@@ -61,16 +60,16 @@ public class RootTableCheckRunner implements
MetadataCheckRunner {
log.trace("********** Checking some references **********");
if (CheckForMetadataProblems.checkMetadataAndRootTableEntries(context,
tableName(), opts,
log::trace, log::warn)) {
- status = CheckStatus.FAILED;
+ status &= false;
}
log.trace("********** Looking for missing columns **********");
- status = checkRequiredColumns(context, status);
+ status &= checkRequiredColumns(context);
log.trace("********** Looking for invalid columns **********");
try (Scanner scanner = context.createScanner(tableName(),
Authorizations.EMPTY)) {
- status = checkColumns(context,
-
scanner.stream().map(AbstractMap.SimpleImmutableEntry::new).iterator(), status);
+ status &= checkColumns(context,
+
scanner.stream().map(AbstractMap.SimpleImmutableEntry::new).iterator());
}
printCompleted(status);
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/ServerConfigCheckRunner.java
b/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/ServerConfigCheckRunner.java
index 1cda52eb00..a13de0e59d 100644
---
a/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/ServerConfigCheckRunner.java
+++
b/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/ServerConfigCheckRunner.java
@@ -26,15 +26,14 @@ import org.apache.accumulo.core.cli.ServerOpts;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.server.ServerContext;
import org.apache.accumulo.server.util.adminCommand.SystemCheck.Check;
-import org.apache.accumulo.server.util.adminCommand.SystemCheck.CheckStatus;
public class ServerConfigCheckRunner implements CheckRunner {
private static final Check check = Check.SERVER_CONFIG;
@Override
- public CheckStatus runCheck(ServerContext context, ServerOpts opts, boolean
fixFiles)
+ public boolean runCheck(ServerContext context, ServerOpts opts, boolean
fixFiles)
throws Exception {
- CheckStatus status = CheckStatus.OK;
+ boolean status = true;
printRunning();
log.trace("********** Checking server configuration **********");
@@ -48,7 +47,7 @@ public class ServerConfigCheckRunner implements CheckRunner {
var val = entry.getValue();
if (!Property.isValidProperty(key, val)) {
log.warn("Invalid property (key={} val={}) found in the config", key,
val);
- status = CheckStatus.FAILED;
+ status &= false;
}
}
@@ -72,7 +71,7 @@ public class ServerConfigCheckRunner implements CheckRunner {
// it's valid
if (confPropVal == null || confPropVal.isEmpty()) {
log.warn("Required property {} is not set!", reqProp);
- status = CheckStatus.FAILED;
+ status &= false;
}
}
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/SystemConfigCheckRunner.java
b/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/SystemConfigCheckRunner.java
index f5f7f4b4e0..73a9ac9c46 100644
---
a/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/SystemConfigCheckRunner.java
+++
b/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/SystemConfigCheckRunner.java
@@ -34,7 +34,6 @@ import org.apache.accumulo.core.util.Pair;
import org.apache.accumulo.server.ServerContext;
import org.apache.accumulo.server.log.WalStateManager;
import org.apache.accumulo.server.util.adminCommand.SystemCheck.Check;
-import org.apache.accumulo.server.util.adminCommand.SystemCheck.CheckStatus;
import org.apache.hadoop.fs.Path;
import com.google.common.collect.Sets;
@@ -43,29 +42,28 @@ public class SystemConfigCheckRunner implements CheckRunner
{
private static final Check check = Check.SYSTEM_CONFIG;
@Override
- public CheckStatus runCheck(ServerContext context, ServerOpts opts, boolean
fixFiles)
+ public boolean runCheck(ServerContext context, ServerOpts opts, boolean
fixFiles)
throws Exception {
- CheckStatus status = CheckStatus.OK;
printRunning();
log.trace("********** Checking validity of some ZooKeeper nodes
**********");
- status = checkZkNodes(context, status);
+ boolean status = checkZkNodes(context);
printCompleted(status);
return status;
}
- private static CheckStatus checkZkNodes(ServerContext context, CheckStatus
status)
- throws Exception {
- status = checkZKLocks(context, status);
- status = checkZKTableNodes(context, status);
- status = checkZKWALsMetadata(context, status);
+ private static boolean checkZkNodes(ServerContext context) throws Exception {
+ boolean status = true;
+ status &= checkZKLocks(context);
+ status &= checkZKTableNodes(context);
+ status &= checkZKWALsMetadata(context);
return status;
}
- private static CheckStatus checkZKLocks(ServerContext context, CheckStatus
status)
- throws Exception {
+ private static boolean checkZKLocks(ServerContext context) throws Exception {
+ boolean status = true;
final ServerId.Type[] serverTypes = ServerId.Type.values();
log.trace("Checking ZooKeeper locks for Accumulo server processes...");
@@ -85,7 +83,7 @@ public class SystemConfigCheckRunner implements CheckRunner {
if (servers.size() != 1) {
log.warn("Expected 1 server to be found for {} but found {}",
serverType,
servers.size());
- status = CheckStatus.FAILED;
+ status &= false;
} else {
// no exception and 1 server found
log.trace("Verified ZooKeeper lock for {}", servers);
@@ -97,7 +95,7 @@ public class SystemConfigCheckRunner implements CheckRunner {
log.debug("No {} appears to be running. This may or may not be
expected", serverType);
} else if (servers.size() > 1) {
log.warn("More than 1 {} was found running. This is not expected",
serverType);
- status = CheckStatus.FAILED;
+ status &= false;
} else {
// no exception and 1 server found
log.trace("Verified ZooKeeper lock for {}", servers);
@@ -109,7 +107,7 @@ public class SystemConfigCheckRunner implements CheckRunner
{
// essential process(es)
if (servers.isEmpty()) {
log.warn("No {} appear to be running. This is not expected.",
serverType);
- status = CheckStatus.FAILED;
+ status &= false;
} else {
// no exception and >= 1 server found
log.trace("Verified ZooKeeper lock(s) for {} servers",
servers.size());
@@ -132,8 +130,8 @@ public class SystemConfigCheckRunner implements CheckRunner
{
return status;
}
- private static CheckStatus checkZKTableNodes(ServerContext context,
CheckStatus status)
- throws Exception {
+ private static boolean checkZKTableNodes(ServerContext context) throws
Exception {
+ boolean status = true;
log.trace("Checking ZooKeeper table nodes...");
final var zrw = context.getZooSession().asReaderWriter();
@@ -148,22 +146,22 @@ public class SystemConfigCheckRunner implements
CheckRunner {
log.warn(
"Missing essential Accumulo table. One or more of {} are missing
from the tables found {}",
systemTableNameToId, tableNameToId);
- status = CheckStatus.FAILED;
+ status &= false;
}
for (var nameToId : tableNameToId.entrySet()) {
var tablePath = Constants.ZTABLES + "/" + nameToId.getValue();
// expect the table path to exist and some data to exist
if (!zrw.exists(tablePath) || zrw.getChildren(tablePath).isEmpty()) {
log.warn("Failed to find table ({}) info at expected path {}",
nameToId, tablePath);
- status = CheckStatus.FAILED;
+ status &= false;
}
}
return status;
}
- private static CheckStatus checkZKWALsMetadata(ServerContext context,
CheckStatus status)
- throws Exception {
+ private static boolean checkZKWALsMetadata(ServerContext context) throws
Exception {
+ boolean status = true;
final var zrw = context.getZooSession().asReaderWriter();
log.trace("Checking that WAL metadata in ZooKeeper is valid...");
@@ -190,7 +188,7 @@ public class SystemConfigCheckRunner implements CheckRunner
{
if (!actualMissing.isEmpty()) {
log.warn("WAL metadata for tserver {} references a WAL that does not
exist : {}",
instanceAndMissingWals.getKey(), actualMissing);
- status = CheckStatus.FAILED;
+ status = false;
}
}
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/SystemFilesCheckRunner.java
b/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/SystemFilesCheckRunner.java
index fc609114e9..64ebb3fc1f 100644
---
a/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/SystemFilesCheckRunner.java
+++
b/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/SystemFilesCheckRunner.java
@@ -23,21 +23,20 @@ import org.apache.accumulo.core.metadata.SystemTables;
import org.apache.accumulo.server.ServerContext;
import org.apache.accumulo.server.util.RemoveEntriesForMissingFiles;
import org.apache.accumulo.server.util.adminCommand.SystemCheck.Check;
-import org.apache.accumulo.server.util.adminCommand.SystemCheck.CheckStatus;
public class SystemFilesCheckRunner implements CheckRunner {
private static final Check check = Check.SYSTEM_FILES;
@Override
- public CheckStatus runCheck(ServerContext context, ServerOpts opts, boolean
fixFiles)
+ public boolean runCheck(ServerContext context, ServerOpts opts, boolean
fixFiles)
throws Exception {
- CheckStatus status = CheckStatus.OK;
+ boolean status = true;
printRunning();
log.trace("********** Looking for missing system files **********");
if (RemoveEntriesForMissingFiles.checkTable(context,
SystemTables.METADATA.tableName(),
fixFiles, log::trace, log::warn) != 0) {
- status = CheckStatus.FAILED;
+ status &= false;
}
printCompleted(status);
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/TableLocksCheckRunner.java
b/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/TableLocksCheckRunner.java
index 33c7f583eb..72d1a4d4d6 100644
---
a/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/TableLocksCheckRunner.java
+++
b/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/TableLocksCheckRunner.java
@@ -30,19 +30,17 @@ import
org.apache.accumulo.core.fate.zookeeper.MetaFateStore;
import org.apache.accumulo.core.metadata.SystemTables;
import org.apache.accumulo.server.ServerContext;
import org.apache.accumulo.server.util.adminCommand.SystemCheck.Check;
-import org.apache.accumulo.server.util.adminCommand.SystemCheck.CheckStatus;
public class TableLocksCheckRunner implements CheckRunner {
private static final Check check = Check.TABLE_LOCKS;
@Override
- public CheckStatus runCheck(ServerContext context, ServerOpts opts, boolean
fixFiles)
+ public boolean runCheck(ServerContext context, ServerOpts opts, boolean
fixFiles)
throws Exception {
- CheckStatus status = CheckStatus.OK;
printRunning();
log.trace("********** Checking some references **********");
- status = checkTableLocks(context, status);
+ boolean status = checkTableLocks(context);
printCompleted(status);
return status;
@@ -53,8 +51,8 @@ public class TableLocksCheckRunner implements CheckRunner {
return check;
}
- private static CheckStatus checkTableLocks(ServerContext context,
CheckStatus status)
- throws Exception {
+ private static boolean checkTableLocks(ServerContext context) throws
Exception {
+ boolean status = true;
final AdminUtil<TableLocksCheckRunner> admin = new AdminUtil<>();
final var zTableLocksPath =
context.getServerPaths().createTableLocksPath();
final var zk = context.getZooSession();
@@ -74,7 +72,7 @@ public class TableLocksCheckRunner implements CheckRunner {
lockedIds.removeAll(tableIds);
lockedIds.removeAll(namespaceIds);
if (!lockedIds.isEmpty()) {
- status = CheckStatus.FAILED;
+ status &= false;
log.warn("...Some table and namespace locks are INVALID (the
table/namespace DNE): "
+ lockedIds);
} else {
@@ -92,7 +90,7 @@ public class TableLocksCheckRunner implements CheckRunner {
zTableLocksPath, null, null, null);
if (!fateStatus.getDanglingHeldLocks().isEmpty()
|| !fateStatus.getDanglingWaitingLocks().isEmpty()) {
- status = CheckStatus.FAILED;
+ status &= false;
log.warn("The following locks did not have an associated FATE
operation\n");
for (Map.Entry<FateId,List<String>> entry :
fateStatus.getDanglingHeldLocks()
.entrySet()) {
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/UserFilesCheckRunner.java
b/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/UserFilesCheckRunner.java
index 9fd087a706..2998b3f5de 100644
---
a/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/UserFilesCheckRunner.java
+++
b/server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/UserFilesCheckRunner.java
@@ -23,15 +23,14 @@ import org.apache.accumulo.core.metadata.SystemTables;
import org.apache.accumulo.server.ServerContext;
import org.apache.accumulo.server.util.RemoveEntriesForMissingFiles;
import org.apache.accumulo.server.util.adminCommand.SystemCheck.Check;
-import org.apache.accumulo.server.util.adminCommand.SystemCheck.CheckStatus;
public class UserFilesCheckRunner implements CheckRunner {
private static final Check check = Check.USER_FILES;
@Override
- public CheckStatus runCheck(ServerContext context, ServerOpts opts, boolean
fixFiles)
+ public boolean runCheck(ServerContext context, ServerOpts opts, boolean
fixFiles)
throws Exception {
- CheckStatus status = CheckStatus.OK;
+ boolean status = true;
printRunning();
log.trace("********** Looking for missing user files **********");
@@ -41,7 +40,7 @@ public class UserFilesCheckRunner implements CheckRunner {
log.trace("Checking table {} ({}) for missing files\n", tableName,
tableId);
if (RemoveEntriesForMissingFiles.checkTable(context, tableName,
fixFiles, log::trace,
log::warn) != 0) {
- status = CheckStatus.FAILED;
+ status &= false;
}
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/SystemCheckIT.java
b/test/src/main/java/org/apache/accumulo/test/SystemCheckIT.java
index fd20571dad..4996b573b1 100644
--- a/test/src/main/java/org/apache/accumulo/test/SystemCheckIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/SystemCheckIT.java
@@ -696,14 +696,14 @@ public class SystemCheckIT extends ConfigurableMacBase {
}
@Override
- public CheckStatus runCheck(ServerContext context, ServerOpts opts,
boolean fixFiles)
+ public boolean runCheck(ServerContext context, ServerOpts opts, boolean
fixFiles)
throws Exception {
- CheckStatus status = passes ? CheckStatus.OK : CheckStatus.FAILED;
System.out.println("Running dummy check " + getCheck());
// no work to perform in the dummy check runner
- System.out.println("Dummy check " + getCheck() + " completed with status
" + status);
- return status;
+ System.out.println("Dummy check " + getCheck() + " completed with status
"
+ + (passes ? CheckStatus.OK : CheckStatus.FAILED));
+ return passes;
}
}