From fd12b1b483014bfffcf0dcb82415e142444d84ea Mon Sep 17 00:00:00 2001 From: Akshat Jain Date: Mon, 16 Dec 2024 19:07:02 +0530 Subject: [PATCH 1/5] Remove support for Java 11 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3f80196334aa..a69fd6cb0755 100644 --- a/pom.xml +++ b/pom.xml @@ -70,7 +70,7 @@ - 11 + 17 ${java.version} UTF-8 0.9.0.M2 From 4f607fd9075a5bace5b1d58188d9bffeef390b87 Mon Sep 17 00:00:00 2001 From: Akshat Jain Date: Mon, 16 Dec 2024 19:28:10 +0530 Subject: [PATCH 2/5] Remove 11 from jdk matrices --- .github/workflows/static-checks.yml | 2 +- .github/workflows/unit-and-integration-tests-unified.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/static-checks.yml b/.github/workflows/static-checks.yml index 778a79db7618..ca4b928a5a10 100644 --- a/.github/workflows/static-checks.yml +++ b/.github/workflows/static-checks.yml @@ -42,7 +42,7 @@ jobs: fail-fast: false matrix: # Use JDK 21.0.4 to work around https://github.com/apache/druid/issues/17429 - java: [ '11', '17', '21.0.4' ] + java: [ '17', '21.0.4' ] runs-on: ubuntu-latest steps: - name: checkout branch diff --git a/.github/workflows/unit-and-integration-tests-unified.yml b/.github/workflows/unit-and-integration-tests-unified.yml index 81375f33c090..b5dc784751d0 100644 --- a/.github/workflows/unit-and-integration-tests-unified.yml +++ b/.github/workflows/unit-and-integration-tests-unified.yml @@ -80,7 +80,7 @@ jobs: fail-fast: false matrix: # Use JDK 21.0.4 to work around https://github.com/apache/druid/issues/17429 - jdk: [ '11', '17', '21.0.4' ] + jdk: [ '17', '21.0.4' ] runs-on: ubuntu-latest steps: - name: Checkout branch @@ -162,7 +162,7 @@ jobs: fail-fast: false matrix: # Use JDK 21.0.4 to work around https://github.com/apache/druid/issues/17429 - jdk: [ '11', '21.0.4' ] + jdk: [ '21.0.4' ] name: "unit tests (jdk${{ matrix.jdk }}, sql-compat=true)" uses: ./.github/workflows/unit-tests.yml needs: unit-tests From 7b3519385affc4c4f07b5e5335fcf13655c33eae Mon Sep 17 00:00:00 2001 From: Akshat Jain Date: Tue, 17 Dec 2024 10:27:46 +0530 Subject: [PATCH 3/5] Upgrade Guice to 5.1.0 --- benchmarks/pom.xml | 6 +-- .../aliyun-oss-extensions/pom.xml | 6 +-- extensions-contrib/cassandra-storage/pom.xml | 6 +-- .../cloudfiles-extensions/pom.xml | 6 --- extensions-contrib/grpc-query/pom.xml | 6 +-- .../kubernetes-overlord-extensions/pom.xml | 6 +-- .../materialized-view-selection/pom.xml | 6 +-- .../moving-average-query/pom.xml | 6 +-- .../sqlserver-metadata-storage/pom.xml | 6 +-- extensions-core/azure-extensions/pom.xml | 6 +-- extensions-core/google-extensions/pom.xml | 6 +-- extensions-core/hdfs-storage/pom.xml | 6 +-- extensions-core/kubernetes-extensions/pom.xml | 6 +-- extensions-core/lookups-cached-global/pom.xml | 6 +-- extensions-core/multi-stage-query/pom.xml | 6 +-- .../mysql-metadata-storage/pom.xml | 6 +-- .../postgresql-metadata-storage/pom.xml | 6 +-- extensions-core/s3-extensions/pom.xml | 6 +-- indexing-service/pom.xml | 6 +-- integration-tests-ex/cases/pom.xml | 6 +-- integration-tests/pom.xml | 6 +-- pom.xml | 7 +-- processing/pom.xml | 6 +-- .../org/apache/druid/guice/PolyBindTest.java | 6 +-- .../query/DruidProcessingConfigTest.java | 2 +- quidem-ut/pom.xml | 4 -- server/pom.xml | 6 +-- .../druid/server/QuerySchedulerTest.java | 43 ++++++++++++------- services/pom.xml | 6 +-- sql/pom.xml | 6 +-- 30 files changed, 56 insertions(+), 156 deletions(-) diff --git a/benchmarks/pom.xml b/benchmarks/pom.xml index bd8c89b4d7f6..89d2e9b7b8fd 100644 --- a/benchmarks/pom.xml +++ b/benchmarks/pom.xml @@ -61,11 +61,7 @@ org.easymock easymock - - com.google.inject.extensions - guice-multibindings - provided - + org.apache.druid druid-processing diff --git a/extensions-contrib/aliyun-oss-extensions/pom.xml b/extensions-contrib/aliyun-oss-extensions/pom.xml index 82ee50eddf97..5ffbb88a78b4 100644 --- a/extensions-contrib/aliyun-oss-extensions/pom.xml +++ b/extensions-contrib/aliyun-oss-extensions/pom.xml @@ -80,11 +80,7 @@ jackson-core provided - - com.google.inject.extensions - guice-multibindings - provided - + com.google.guava guava diff --git a/extensions-contrib/cassandra-storage/pom.xml b/extensions-contrib/cassandra-storage/pom.xml index 7b5fc2be1831..c7f2a35e973a 100644 --- a/extensions-contrib/cassandra-storage/pom.xml +++ b/extensions-contrib/cassandra-storage/pom.xml @@ -174,11 +174,7 @@ jackson-core provided - - com.google.inject.extensions - guice-multibindings - provided - + diff --git a/extensions-contrib/cloudfiles-extensions/pom.xml b/extensions-contrib/cloudfiles-extensions/pom.xml index 0fd5018d1311..e5076e1d2284 100644 --- a/extensions-contrib/cloudfiles-extensions/pom.xml +++ b/extensions-contrib/cloudfiles-extensions/pom.xml @@ -56,12 +56,6 @@ - - com.google.inject.extensions - guice-multibindings - provided - - commons-io commons-io diff --git a/extensions-contrib/grpc-query/pom.xml b/extensions-contrib/grpc-query/pom.xml index e46f0c35fd2d..9f224680d9e0 100644 --- a/extensions-contrib/grpc-query/pom.xml +++ b/extensions-contrib/grpc-query/pom.xml @@ -96,11 +96,7 @@ jackson-core provided - - com.google.inject.extensions - guice-multibindings - provided - + com.google.guava guava diff --git a/extensions-contrib/kubernetes-overlord-extensions/pom.xml b/extensions-contrib/kubernetes-overlord-extensions/pom.xml index 55f970fb9c39..1a349b37a37c 100644 --- a/extensions-contrib/kubernetes-overlord-extensions/pom.xml +++ b/extensions-contrib/kubernetes-overlord-extensions/pom.xml @@ -212,11 +212,7 @@ jackson-databind provided - - com.google.inject.extensions - guice-multibindings - provided - + joda-time joda-time diff --git a/extensions-contrib/materialized-view-selection/pom.xml b/extensions-contrib/materialized-view-selection/pom.xml index 4e44bfde5c6c..620c59b926a2 100644 --- a/extensions-contrib/materialized-view-selection/pom.xml +++ b/extensions-contrib/materialized-view-selection/pom.xml @@ -84,11 +84,7 @@ jackson-core provided - - com.google.inject.extensions - guice-multibindings - provided - + org.jdbi jdbi diff --git a/extensions-contrib/moving-average-query/pom.xml b/extensions-contrib/moving-average-query/pom.xml index 119296634566..a86c458a1c21 100644 --- a/extensions-contrib/moving-average-query/pom.xml +++ b/extensions-contrib/moving-average-query/pom.xml @@ -79,11 +79,7 @@ jackson-core provided - - com.google.inject.extensions - guice-multibindings - provided - + com.google.guava guava diff --git a/extensions-contrib/sqlserver-metadata-storage/pom.xml b/extensions-contrib/sqlserver-metadata-storage/pom.xml index 1fd186f9dc84..a3363be1eeab 100644 --- a/extensions-contrib/sqlserver-metadata-storage/pom.xml +++ b/extensions-contrib/sqlserver-metadata-storage/pom.xml @@ -67,11 +67,7 @@ jackson-databind provided - - com.google.inject.extensions - guice-multibindings - provided - + org.apache.commons commons-dbcp2 diff --git a/extensions-core/azure-extensions/pom.xml b/extensions-core/azure-extensions/pom.xml index af36456bbe70..c202194e6d01 100644 --- a/extensions-core/azure-extensions/pom.xml +++ b/extensions-core/azure-extensions/pom.xml @@ -111,11 +111,7 @@ jackson-core provided - - com.google.inject.extensions - guice-multibindings - provided - + com.google.guava guava diff --git a/extensions-core/google-extensions/pom.xml b/extensions-core/google-extensions/pom.xml index 39f89a2e5a53..dc34d8f1acad 100644 --- a/extensions-core/google-extensions/pom.xml +++ b/extensions-core/google-extensions/pom.xml @@ -82,11 +82,7 @@ jackson-core provided - - com.google.inject.extensions - guice-multibindings - provided - + com.google.guava guava diff --git a/extensions-core/hdfs-storage/pom.xml b/extensions-core/hdfs-storage/pom.xml index ac8f7878e5d6..881ba1884716 100644 --- a/extensions-core/hdfs-storage/pom.xml +++ b/extensions-core/hdfs-storage/pom.xml @@ -88,11 +88,7 @@ jackson-core provided - - com.google.inject.extensions - guice-multibindings - provided - + org.apache.commons commons-lang3 diff --git a/extensions-core/kubernetes-extensions/pom.xml b/extensions-core/kubernetes-extensions/pom.xml index 6ef180795e25..1fd0bd0af346 100644 --- a/extensions-core/kubernetes-extensions/pom.xml +++ b/extensions-core/kubernetes-extensions/pom.xml @@ -109,11 +109,7 @@ jackson-databind provided - - com.google.inject.extensions - guice-multibindings - provided - + joda-time joda-time diff --git a/extensions-core/lookups-cached-global/pom.xml b/extensions-core/lookups-cached-global/pom.xml index 6fed0c9cb17b..e0feb8ddf687 100644 --- a/extensions-core/lookups-cached-global/pom.xml +++ b/extensions-core/lookups-cached-global/pom.xml @@ -84,11 +84,7 @@ jackson-core provided - - com.google.inject.extensions - guice-multibindings - provided - + org.jdbi jdbi diff --git a/extensions-core/multi-stage-query/pom.xml b/extensions-core/multi-stage-query/pom.xml index e2a7252908df..c89a1b92d6a8 100644 --- a/extensions-core/multi-stage-query/pom.xml +++ b/extensions-core/multi-stage-query/pom.xml @@ -71,11 +71,7 @@ guice provided - - com.google.inject.extensions - guice-multibindings - provided - + com.google.guava guava diff --git a/extensions-core/mysql-metadata-storage/pom.xml b/extensions-core/mysql-metadata-storage/pom.xml index 57f5ab4f12aa..be407eb5ed38 100644 --- a/extensions-core/mysql-metadata-storage/pom.xml +++ b/extensions-core/mysql-metadata-storage/pom.xml @@ -78,11 +78,7 @@ jackson-databind provided - - com.google.inject.extensions - guice-multibindings - provided - + org.apache.commons commons-dbcp2 diff --git a/extensions-core/postgresql-metadata-storage/pom.xml b/extensions-core/postgresql-metadata-storage/pom.xml index 9c4159e36e81..fafd54869abb 100644 --- a/extensions-core/postgresql-metadata-storage/pom.xml +++ b/extensions-core/postgresql-metadata-storage/pom.xml @@ -76,11 +76,7 @@ jackson-databind provided - - com.google.inject.extensions - guice-multibindings - provided - + org.apache.commons commons-dbcp2 diff --git a/extensions-core/s3-extensions/pom.xml b/extensions-core/s3-extensions/pom.xml index cb9a03a5bae8..21928e3ad5a0 100644 --- a/extensions-core/s3-extensions/pom.xml +++ b/extensions-core/s3-extensions/pom.xml @@ -87,11 +87,7 @@ jackson-core provided - - com.google.inject.extensions - guice-multibindings - provided - + org.apache.commons commons-lang3 diff --git a/indexing-service/pom.xml b/indexing-service/pom.xml index 412568ea88c9..dd28de400cc2 100644 --- a/indexing-service/pom.xml +++ b/indexing-service/pom.xml @@ -88,11 +88,7 @@ com.fasterxml.jackson.core jackson-databind - - com.google.inject.extensions - guice-multibindings - provided - + javax.ws.rs jsr311-api diff --git a/integration-tests-ex/cases/pom.xml b/integration-tests-ex/cases/pom.xml index 94c42a0555b4..b6c2ffc75f3c 100644 --- a/integration-tests-ex/cases/pom.xml +++ b/integration-tests-ex/cases/pom.xml @@ -83,11 +83,7 @@ com.google.inject guice - - com.google.inject.extensions - guice-multibindings - provided - + org.apache.curator curator-framework diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index be57e12bf3dc..411ba0a2d250 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -278,11 +278,7 @@ com.google.inject guice - - com.google.inject.extensions - guice-multibindings - provided - + com.fasterxml.jackson.core jackson-databind diff --git a/pom.xml b/pom.xml index a69fd6cb0755..efd546630b7d 100644 --- a/pom.xml +++ b/pom.xml @@ -95,7 +95,7 @@ 2.35.1 8.5.4 32.0.1-jre - 4.2.2 + 5.1.0 1.3 9.4.56.v20240826 1.19.4 @@ -596,11 +596,6 @@ guice-servlet ${guice.version} - - com.google.inject.extensions - guice-multibindings - ${guice.version} - com.google.inject.extensions guice-assistedinject diff --git a/processing/pom.xml b/processing/pom.xml index efcaf62c4b71..c3f758f32139 100644 --- a/processing/pom.xml +++ b/processing/pom.xml @@ -103,11 +103,7 @@ com.google.inject guice - - com.google.inject.extensions - guice-multibindings - provided - + com.google.code.findbugs jsr305 diff --git a/processing/src/test/java/org/apache/druid/guice/PolyBindTest.java b/processing/src/test/java/org/apache/druid/guice/PolyBindTest.java index 372d428458d6..9d940e65f023 100644 --- a/processing/src/test/java/org/apache/druid/guice/PolyBindTest.java +++ b/processing/src/test/java/org/apache/druid/guice/PolyBindTest.java @@ -112,7 +112,7 @@ public void configure(Binder binder) } catch (Exception e) { Assert.assertTrue(e instanceof ProvisionException); - Assert.assertTrue(e.getMessage().contains("Unknown provider [c] of Key[type=org.apache.druid.guice.PolyBindTest$Gogo")); + Assert.assertTrue(e.getMessage().contains("Unknown provider [c] of Key[type=PolyBindTest$Gogo")); } try { Assert.assertEquals("B", injector.getInstance(Key.get(Gogo.class, Names.named("reverse"))).go()); @@ -120,7 +120,7 @@ public void configure(Binder binder) } catch (Exception e) { Assert.assertTrue(e instanceof ProvisionException); - Assert.assertTrue(e.getMessage().contains("Unknown provider [c] of Key[type=org.apache.druid.guice.PolyBindTest$Gogo")); + Assert.assertTrue(e.getMessage().contains("Unknown provider [c] of Key[type=PolyBindTest$Gogo")); } // test default property value @@ -136,7 +136,7 @@ public void configure(Binder binder) } catch (Exception e) { Assert.assertTrue(e instanceof ProvisionException); - Assert.assertTrue(e.getMessage().contains("Unknown provider [c] of Key[type=org.apache.druid.guice.PolyBindTest$GogoSally")); + Assert.assertTrue(e.getMessage().contains("Unknown provider [c] of Key[type=PolyBindTest$GogoSally")); } } diff --git a/processing/src/test/java/org/apache/druid/query/DruidProcessingConfigTest.java b/processing/src/test/java/org/apache/druid/query/DruidProcessingConfigTest.java index e19fbf755402..61b43d24d190 100644 --- a/processing/src/test/java/org/apache/druid/query/DruidProcessingConfigTest.java +++ b/processing/src/test/java/org/apache/druid/query/DruidProcessingConfigTest.java @@ -139,7 +139,7 @@ public void testInvalidSizeBytes() ); Assert.assertTrue( t.getMessage() - .contains("Cannot construct instance of `org.apache.druid.java.util.common.HumanReadableBytes`, problem: Invalid format of number: -1. Negative value is not allowed.") + .contains("Cannot construct instance of `HumanReadableBytes`, problem: Invalid format of number: -1. Negative value is not allowed.") ); } diff --git a/quidem-ut/pom.xml b/quidem-ut/pom.xml index dd88d7fc84fa..6912ec4f2f4e 100644 --- a/quidem-ut/pom.xml +++ b/quidem-ut/pom.xml @@ -262,10 +262,6 @@ com.google.inject guice - - com.google.inject.extensions - guice-multibindings - com.fasterxml.jackson.core jackson-databind diff --git a/server/pom.xml b/server/pom.xml index 45ca282f836f..3a411ce703b1 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -107,11 +107,7 @@ com.sun.jersey jersey-core - - com.google.inject.extensions - guice-multibindings - provided - + com.google.inject.extensions guice-servlet diff --git a/server/src/test/java/org/apache/druid/server/QuerySchedulerTest.java b/server/src/test/java/org/apache/druid/server/QuerySchedulerTest.java index b670cd4dd787..f9e404efc98d 100644 --- a/server/src/test/java/org/apache/druid/server/QuerySchedulerTest.java +++ b/server/src/test/java/org/apache/druid/server/QuerySchedulerTest.java @@ -68,10 +68,13 @@ import org.apache.druid.server.scheduling.ManualQueryPrioritizationStrategy; import org.apache.druid.server.scheduling.NoQueryLaningStrategy; import org.easymock.EasyMock; +import org.hamcrest.CoreMatchers; +import org.hamcrest.MatcherAssert; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.junit.internal.matchers.ThrowableMessageMatcher; import java.io.IOException; import java.util.ArrayList; @@ -493,14 +496,18 @@ public void testMisConfigHiLo() properties.setProperty(propertyPrefix + ".laning.strategy", "hilo"); provider.inject(properties, injector.getInstance(JsonConfigurator.class)); Throwable t = Assert.assertThrows(ProvisionException.class, () -> provider.get().get()); - Assert.assertEquals( - "Unable to provision, see the following errors:\n" - + "\n" - + "1) Problem parsing object at prefix[druid.query.scheduler]: Cannot construct instance of `org.apache.druid.server.scheduling.HiLoQueryLaningStrategy`, problem: maxLowPercent must be set\n" - + " at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: org.apache.druid.server.QuerySchedulerProvider[\"laning\"]).\n" - + "\n" - + "1 error", - t.getMessage() + MatcherAssert.assertThat( + t, + ThrowableMessageMatcher.hasMessage( + CoreMatchers.startsWith( + "Unable to provision, see the following errors:\n" + + "\n" + + "1) Problem parsing object at prefix[druid.query.scheduler]: Cannot construct instance of `HiLoQueryLaningStrategy`, problem: maxLowPercent must be set\n" + + " at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: QuerySchedulerProvider[\"laning\"]).\n" + + "\n" + + "1 error" + ) + ) ); } @@ -550,14 +557,18 @@ public void testMisConfigThreshold() properties.setProperty(propertyPrefix + ".prioritization.strategy", "threshold"); provider.inject(properties, injector.getInstance(JsonConfigurator.class)); Throwable t = Assert.assertThrows(ProvisionException.class, () -> provider.get().get()); - Assert.assertEquals( - "Unable to provision, see the following errors:\n" - + "\n" - + "1) Problem parsing object at prefix[druid.query.scheduler]: Cannot construct instance of `org.apache.druid.server.scheduling.ThresholdBasedQueryPrioritizationStrategy`, problem: periodThreshold, durationThreshold, segmentCountThreshold or segmentRangeThreshold must be set\n" - + " at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: org.apache.druid.server.QuerySchedulerProvider[\"prioritization\"]).\n" - + "\n" - + "1 error", - t.getMessage() + MatcherAssert.assertThat( + t, + ThrowableMessageMatcher.hasMessage( + CoreMatchers.startsWith( + "Unable to provision, see the following errors:\n" + + "\n" + + "1) Problem parsing object at prefix[druid.query.scheduler]: Cannot construct instance of `ThresholdBasedQueryPrioritizationStrategy`, problem: periodThreshold, durationThreshold, segmentCountThreshold or segmentRangeThreshold must be set\n" + + " at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: QuerySchedulerProvider[\"prioritization\"]).\n" + + "\n" + + "1 error" + ) + ) ); } diff --git a/services/pom.xml b/services/pom.xml index 7b681a1e7e17..5f46dd40f6d2 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -157,11 +157,7 @@ com.sun.jersey jersey-server - - com.google.inject.extensions - guice-multibindings - provided - + org.roaringbitmap RoaringBitmap diff --git a/sql/pom.xml b/sql/pom.xml index 1c68ad0c0ed5..32d3131588db 100644 --- a/sql/pom.xml +++ b/sql/pom.xml @@ -128,11 +128,7 @@ com.opencsv opencsv - - com.google.inject.extensions - guice-multibindings - provided - + javax.ws.rs jsr311-api From 1e7a654829ceb36ad627173e685f556ac6c3084a Mon Sep 17 00:00:00 2001 From: Akshat Jain Date: Tue, 17 Dec 2024 11:05:40 +0530 Subject: [PATCH 4/5] Upgrade Guice to 5.1.0 in licenses.yaml --- licenses.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/licenses.yaml b/licenses.yaml index 8044beb12bab..7f4412cef7aa 100644 --- a/licenses.yaml +++ b/licenses.yaml @@ -371,7 +371,7 @@ name: Guice license_category: binary module: java-core license_name: Apache License version 2.0 -version: 4.2.2 +version: 5.1.0 libraries: - com.google.inject: guice - com.google.inject.extensions: guice-multibindings From a211440828f43482ea4ea305deccfd11314fadc9 Mon Sep 17 00:00:00 2001 From: Akshat Jain Date: Tue, 17 Dec 2024 11:47:30 +0530 Subject: [PATCH 5/5] Fix StorageNodeModuleTest: Sealed abstract enums can't be mocked --- .../test/java/org/apache/druid/guice/StorageNodeModuleTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/src/test/java/org/apache/druid/guice/StorageNodeModuleTest.java b/server/src/test/java/org/apache/druid/guice/StorageNodeModuleTest.java index 082361a1c885..d42fd72faca0 100644 --- a/server/src/test/java/org/apache/druid/guice/StorageNodeModuleTest.java +++ b/server/src/test/java/org/apache/druid/guice/StorageNodeModuleTest.java @@ -76,6 +76,8 @@ public void setUp() target = new StorageNodeModule(); injector = makeInjector(INJECT_SERVER_TYPE_CONFIG); + + Mockito.doReturn(ServerType.BROKER).when(serverTypeConfig).getServerType(); } @Test