Skip to content

Commit

Permalink
Merge Gian's change to support Netty 4 in FrameFileHttpResponseHandler
Browse files Browse the repository at this point in the history
…apache#1 from gianm/remove-netty-3

Merge from master and update FrameFileHttpResponseHandler to use Netty 4.
  • Loading branch information
xvrl authored Aug 9, 2022
2 parents d55abc0 + d7ee8ec commit 902a99b
Show file tree
Hide file tree
Showing 302 changed files with 15,959 additions and 2,057 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ README
.pmdruleset.xml
.java-version
integration-tests/gen-scripts/
bin/
/bin/
*.hprof
36 changes: 18 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ jobs:
jdk: openjdk11

- <<: *package
name: "(openjdk15) packaging check"
name: "(openjdk17) packaging check"
stage: Tests - phase 2
jdk: openjdk15
jdk: openjdk17

- &test_processing_module
name: "(openjdk8) processing module test"
Expand Down Expand Up @@ -259,9 +259,9 @@ jobs:
jdk: openjdk11

- <<: *test_processing_module
name: "(openjdk15) processing module test"
name: "(openjdk17) processing module test"
stage: Tests - phase 2
jdk: openjdk15
jdk: openjdk17

- &test_processing_module_sqlcompat
<<: *test_processing_module
Expand All @@ -276,9 +276,9 @@ jobs:
jdk: openjdk11

- <<: *test_processing_module_sqlcompat
name: "(openjdk15) processing module test (SQL Compatibility)"
name: "(openjdk17) processing module test (SQL Compatibility)"
stage: Tests - phase 2
jdk: openjdk15
jdk: openjdk17

- &test_indexing_module
<<: *test_processing_module
Expand All @@ -292,9 +292,9 @@ jobs:
jdk: openjdk11

- <<: *test_indexing_module
name: "(openjdk15) indexing modules test"
name: "(openjdk17) indexing modules test"
stage: Tests - phase 2
jdk: openjdk15
jdk: openjdk17

- &test_indexing_module_sqlcompat
<<: *test_indexing_module
Expand All @@ -308,9 +308,9 @@ jobs:
jdk: openjdk11

- <<: *test_indexing_module_sqlcompat
name: "(openjdk15) indexing modules test (SQL Compatibility)"
name: "(openjdk17) indexing modules test (SQL Compatibility)"
stage: Tests - phase 2
jdk: openjdk15
jdk: openjdk17

- &test_server_module
<<: *test_processing_module
Expand All @@ -324,9 +324,9 @@ jobs:
jdk: openjdk11

- <<: *test_server_module
name: "(openjdk15) server module test"
name: "(openjdk17) server module test"
stage: Tests - phase 2
jdk: openjdk15
jdk: openjdk17

- &test_server_module_sqlcompat
<<: *test_server_module
Expand All @@ -339,9 +339,9 @@ jobs:
jdk: openjdk11

- <<: *test_server_module_sqlcompat
name: "(openjdk15) server module test (SQL Compatibility)"
name: "(openjdk17) server module test (SQL Compatibility)"
stage: Tests - phase 2
jdk: openjdk15
jdk: openjdk17

- &test_other_modules
<<: *test_processing_module
Expand All @@ -355,9 +355,9 @@ jobs:
jdk: openjdk11

- <<: *test_other_modules
name: "(openjdk15) other modules test"
name: "(openjdk17) other modules test"
stage: Tests - phase 2
jdk: openjdk15
jdk: openjdk17

- &test_other_modules_sqlcompat
<<: *test_other_modules
Expand All @@ -370,9 +370,9 @@ jobs:
jdk: openjdk11

- <<: *test_other_modules_sqlcompat
name: "(openjdk15) other modules test (SQL Compatibility)"
name: "(openjdk17) other modules test (SQL Compatibility)"
stage: Tests - phase 2
jdk: openjdk15
jdk: openjdk17

- name: "web console"
install: skip
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Chat with Druid committers and users in real-time on the Apache Druid Slack chan

Please note that JDK 8 or JDK 11 is required to build Druid.

