Skip to content
Merged
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
28 changes: 14 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,30 @@ EXPOSE 42424

WORKDIR /opt/accumulo-proxy

ARG HADOOP_VERSION=3.3.4
ARG ZOOKEEPER_VERSION=3.8.0
ARG ACCUMULO_VERSION=2.1.1
ARG HADOOP_VERSION=3.3.6
ARG ZOOKEEPER_VERSION=3.9.2
ARG ACCUMULO_VERSION=2.1.3
ARG ACCUMULO_PROXY_VERSION=2.0.0-SNAPSHOT

ARG HADOOP_HASH=ca5e12625679ca95b8fd7bb7babc2a8dcb2605979b901df9ad137178718821097b67555115fafc6dbf6bb32b61864ccb6786dbc555e589694a22bf69147780b4
ARG ZOOKEEPER_HASH=d66e3a40451f840406901b2cd940992b001f92049a372ae48d8b420891605871cd1ae5f6cceb3b10665491e7abef36a4078dace158bd1e0938fcd3567b5234ca
ARG ACCUMULO_HASH=adb23e56362c2e3e813d07791389b8ca2d5976df8b00a29b607e6ae05ea465eff80ada6d1ec9a9c596df8b4066c51078cd5a4006dc78568ac38f638a1d3895be
ARG HADOOP_HASH=de3eaca2e0517e4b569a88b63c89fae19cb8ac6c01ff990f1ff8f0cc0f3128c8e8a23db01577ca562a0e0bb1b4a3889f8c74384e609cd55e537aada3dcaa9f8a
ARG ZOOKEEPER_HASH=2b5ae02d618a27ca8cd54924855d5344263b7d9dee760181f9d66bafa9230324d2ad31786895f0654c969dc38d4a3d0077f74cc376b58b5fa2fb94beb1ab445f
ARG ACCUMULO_HASH=1a27a144dc31f55ccc8e081b6c1bc6cc0362a8391838c53c166cb45291ff8f35867fd8e4729aa7b2c540f8b721f8c6953281bf589fc7fe320e4dc4d20b87abc4

# Download from Apache mirrors instead of archive #9
ENV APACHE_DIST_URLS \
ENV APACHE_DIST_URLS="\
https://www.apache.org/dyn/closer.cgi?action=download&filename= \
# if the version is outdated (or we're grabbing the .asc file), we might have to pull from the dist/archive :/
https://www-us.apache.org/dist/ \
https://www.apache.org/dist/ \
https://archive.apache.org/dist/
https://archive.apache.org/dist/"

