Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d2fdc39
Use the official aws-sdk instead of jet3t
jihoonson Feb 12, 2018
19f5021
fix compile and serde tests
jihoonson Feb 12, 2018
dbc945c
address comments and fix test
jihoonson Feb 14, 2018
1e28b1a
add http version string
jihoonson Feb 14, 2018
3dc2ec9
remove redundant dependencies, fix potential NPE, and fix test
jihoonson Feb 14, 2018
efb7cad
resolve TODOs
jihoonson Feb 21, 2018
26b7562
Merge branch 'master' of github.com:druid-io/druid into aws-sdk
jihoonson Feb 21, 2018
cc63964
fix build
jihoonson Feb 21, 2018
2b51ea7
downgrade jackson version to 2.6.7
jihoonson Feb 21, 2018
c9db6f5
fix test
jihoonson Feb 22, 2018
1062a92
resolve the last TODO
jihoonson Feb 23, 2018
55750da
Merge branch 'master' of github.com:druid-io/druid into aws-sdk
jihoonson Feb 27, 2018
60419aa
support proxy and endpoint configurations
jihoonson Mar 2, 2018
b151371
fix build
jihoonson Mar 2, 2018
97e2db0
remove debugging log
jihoonson Mar 2, 2018
5f2c465
downgrade hadoop version to 2.8.3
jihoonson Mar 6, 2018
a8602f3
fix tests
jihoonson Mar 6, 2018
d144482
Merge branch 'master' of github.com:druid-io/druid into aws-sdk
jihoonson Mar 7, 2018
97c6b03
remove unused log
jihoonson Mar 7, 2018
adf3cbb
fix it test
jihoonson Mar 7, 2018
421d15e
Merge branch 'master' of github.com:druid-io/druid into aws-sdk
jihoonson Mar 7, 2018
e8847a1
revert KerberosAuthenticator change
jihoonson Mar 7, 2018
8774211
change hadoop-aws scope to provided in hdfs-storage
jihoonson Mar 7, 2018
b73d61e
address comments
jihoonson Mar 13, 2018
1c0b07c
Merge branch 'master' of github.com:druid-io/druid into aws-sdk
jihoonson Mar 19, 2018
66dae38
address comments
jihoonson Mar 20, 2018
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ matrix:
- sudo: false
env:
- NAME="other modules test"
- AWS_REGION=us-east-1 # set a aws region for unit tests
install: echo "MAVEN_OPTS='-Xmx3000m'" > ~/.mavenrc && mvn install -q -ff -DskipTests -B
before_script:
- unset _JAVA_OPTIONS
Expand Down
4 changes: 2 additions & 2 deletions api/src/main/java/io/druid/guice/JsonConfigProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ public static <T> void bind(
Key<Supplier<T>> supplierKey
)
{
binder.bind(supplierKey).toProvider((Provider) of(propertyBase, clazz)).in(LazySingleton.class);
binder.bind(instanceKey).toProvider(new SupplierProvider<T>(supplierKey));
binder.bind(supplierKey).toProvider(of(propertyBase, clazz)).in(LazySingleton.class);
binder.bind(instanceKey).toProvider(new SupplierProvider<>(supplierKey));
}

