Skip to content

Commit

Permalink
Merge branch '3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
ddanielr committed Sep 30, 2024
2 parents 35189b2 + 652a1a6 commit bc128fc
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 31 deletions.
6 changes: 6 additions & 0 deletions assemble/conf/log4j2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ appender.console.layout.pattern = %style{%d{ISO8601}}{dim,cyan} %style{[}{red}%s
logger.shellaudit.name = org.apache.accumulo.shell.Shell.audit
logger.shellaudit.level = warn

logger.core.name = org.apache.accumulo.core
logger.core.level = info

logger.shell.name = org.apache.accumulo.shell.Shell
logger.shell.level = info

logger.zookeeper.name = org.apache.zookeeper
logger.zookeeper.level = error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,10 @@
import org.apache.accumulo.core.client.admin.ActiveCompaction;
import org.apache.accumulo.core.client.admin.InstanceOperations;
import org.apache.accumulo.core.util.DurationFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.accumulo.shell.Shell;

class ActiveCompactionHelper {

private static final Logger log = LoggerFactory.getLogger(ActiveCompactionHelper.class);

private static final Comparator<ActiveCompaction> COMPACTION_AGE_DESCENDING =
Comparator.comparingLong(ActiveCompaction::getAge).reversed();

Expand Down Expand Up @@ -120,7 +117,7 @@ public static Stream<String> activeCompactionsForServer(String tserver,
return instanceOps.getActiveCompactions(tserver).stream().sorted(COMPACTION_AGE_DESCENDING)
.map(ActiveCompactionHelper::formatActiveCompactionLine);
} catch (Exception e) {
log.debug("Failed to list active compactions for server {}", tserver, e);
Shell.log.debug("Failed to list active compactions for server {}", tserver, e);
return Stream.of(tserver + " ERROR " + e.getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DeleteTableCommand extends TableOperation {
private static final Logger log = LoggerFactory.getLogger(DeleteTableCommand.class);

private Option forceOpt;

Expand Down Expand Up @@ -78,7 +75,7 @@ protected void pruneTables(Set<String> tables) {
String table = tableNames.next();
Pair<String,String> qualifiedName = TableNameUtil.qualify(table);
if (Namespace.ACCUMULO.name().equals(qualifiedName.getFirst())) {
log.trace("Removing table from deletion set: {}", table);
Shell.log.trace("Removing table from deletion set: {}", table);
tableNames.remove();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.annotations.VisibleForTesting;

Expand All @@ -53,8 +51,6 @@
*/
public class ListTabletsCommand extends Command {

private static final Logger log = LoggerFactory.getLogger(ListTabletsCommand.class);

private Option outputFileOpt;
private Option optTablePattern;
private Option optHumanReadable;
Expand All @@ -70,10 +66,9 @@ public class ListTabletsCommand extends Command {
public int execute(String fullCommand, CommandLine cl, Shell shellState) throws Exception {
final Set<TableInfo> tableInfoSet = populateTables(cl, shellState);
if (tableInfoSet.isEmpty()) {
log.warn("No tables found that match your criteria");
Shell.log.warn("No tables found that match your criteria");
return 0;
}

boolean humanReadable = cl.hasOption(optHumanReadable.getOpt());

List<String> lines = new LinkedList<>();
Expand Down Expand Up @@ -178,7 +173,7 @@ private Set<TableInfo> populateTables(final CommandLine cl, final Shell shellSta
TableId id = TableId.of(tableIdString);
tableSet.add(new TableInfo(name, id));
} else {
log.warn("Table not found: {}", name);
Shell.log.warn("Table not found: {}", name);
}
});
return tableSet;
Expand All @@ -191,7 +186,7 @@ private Set<TableInfo> populateTables(final CommandLine cl, final Shell shellSta
TableId id = TableId.of(idString);
tableSet.add(new TableInfo(table, id));
} else {
log.warn("Table not found: {}", table);
Shell.log.warn("Table not found: {}", table);
}
return tableSet;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,9 @@
import org.apache.accumulo.shell.Shell;
import org.apache.commons.cli.CommandLine;
import org.apache.hadoop.io.Text;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class MaxRowCommand extends ScanCommand {

private static final Logger log = LoggerFactory.getLogger(MaxRowCommand.class);

@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
throws Exception {
Expand All @@ -47,7 +43,7 @@ public int execute(final String fullCommand, final CommandLine cl, final Shell s
shellState.getWriter().println(max);
}
} catch (Exception e) {
log.debug("Could not get shell state.", e);
Shell.log.debug("Could not get shell state.", e);
}

return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.apache.commons.cli.OptionGroup;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.slf4j.LoggerFactory;

public abstract class ShellPluginConfigurationCommand extends Command {
private Option removePluginOption, pluginClassOption, listPluginOption;
Expand Down Expand Up @@ -115,20 +114,16 @@ public static <T> Class<? extends T> getPluginClass(final String tableName,
pluginClazz =
shellState.getClassLoader(cl, shellState).loadClass(ent.getValue()).asSubclass(clazz);
} catch (ClassNotFoundException e) {
LoggerFactory.getLogger(ShellPluginConfigurationCommand.class).error("Class not found {}",
e.getMessage());
Shell.log.error("Class not found {}", e.getMessage());
return null;
} catch (ParseException e) {
LoggerFactory.getLogger(ShellPluginConfigurationCommand.class)
.error("Error parsing table: {} {}", Arrays.toString(args), e.getMessage());
Shell.log.error("Error parsing table: {} {}", Arrays.toString(args), e.getMessage());
return null;
} catch (TableNotFoundException e) {
LoggerFactory.getLogger(ShellPluginConfigurationCommand.class)
.error("Table not found: {} {}", tableName, e.getMessage());
Shell.log.error("Table not found: {} {}", tableName, e.getMessage());
return null;
} catch (Exception e) {
LoggerFactory.getLogger(ShellPluginConfigurationCommand.class).error("Error: {}",
e.getMessage());
Shell.log.error("Error: {}", e.getMessage());
return null;
}

Expand Down

0 comments on commit bc128fc

Please sign in to comment.