Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .idea/checkstyle-idea.xml

This file was deleted.

17 changes: 17 additions & 0 deletions hbase-asyncfs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-common</artifactId>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-http</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
Expand Down Expand Up @@ -132,6 +137,18 @@
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<artifactId>hadoop-yarn-api</artifactId>
<groupId>org.apache.hadoop</groupId>
<version>3.2.0</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<profiles>
Expand Down
9 changes: 4 additions & 5 deletions hbase-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,6 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-crypto</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.stephenc.findbugs</groupId>
<artifactId>findbugs-annotations</artifactId>
Expand All @@ -216,6 +211,10 @@
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
</dependency>
<dependency>
<groupId>org.apache.kerby</groupId>
<artifactId>kerb-simplekdc</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,9 @@ private HBaseInterfaceAudience(){}
* Denotes classes that can be used to build custom authentication solutions.
*/
public static final String AUTHENTICATION = "Authentication";

/**
* Denotes classes that are being used to build Custom Chaos Monkey.
*/
public static final String CHAOS = "ChaosMonkey";
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
package org.apache.hadoop.hbase.test;

import org.apache.hadoop.hbase.metrics.BaseSource;
import org.apache.yetus.audience.InterfaceAudience;

/** Interface of a class to make assertions about metrics values. */
@InterfaceAudience.Private
public interface MetricsAssertHelper {

/**
Expand Down
2 changes: 1 addition & 1 deletion hbase-http/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<scope>test</scope>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.kerby</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@
import org.apache.hadoop.hbase.HBaseCommonTestingUtility;
import org.apache.hadoop.security.ssl.FileBasedKeyStoresFactory;
import org.apache.hadoop.security.ssl.SSLFactory;
import org.apache.yetus.audience.InterfaceAudience;
import org.bouncycastle.x509.X509V1CertificateGenerator;

@InterfaceAudience.Private
public final class KeyStoreTestUtil {
private KeyStoreTestUtil() {
}
Expand Down
9 changes: 4 additions & 5 deletions hbase-it/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,6 @@
<artifactId>jetty-util</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
Expand All @@ -273,6 +268,10 @@
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
</dependency>
</dependencies>

<profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@

import org.apache.hadoop.conf.Configurable;
import org.apache.yetus.audience.InterfaceAudience;

import org.apache.yetus.audience.InterfaceStability;

/**
* ClusterManager is an api to manage servers in a distributed environment. It provides services
* for starting / stopping / killing Hadoop/HBase daemons. Concrete implementations provide actual
* functionality for carrying out deployment-specific tasks.
*/
@InterfaceAudience.Private
interface ClusterManager extends Configurable {
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CHAOS)
@InterfaceStability.Evolving
public interface ClusterManager extends Configurable {
/**
* Type of the service daemon
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.Threads;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.yetus.audience.InterfaceStability;

/**
* Manages the interactions with an already deployed distributed cluster (as opposed to
* a pseudo-distributed, or mini/local cluster). This is used by integration and system tests.
*/
@InterfaceAudience.Private
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CHAOS)
@InterfaceStability.Evolving
public class DistributedHBaseCluster extends HBaseCluster {
private Admin admin;
private final Connection connection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.io.IOException;
import java.util.Locale;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
Expand All @@ -32,6 +33,7 @@
import org.apache.hadoop.hbase.util.RetryCounterFactory;
import org.apache.hadoop.util.Shell;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.yetus.audience.InterfaceStability;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -42,7 +44,8 @@
* servers on the remote machines (for example, the test user could be the same user as the
* user the daemon is running as)
*/
@InterfaceAudience.Private
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CHAOS)
@InterfaceStability.Evolving
public class HBaseClusterManager extends Configured implements ClusterManager {

protected enum Signal {
Expand All @@ -61,7 +64,7 @@ protected enum Signal {
* 5 original command, 6 service user.
*/
private static final String DEFAULT_TUNNEL_CMD =
"timeout 30 /usr/bin/ssh %1$s %2$s%3$s%4$s \"sudo -u %6$s %5$s\"";
"timeout 30 /usr/bin/ssh %1$s %2$s%3$s%4$s \"sudo -u %6$s %5$s\"";
private String tunnelCmd;

/**
Expand All @@ -70,7 +73,7 @@ protected enum Signal {
* 5 original command, 6 timeout.
*/
private static final String DEFAULT_TUNNEL_SUDO_CMD =
"timeout %6$s /usr/bin/ssh %1$s %2$s%3$s%4$s \"sudo %5$s\"";
"timeout %6$s /usr/bin/ssh %1$s %2$s%3$s%4$s \"sudo %5$s\"";
private String tunnelSudoCmd;

private static final String RETRY_ATTEMPTS_KEY = "hbase.it.clustermanager.retry.attempts";
Expand Down Expand Up @@ -100,13 +103,13 @@ public void setConf(Configuration conf) {
tunnelSudoCmd = conf.get("hbase.it.clustermanager.ssh.sudo.cmd", DEFAULT_TUNNEL_SUDO_CMD);
// Print out ssh special config if any.
if ((sshUserName != null && sshUserName.length() > 0) ||
(sshOptions != null && sshOptions.length() > 0)) {
(sshOptions != null && sshOptions.length() > 0)) {
LOG.info("Running with SSH user [" + sshUserName + "] and options [" + sshOptions + "]");
}

this.retryCounterFactory = new RetryCounterFactory(new RetryConfig()
.setMaxAttempts(conf.getInt(RETRY_ATTEMPTS_KEY, DEFAULT_RETRY_ATTEMPTS))
.setSleepInterval(conf.getLong(RETRY_SLEEP_INTERVAL_KEY, DEFAULT_RETRY_SLEEP_INTERVAL)));
.setMaxAttempts(conf.getInt(RETRY_ATTEMPTS_KEY, DEFAULT_RETRY_ATTEMPTS))
.setSleepInterval(conf.getLong(RETRY_SLEEP_INTERVAL_KEY, DEFAULT_RETRY_SLEEP_INTERVAL)));
}

protected String getServiceUser(ServiceType service) {
Expand All @@ -130,7 +133,7 @@ protected class RemoteShell extends Shell.ShellCommandExecutor {
private String user;

public RemoteShell(String hostname, String[] execString, File dir, Map<String, String> env,
long timeout) {
long timeout) {
super(execString, dir, env, timeout);
this.hostname = hostname;
}
Expand Down Expand Up @@ -177,7 +180,7 @@ public RemoteSudoShell(String hostname, String[] execString, long timeout) {
}

public RemoteSudoShell(String hostname, String[] execString, File dir, Map<String, String> env,
long timeout) {
long timeout) {
super(execString, dir, env, timeout);
this.hostname = hostname;
}
Expand All @@ -187,7 +190,7 @@ public String[] getExecString() {
String at = sshUserName.isEmpty() ? "" : "@";
String remoteCmd = StringUtils.join(super.getExecString(), " ");
String cmd = String.format(tunnelSudoCmd, sshOptions, sshUserName, at, hostname, remoteCmd,
timeOutInterval/1000f);
timeOutInterval/1000f);
LOG.info("Executing full command [" + cmd + "]");
return new String[] { "/usr/bin/env", "bash", "-c", cmd };
}
Expand All @@ -212,7 +215,7 @@ public String isRunningCommand(ServiceType service) {

protected String findPidCommand(ServiceType service) {
return String.format("ps ux | grep proc_%s | grep -v grep | tr -s ' ' | cut -d ' ' -f2",
service);
service);
}

public String signalCommand(ServiceType service, String signal) {
Expand Down Expand Up @@ -242,7 +245,7 @@ static class HBaseShellCommandProvider extends CommandProvider {
@Override
public String getCommand(ServiceType service, Operation op) {
return String.format("%s/bin/hbase-daemon.sh %s %s %s", hbaseHome, confDir,
op.toString().toLowerCase(Locale.ROOT), service);
op.toString().toLowerCase(Locale.ROOT), service);
}
}

Expand All @@ -255,9 +258,9 @@ static class HadoopShellCommandProvider extends CommandProvider {

HadoopShellCommandProvider(Configuration conf) throws IOException {
hadoopHome = conf.get("hbase.it.clustermanager.hadoop.home",
System.getenv("HADOOP_HOME"));
System.getenv("HADOOP_HOME"));
String tmp = conf.get("hbase.it.clustermanager.hadoop.conf.dir",
System.getenv("HADOOP_CONF_DIR"));
System.getenv("HADOOP_CONF_DIR"));
if (hadoopHome == null) {
throw new IOException("Hadoop home configuration parameter i.e. " +
"'hbase.it.clustermanager.hadoop.home' is not configured properly.");
Expand All @@ -272,7 +275,7 @@ static class HadoopShellCommandProvider extends CommandProvider {
@Override
public String getCommand(ServiceType service, Operation op) {
return String.format("%s/sbin/hadoop-daemon.sh %s %s %s", hadoopHome, confDir,
op.toString().toLowerCase(Locale.ROOT), service);
op.toString().toLowerCase(Locale.ROOT), service);
}
}

Expand All @@ -285,9 +288,9 @@ static class ZookeeperShellCommandProvider extends CommandProvider {

ZookeeperShellCommandProvider(Configuration conf) throws IOException {
zookeeperHome = conf.get("hbase.it.clustermanager.zookeeper.home",
System.getenv("ZOOBINDIR"));
System.getenv("ZOOBINDIR"));
String tmp = conf.get("hbase.it.clustermanager.zookeeper.conf.dir",
System.getenv("ZOOCFGDIR"));
System.getenv("ZOOCFGDIR"));
if (zookeeperHome == null) {
throw new IOException("ZooKeeper home configuration parameter i.e. " +
"'hbase.it.clustermanager.zookeeper.home' is not configured properly.");
Expand Down Expand Up @@ -334,7 +337,7 @@ protected CommandProvider getCommandProvider(ServiceType service) throws IOExcep
protected Pair<Integer, String> exec(String hostname, ServiceType service, String... cmd)
throws IOException {
LOG.info("Executing remote command: {}, hostname:{}", StringUtils.join(cmd, " "),
hostname);
hostname);

RemoteShell shell = new RemoteShell(hostname, getServiceUser(service), cmd);
try {
Expand All @@ -348,13 +351,13 @@ protected Pair<Integer, String> exec(String hostname, ServiceType service, Strin
}

LOG.info("Executed remote command, exit code:{} , output:{}", shell.getExitCode(),
shell.getOutput());
shell.getOutput());

return new Pair<>(shell.getExitCode(), shell.getOutput());
}

private Pair<Integer, String> execWithRetries(String hostname, ServiceType service, String... cmd)
throws IOException {
throws IOException {
RetryCounter retryCounter = retryCounterFactory.create();
while (true) {
try {
Expand All @@ -377,9 +380,9 @@ private Pair<Integer, String> execWithRetries(String hostname, ServiceType servi
* @throws IOException if something goes wrong.
*/
public Pair<Integer, String> execSudo(String hostname, long timeout, String... cmd)
throws IOException {
throws IOException {
LOG.info("Executing remote command: {} , hostname:{}", StringUtils.join(cmd, " "),
hostname);
hostname);

RemoteSudoShell shell = new RemoteSudoShell(hostname, cmd, timeout);
try {
Expand All @@ -389,17 +392,17 @@ public Pair<Integer, String> execSudo(String hostname, long timeout, String... c
String output = shell.getOutput();
// add output for the ExitCodeException.
throw new Shell.ExitCodeException(ex.getExitCode(), "stderr: " + ex.getMessage()
+ ", stdout: " + output);
+ ", stdout: " + output);
}

LOG.info("Executed remote command, exit code:{} , output:{}", shell.getExitCode(),
shell.getOutput());
shell.getOutput());

return new Pair<>(shell.getExitCode(), shell.getOutput());
}

public Pair<Integer, String> execSudoWithRetries(String hostname, long timeout, String... cmd)
throws IOException {
throws IOException {
RetryCounter retryCounter = retryCounterFactory.create();
while (true) {
try {
Expand All @@ -417,11 +420,11 @@ public Pair<Integer, String> execSudoWithRetries(String hostname, long timeout,
}

private <E extends Exception> void retryOrThrow(RetryCounter retryCounter, E ex,
String hostname, String[] cmd) throws E {
String hostname, String[] cmd) throws E {
if (retryCounter.shouldRetry()) {
LOG.warn("Remote command: " + StringUtils.join(cmd, " ") + " , hostname:" + hostname
+ " failed at attempt " + retryCounter.getAttemptTimes() + ". Retrying until maxAttempts: "
+ retryCounter.getMaxAttempts() + ". Exception: " + ex.getMessage());
+ retryCounter.getMaxAttempts() + ". Exception: " + ex.getMessage());
return;
}
throw ex;
Expand Down
Loading