@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ public void testMapInputRowParserSerde() throws Exception
null
)
);
final MapInputRowParser parser2 = jsonMapper.readValue(
final MapInputRowParser parser2 = (MapInputRowParser) jsonMapper.readValue(
jsonMapper.writeValueAsBytes(parser),
MapInputRowParser.class
InputRowParser.class
);
final InputRow parsed = parser2.parseBatch(
ImmutableMap.<String, Object>of(
Expand Down Expand Up @@ -134,9 +134,9 @@ public void testMapInputRowParserNumbersSerde() throws Exception
null
)
);
final MapInputRowParser parser2 = jsonMapper.readValue(
final MapInputRowParser parser2 = (MapInputRowParser) jsonMapper.readValue(
jsonMapper.writeValueAsBytes(parser),
MapInputRowParser.class
InputRowParser.class
);
final InputRow parsed = parser2.parseBatch(
ImmutableMap.<String, Object>of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ public void testSerde() throws IOException
feature
);

final JSONParseSpec serde = jsonMapper.readValue(
final JSONParseSpec serde = (JSONParseSpec) jsonMapper.readValue(
jsonMapper.writeValueAsString(spec),
JSONParseSpec.class
ParseSpec.class
);
Assert.assertEquals("timestamp", serde.getTimestampSpec().getTimestampColumn());
Assert.assertEquals("iso", serde.getTimestampSpec().getTimestampFormat());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ public void testSerde() throws IOException
"abc",
JavaScriptConfig.getEnabledInstance()
);
final JavaScriptParseSpec serde = jsonMapper.readValue(
final JavaScriptParseSpec serde = (JavaScriptParseSpec) jsonMapper.readValue(
jsonMapper.writeValueAsString(spec),
JavaScriptParseSpec.class
ParseSpec.class
);
Assert.assertEquals("abc", serde.getTimestampSpec().getTimestampColumn());
Assert.assertEquals("iso", serde.getTimestampSpec().getTimestampFormat());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public void testSerde() throws IOException
Collections.singletonList("abc"),
"abc"
);
final RegexParseSpec serde = jsonMapper.readValue(
final RegexParseSpec serde = (RegexParseSpec) jsonMapper.readValue(
jsonMapper.writeValueAsString(spec),
RegexParseSpec.class
ParseSpec.class
);
Assert.assertEquals("abc", serde.getTimestampSpec().getTimestampColumn());
Assert.assertEquals("iso", serde.getTimestampSpec().getTimestampFormat());
Expand Down
2 changes: 1 addition & 1 deletion aws-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-ec2</artifactId>
<artifactId>aws-java-sdk-bundle</artifactId>
</dependency>

<!-- Tests -->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Licensed to Metamarkets Group Inc. (Metamarkets) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Metamarkets licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package io.druid.common.aws;

import com.fasterxml.jackson.annotation.JsonProperty;

public class AWSEndpointConfig
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I'm not sure how to use that. Does SDKGlobalConfiguration provide an endpoint configuration?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Basically if there's functionality in this config that is not available in the SDK supported system properties and env vars, then that is fine. But if all the config stuff can be done in SDK idiomatic ways, then I suggest we simply document where to find info on the SDK.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@drcrallen the linked doc is for credentials and we're already using it for credentials.

AFAIK, aws-java-sdk doesn't provide such a configuration chain for the endpoint configuration. Instead, it's recommended to use AwsClientBuilder.EndpointConfiguration (https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/client/builder/AwsClientBuilder.EndpointConfiguration.html) or AmazonS3Client.setEndpoint() (https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/AmazonWebServiceClient.html#setEndpoint-java.lang.String-java.lang.String-java.lang.String-). I used the later one even though it's deprecated because using AwsClientBuilder causes some injection problem. I didn't dig that problem and not sure how to fix it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As another example: https://github.com/aws/aws-sdk-java/blob/1.11.293/aws-java-sdk-core/src/main/java/com/amazonaws/regions/LegacyRegionXmlMetadataBuilder.java allows specifying region endpoints. But those might be such an esoteric way of specifying things then it could be better to just handle it on our own until more obvious ways arise.

{
@JsonProperty
private String url;

@JsonProperty
private String serviceName;

@JsonProperty
private String signingRegion;

@JsonProperty
public String getUrl()
{
return url;
}

@JsonProperty
public String getServiceName()
{
return serviceName;
}

@JsonProperty
public String getSigningRegion()
{
return signingRegion;
}
}
61 changes: 61 additions & 0 deletions aws-common/src/main/java/io/druid/common/aws/AWSProxyConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Licensed to Metamarkets Group Inc. (Metamarkets) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Metamarkets licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package io.druid.common.aws;

import com.fasterxml.jackson.annotation.JsonProperty;

public class AWSProxyConfig
{
@JsonProperty
private String host;

@JsonProperty
private int port = -1; // AWS's default proxy port is -1

@JsonProperty
private String username;

@JsonProperty
private String password;

@JsonProperty
public String getHost()
{
return host;
}

@JsonProperty
public int getPort()
{
return port;
}

@JsonProperty
public String getUsername()
{
return username;
}

@JsonProperty
public String getPassword()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can this be a PasswordProvider?

Copy link
Copy Markdown
Contributor Author

@jihoonson jihoonson Mar 13, 2018

Choose a reason for hiding this comment

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

What do you mean? If you mean AWSCredentialsProvider, it can't be used here because this is for proxy configuration. If you mean we need a sort of credentialsProvider for proxy, I agree but want to do in a follow-up pr.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

{
return password;
}
}
16 changes: 1 addition & 15 deletions common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,21 +157,7 @@
<groupId>com.lmax</groupId>
<artifactId>disruptor</artifactId>
</dependency>
<!--
Druid doesn't ACTUALLY depend on jets3t in its core, but quite a few of the extensions do. This leads to a nasty ClassLoader problem
There's a bug in
https://github.com/apache/httpclient/blob/4.5.2/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AbstractHttpClient.java#L332
Where httpclient does not care what your context classloader is when looking for the connection manager factories. See https://issues.apache.org/jira/browse/HTTPCLIENT-1727
A few extensions depend on jets3t, so we include it explicitly here to make sure it can load up its
org.jets3t.service.utils.RestUtils$ConnManagerFactory
properly
Future releases which include HTTPCLIENT-1727 should probably set the context loader whenever jets3t calls are used
-->
<dependency>
<groupId>net.java.dev.jets3t</groupId>
<artifactId>jets3t</artifactId>
<version>0.9.4</version>
</dependency>

<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
Expand Down
18 changes: 12 additions & 6 deletions docs/content/development/extensions-core/s3.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@ S3-compatible deep storage is basically either S3 or something like Google Stora

### Configuration

|Property|Possible Values|Description|Default|
|--------|---------------|-----------|-------|
|`druid.s3.accessKey`||S3 access key.|Must be set.|
|`druid.s3.secretKey`||S3 secret key.|Must be set.|
|`druid.storage.bucket`||Bucket to store in.|Must be set.|
|`druid.storage.baseKey`||Base key prefix to use, i.e. what directory.|Must be set.|
|Property|Description|Default|
|--------|-----------|-------|
|`druid.s3.accessKey`|S3 access key.|Must be set.|
|`druid.s3.secretKey`|S3 secret key.|Must be set.|
|`druid.storage.bucket`|Bucket to store in.|Must be set.|
|`druid.storage.baseKey`|Base key prefix to use, i.e. what directory.|Must be set.|
|`druid.s3.endpoint.url`|Service endpoint either with or without the protocol.|None|
|`druid.s3.endpoint.signingRegion`|Region to use for SigV4 signing of requests (e.g. us-west-1).|None|
|`druid.s3.proxy.host`|Proxy host to connect through.|None|
|`druid.s3.proxy.port`|Port on the proxy host to connect through.|None|
|`druid.s3.proxy.username`|User name to use when connecting through a proxy.|None|
|`druid.s3.proxy.password`|Password to use when connecting through a proxy.|None|

## StaticS3Firehose

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,14 @@ public Principal getUserPrincipal()
};
if (newToken && !token.isExpired() && token != AuthenticationToken.ANONYMOUS) {
String signedToken = mySigner.sign(token.toString());
tokenToAuthCookie(httpResponse,
signedToken,
getCookieDomain(),
getCookiePath(),
token.getExpires(),
!token.isExpired() && token.getExpires() > 0,
isHttps
tokenToAuthCookie(
httpResponse,
signedToken,
getCookieDomain(),
getCookiePath(),
token.getExpires(),
!token.isExpired() && token.getExpires() > 0,
isHttps
);
}
doFilter(filterChain, httpRequest, httpResponse);
Expand All @@ -361,8 +362,14 @@ public Principal getUserPrincipal()
}
if (unauthorizedResponse) {
if (!httpResponse.isCommitted()) {
tokenToAuthCookie(httpResponse, "", getCookieDomain(),
getCookiePath(), 0, false, isHttps
tokenToAuthCookie(
httpResponse,
"",
getCookieDomain(),
getCookiePath(),
0,
false,
isHttps
);
// If response code is 401. Then WWW-Authenticate Header should be
// present.. reset to 403 if not found..
Expand Down
11 changes: 1 addition & 10 deletions extensions-core/hdfs-storage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,7 @@
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-aws</artifactId>
<version>${hadoop.compile.version}</version>
<exclusions>
<exclusion>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Sets;
import com.google.inject.Inject;
import io.druid.java.util.common.StringUtils;
import io.druid.java.util.common.logger.Logger;
import io.druid.segment.loading.DataSegmentFinder;
import io.druid.segment.loading.SegmentLoadingException;
import io.druid.timeline.DataSegment;
import io.druid.java.util.common.StringUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.LocatedFileStatus;
Expand Down
Loading