RUN set -eux; \
download_bin() { \
local f="$1"; shift; \
local hash="$1"; shift; \
local distFile="$1"; shift; \
local success=; \
local distUrl=; \
local distUrl=; \
for distUrl in ${APACHE_DIST_URLS}; do \
if wget -nv -O "/tmp/${f}" "${distUrl}${distFile}"; then \
success=1; \
Expand All @@ -63,16 +63,16 @@ RUN tar xzf /tmp/hadoop.tar.gz -C /opt/ && ln -s /opt/hadoop-${HADOOP_VERSION} /
RUN tar xzf /tmp/apache-zookeeper.tar.gz -C /opt/ && ln -s /opt/apache-zookeeper-${ZOOKEEPER_VERSION}-bin /opt/apache-zookeeper
RUN tar xzf /tmp/accumulo.tar.gz -C /opt/ && ln -s /opt/accumulo-${ACCUMULO_VERSION} /opt/accumulo && sed -i 's/\${ZOOKEEPER_HOME}\/\*/\${ZOOKEEPER_HOME}\/\*\:\${ZOOKEEPER_HOME}\/lib\/\*/g' /opt/accumulo/conf/accumulo-env.sh

ENV HADOOP_HOME /opt/hadoop
ENV ZOOKEEPER_HOME /opt/apache-zookeeper
ENV ACCUMULO_HOME /opt/accumulo
ENV HADOOP_HOME=/opt/hadoop
ENV ZOOKEEPER_HOME=/opt/apache-zookeeper
ENV ACCUMULO_HOME=/opt/accumulo

# Add the proxy binary
COPY target/accumulo-proxy-${ACCUMULO_PROXY_VERSION}-bin.tar.gz /tmp/
RUN tar xzf /tmp/accumulo-proxy-${ACCUMULO_PROXY_VERSION}-bin.tar.gz -C /opt/accumulo-proxy --strip 1
ENV ACCUMULO_PROXY_HOME /opt/accumulo-proxy
ENV ACCUMULO_PROXY_HOME=/opt/accumulo-proxy

# Ensure Accumulo is on the path.
ENV PATH "${PATH}:${ACCUMULO_HOME}/bin"
ENV PATH="${PATH}:${ACCUMULO_HOME}/bin"

CMD ["/opt/accumulo-proxy/bin/accumulo-proxy", "-p", "/opt/accumulo-proxy/conf/proxy.properties"]
50 changes: 29 additions & 21 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
<version>29</version>
<version>31</version>
</parent>
<groupId>org.apache.accumulo</groupId>
<artifactId>accumulo-proxy</artifactId>
Expand Down Expand Up @@ -85,27 +85,33 @@
<url>https://github.com/apache/accumulo-proxy/actions</url>
</ciManagement>
<properties>
<accumulo.version>2.1.1</accumulo.version>
<accumulo.version>2.1.3</accumulo.version>
<eclipseFormatterStyle>contrib/Eclipse-Accumulo-Codestyle.xml</eclipseFormatterStyle>
<!-- extra release args for testing -->
<extraReleaseArguments />
<hadoop.version>3.3.4</hadoop.version>
<hadoop.version>3.3.6</hadoop.version>
<it.failIfNoSpecifiedTests>false</it.failIfNoSpecifiedTests>
<maven.compiler.release>11</maven.compiler.release>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<slf4j.version>2.0.6</slf4j.version>
<slf4j.version>2.0.12</slf4j.version>
<sourceReleaseAssemblyDescriptor>source-release-tar</sourceReleaseAssemblyDescriptor>
<spotbugs.excludeFilterFile>src/main/spotbugs/exclude-filter.xml</spotbugs.excludeFilterFile>
<surefire.version>3.0.0-M8</surefire.version>
<thrift.version>0.17.0</thrift.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-bom</artifactId>
<version>1.12.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-bom</artifactId>
<version>2.19.0</version>
<version>2.23.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -121,13 +127,13 @@
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>4.7.3</version>
<version>4.8.3</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.google.auto.service</groupId>
<artifactId>auto-service</artifactId>
<version>1.0.1</version>
<version>1.1.1</version>
<optional>true</optional>
</dependency>
<dependency>
Expand All @@ -140,6 +146,10 @@
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.accumulo</groupId>
<artifactId>accumulo-core</artifactId>
Expand Down Expand Up @@ -214,7 +224,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.9.2</version>
<version>5.10.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -225,12 +235,12 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.14.2</version>
<version>2.16.2</version>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>4.1</version>
<version>4.3</version>
<configuration>
<header>${session.executionRootDirectory}/contrib/license-header.txt</header>
<excludes combine.children="append">
Expand All @@ -255,15 +265,15 @@
<plugin>
<groupId>org.gaul</groupId>
<artifactId>modernizer-maven-plugin</artifactId>
<version>2.5.0</version>
<version>2.7.0</version>
<configuration>
<javaVersion>${maven.compiler.target}</javaVersion>
</configuration>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.7.3.0</version>
<version>4.7.3.6</version>
<configuration>
<xmlOutput>true</xmlOutput>
<effort>Max</effort>
Expand Down Expand Up @@ -313,7 +323,7 @@
<plugin>
<groupId>com.github.koraktor</groupId>
<artifactId>mavanagaiata</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<configuration>
<skipNoGit>true</skipNoGit>
</configuration>
Expand All @@ -337,7 +347,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<optimize>true</optimize>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<compilerArgs>
Expand Down Expand Up @@ -410,22 +419,22 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.3.0</version>
<version>3.5.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<version>3.1.1</version>
</plugin>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>apilyzer-maven-plugin</artifactId>
<version>1.2.0</version>
<version>1.3.0</version>
</plugin>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<version>2.21.0</version>
<version>2.23.0</version>
<configuration>
<configFile>${eclipseFormatterStyle}</configFile>
<compilerCompliance>${maven.compiler.source}</compilerCompliance>
Expand All @@ -435,7 +444,6 @@
<exclude>**/thrift-gen-java/**/*.java</exclude>
</excludes>
<lineEnding>LF</lineEnding>
<overrideConfigCompilerVersion>true</overrideConfigCompilerVersion>
<skipJsFormatting>true</skipJsFormatting>
<skipHtmlFormatting>true</skipHtmlFormatting>
<skipXmlFormatting>true</skipXmlFormatting>
Expand Down Expand Up @@ -645,7 +653,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.6.0</version>
<version>10.12.6</version>
</dependency>
</dependencies>
<executions>
Expand Down
59 changes: 58 additions & 1 deletion src/main/java/org/apache/accumulo/proxy/Proxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import java.io.InputStream;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.util.Collection;
import java.util.List;
import java.util.Properties;

import org.apache.accumulo.core.cli.Help;
Expand All @@ -30,6 +32,8 @@
import org.apache.accumulo.core.clientImpl.ClientConfConverter;
import org.apache.accumulo.core.conf.ClientProperty;
import org.apache.accumulo.core.conf.ConfigurationTypeHelper;
import org.apache.accumulo.core.metrics.MetricsInfo;
import org.apache.accumulo.core.metrics.MetricsProducer;
import org.apache.accumulo.core.rpc.SslConnectionParams;
import org.apache.accumulo.core.trace.TraceUtil;
import org.apache.accumulo.core.util.HostAndPort;
Expand All @@ -55,6 +59,8 @@
import com.google.auto.service.AutoService;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Tag;

@AutoService(KeywordExecutable.class)
public class Proxy implements KeywordExecutable {
Expand Down Expand Up @@ -250,12 +256,63 @@ public static ServerAddress createProxyServer(HostAndPort address,
break;
}

TimedProcessor timedProcessor = new TimedProcessor(processor);
TimedProcessor timedProcessor = new TimedProcessor(processor, new ProxyMetricsInfo());

// Create the thrift server with our processor and properties
return TServerUtils.startTServer(serverType, timedProcessor, protocolFactory, serverName,
threadName, numThreads, ThreadPools.DEFAULT_TIMEOUT_MILLISECS,
ClientConfConverter.toAccumuloConf(props), 1000L, maxFrameSize, sslParams, saslParams,
serverSocketTimeout, address);
}

// TODO: This MetricsInfo is a stub Metrics Info to allow the timed processor to build. If Metrics
// are wanted or needed in a later version of the proxy, this can be updated.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest creating an issue ticket for adding a metrics Info object.

static private class ProxyMetricsInfo implements MetricsInfo {

@Override
public boolean isMetricsEnabled() {
return false;
}

@Override
public void addServiceTags(String applicationName, HostAndPort hostAndPort) {
throw new UnsupportedOperationException("Unimplemented method 'addServiceTags'");
}

@Override
public void addCommonTags(List<Tag> updates) {
throw new UnsupportedOperationException("Unimplemented method 'addCommonTags'");
}

@Override
public Collection<Tag> getCommonTags() {
throw new UnsupportedOperationException("Unimplemented method 'getCommonTags'");
}

@Override
public void addRegistry(MeterRegistry registry) {
throw new UnsupportedOperationException("Unimplemented method 'addRegistry'");
}

@Override
public void addMetricsProducers(MetricsProducer... producer) {
return;
}

@Override
public void init() {
throw new UnsupportedOperationException("Unimplemented method 'init'");
}

@Override
public MeterRegistry getRegistry() {
throw new UnsupportedOperationException("Unimplemented method 'getRegistry'");
}

@Override
public void close() {
throw new UnsupportedOperationException("Unimplemented method 'close'");
}

}
}
5 changes: 4 additions & 1 deletion src/main/java/org/apache/accumulo/proxy/ProxyServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ public ProxyServer(Properties props) {
}