For instructions on building Druid from source, see [docs/development/build.md](docs/development/build.md)
See the latest [build guide](https://druid.apache.org/docs/latest/development/build.html) for instructions on building Apache Druid from source.

### Contributing

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,12 @@
import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.services.ec2.AmazonEC2;
import com.amazonaws.services.ec2.AmazonEC2Client;
import com.fasterxml.jackson.databind.Module;
import com.google.inject.Binder;
import com.google.inject.Provides;
import org.apache.druid.guice.JsonConfigProvider;
import org.apache.druid.guice.LazySingleton;
import org.apache.druid.initialization.DruidModule;

import java.util.Collections;
import java.util.List;

public class AWSModule implements DruidModule
{
@Override
Expand All @@ -56,10 +52,4 @@ public AmazonEC2 getEc2Client(AWSCredentialsProvider credentials)
{
return new AmazonEC2Client(credentials);
}

@Override
public List<? extends Module> getJacksonModules()
{
return Collections.emptyList();
}
}
8 changes: 0 additions & 8 deletions cloud/gcp-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,10 @@
<artifactId>jackson-module-guice</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@

package org.apache.druid.common.gcp;

import com.fasterxml.jackson.databind.Module;
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.common.collect.ImmutableList;
import com.google.inject.Binder;
import com.google.inject.Provides;
import org.apache.druid.guice.LazySingleton;
Expand All @@ -35,23 +33,15 @@
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.util.Collections;
import java.util.List;

public class GcpModule implements DruidModule
{
@Override
public List<? extends Module> getJacksonModules()
{
return ImmutableList.of();
}

@Override
public void configure(Binder binder)
{
// Nothing to proactively bind
}


@Provides
@LazySingleton
public HttpRequestInitializer getHttpRequestInitializer(HttpTransport transport, JsonFactory factory)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,24 @@

package org.apache.druid.common.gcp;

import com.fasterxml.jackson.databind.Module;
import com.google.api.client.googleapis.testing.auth.oauth2.MockGoogleCredential;
import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.testing.http.MockHttpTransport;
import com.google.common.collect.ImmutableList;
import com.google.inject.Binder;
import com.google.inject.Provides;
import org.apache.druid.guice.LazySingleton;
import org.apache.druid.initialization.DruidModule;

import java.util.List;

public class GcpMockModule implements DruidModule
{
@Override
public List<? extends Module> getJacksonModules()
{
return ImmutableList.of();
}

@Override
public void configure(Binder binder)
{

}


@Provides
@LazySingleton
public HttpRequestInitializer mockRequestInitializer(
Expand Down
7 changes: 7 additions & 0 deletions codestyle/spotbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@
<Class name="org.apache.druid.sql.calcite.planner.CapturedState" />
</And>
</Match>
<Match>
<!-- Spotbugs doesn't like the MAGIC array -->
<And>
<Bug pattern="MS_MUTABLE_ARRAY" />
<Class name="org.apache.druid.frame.file.FrameFileWriter" />
</And>
</Match>

<Bug pattern="AT_OPERATION_SEQUENCE_ON_CONCURRENT_ABSTRACTION"/>
<Bug pattern="BC_UNCONFIRMED_CAST"/>
Expand Down
66 changes: 66 additions & 0 deletions core/src/main/java/org/apache/druid/common/guava/FutureUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@

package org.apache.druid.common.guava;

import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import org.apache.druid.java.util.common.ISE;

import javax.annotation.Nullable;
import java.io.Closeable;
import java.util.concurrent.ExecutionException;
import java.util.function.Function;

Expand Down Expand Up @@ -74,6 +79,22 @@ public static <T> T getUnchecked(final ListenableFuture<T> future, final boolean
}
}

/**
* Gets the result of a given future immediately.
*
* Equivalent to {@link #getUnchecked} if the future is ready. Otherwise, throws an {@link IllegalStateException}.
*/
public static <T> T getUncheckedImmediately(final ListenableFuture<T> future)
{
if (future.isDone()) {
return getUnchecked(future, false);
} else if (future.isCancelled()) {
throw new ISE("Canceled");
} else {
throw new ISE("Not yet done");
}
}

/**
* Like {@link Futures#transform}, but works better with lambdas due to not having overloads.
*
Expand All @@ -84,4 +105,49 @@ public static <T, R> ListenableFuture<R> transform(final ListenableFuture<T> fut
{
return Futures.transform(future, fn::apply);
}

/**
* Returns a future that resolves when "future" resolves and "baggage" has been closed. If the baggage is closed
* successfully, the returned future will have the same value (or exception status) as the input future. If the
* baggage is not closed successfully, the returned future will resolve to an exception.
*/
public static <T> ListenableFuture<T> futureWithBaggage(final ListenableFuture<T> future, final Closeable baggage)
{
final SettableFuture<T> retVal = SettableFuture.create();

Futures.addCallback(
future,
new FutureCallback<T>()
{
@Override
public void onSuccess(@Nullable T result)
{
try {
baggage.close();
}
catch (Exception e) {
retVal.setException(e);
return;
}

retVal.set(result);
}

@Override
public void onFailure(Throwable e)
{
try {
baggage.close();
}
catch (Exception e2) {
e.addSuppressed(e2);
}

retVal.setException(e);
}
}
);

return retVal;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,22 @@
import com.fasterxml.jackson.databind.Module;
import org.apache.druid.guice.annotations.ExtensionPoint;

import java.util.Collections;
import java.util.List;

/**
* A Guice module which also provides Jackson modules.
* Extension modules must implement this interface.
* (Enforced in {@code ExtensionInjectorBuilder}).
* Built-in implementations that do not provide Jackson modules can
* implement the simpler {@link com.google.inject.Module Guice Module}
* interface instead.
*/
@ExtensionPoint
public interface DruidModule extends com.google.inject.Module
{
List<? extends Module> getJacksonModules();
default List<? extends Module> getJacksonModules()
{
return Collections.emptyList();
}
}
Loading

0 comments on commit 902a99b

Please sign in to comment.