protected AccumuloClient getClient(String sharedSecret) throws Exception {

if (sharedSecret.equals(this.sharedSecret)) {
return client;
} else {
Expand Down Expand Up @@ -2118,7 +2119,9 @@ public String createConditionalWriter(String sharedSecret, String tableName,
try {
ConditionalWriterConfig cwc = new ConditionalWriterConfig();
if (options.getMaxMemory() != 0) {
// TODO
// TODO - This was left blank, I'm not sure why it's here. For now, it will log the max
// memory
Comment on lines +2122 to +2123
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at ConditionalWriterConfig, there is no variable to assign for maxMemory.

I'm not sure why that is in the proxy.thrift as I don't see a maxMemory value in accumulo at all.

This can probably be removed in a follow up PR that modifies the proxy.thrift code and regenerates the thrift generated java code.

logger.info("Max memory: " + options.getMaxMemory());
}
if (options.isSetThreads() && options.getThreads() != 0) {
cwc.setMaxWriteThreads(options.getThreads());
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/org/apache/accumulo/proxy/TServerUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -187,8 +188,10 @@ private static ServerAddress createNonBlockingServer(HostAndPort address, TProce
private static ThreadPoolExecutor createSelfResizingThreadPool(final String serverName,
final int executorThreads, long threadTimeOut, final AccumuloConfiguration conf,
long timeBetweenThreadChecks) {
final ThreadPoolExecutor pool = ThreadPools.getServerThreadPools().createFixedThreadPool(
executorThreads, threadTimeOut, TimeUnit.MILLISECONDS, serverName + "-ClientPool", true);
final ThreadPoolExecutor pool = ThreadPools.getServerThreadPools()
.getPoolBuilder(serverName + "-ClientPool").numCoreThreads(executorThreads)
.numMaxThreads(executorThreads).withTimeOut(threadTimeOut, TimeUnit.MILLISECONDS)
.enableThreadPoolMetrics(true).withQueue(new LinkedBlockingQueue<>()).build();
// periodically adjust the number of threads we need by checking how busy our threads are
ThreadPools.watchCriticalFixedDelay(conf, timeBetweenThreadChecks, () -> {
// there is a minor race condition between sampling the current state of the thread pool
Expand Down Expand Up @@ -276,7 +279,7 @@ private static TServerSocket getSslServerSocket(int port, int timeout, InetAddre
TSSLTransportFactory.getServerSocket(port, timeout, params.isClientAuth(), address);
} else {
tServerSock = TSSLTransportFactory.getServerSocket(port, timeout, address,
params.getTTransportParams());
params.getTSSLTransportParameters());
}

final ServerSocket serverSock = tServerSock.getServerSocket();
Expand Down
Loading