This is an automated email from the ASF dual-hosted git repository.
snazy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git
The following commit(s) were added to refs/heads/main by this push:
new 087209314 Quarkus 3.31 (#3614)
087209314 is described below
commit 087209314acb4abb10f3ca3fe178abac38eebb3f
Author: Robert Stupp <[email protected]>
AuthorDate: Tue Feb 10 16:55:10 2026 +0100
Quarkus 3.31 (#3614)
Major changes:
* Adapt MongoDbBackendBuilder to Quarkus 3.31
* Migrate Quarkus HTTP/managment port retrieval
The Mongo-DB changes are necessary to account for the new way to define
(multiple) Mongo drivers and that have an `active` flag. The internal-ish Mongo
related classes in the Quarkus extension have changed. The added config-source
makes the whole change transparent to users.
---
gradle/libs.versions.toml | 2 +-
.../backend/MongoDBConfigSourceFactory.java | 92 ++++++++++++++++++++++
.../quarkus/backend/MongoDbBackendBuilder.java | 10 +--
.../io.smallrye.config.ConfigSourceFactory | 20 +++++
.../test/DefaultTestEnvironmentResolver.java | 10 ++-
.../service/tracing/RequestIdHeaderTest.java | 16 ++--
.../apache/polaris/service/it/ServerManager.java | 9 +--
7 files changed, 135 insertions(+), 24 deletions(-)
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index c8d0fd212..5631aa13c 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -24,7 +24,7 @@ iceberg = "1.10.1" # Ensure to update the iceberg version in
regtests to keep re
immutables = "2.12.1"
jmh = "1.37"
picocli = "4.7.7"
-quarkus = "3.30.8"
+quarkus = "3.31.2"
scala212 = "2.12.19"
swagger = "1.6.16"
diff --git
a/persistence/nosql/persistence/cdi/quarkus/src/main/java/org/apache/polaris/persistence/nosql/quarkus/backend/MongoDBConfigSourceFactory.java
b/persistence/nosql/persistence/cdi/quarkus/src/main/java/org/apache/polaris/persistence/nosql/quarkus/backend/MongoDBConfigSourceFactory.java
new file mode 100644
index 000000000..ebc143afb
--- /dev/null
+++
b/persistence/nosql/persistence/cdi/quarkus/src/main/java/org/apache/polaris/persistence/nosql/quarkus/backend/MongoDBConfigSourceFactory.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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 org.apache.polaris.persistence.nosql.quarkus.backend;
+
+import io.smallrye.config.ConfigSourceContext;
+import io.smallrye.config.ConfigSourceFactory;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.polaris.persistence.nosql.mongodb.MongoDbBackendFactory;
+import org.eclipse.microprofile.config.spi.ConfigSource;
+
+/**
+ * This config source factory is used to activate the Quarkus-MongoDB driver
when the MongoDB NoSQL
+ * database backend is used, and otherwise disable the Quarkus-MongoDB driver.
+ *
+ * <p>The Quarkus configuration {@code quarkus.mongodb.active}, defaults to
{@code true}, got added
+ * via Quarkus 3.31.0.
+ *
+ * <p>Having a Quarkus-Mongo driver active means that it will be considered
during the readiness and
+ * health checks. In other words, the default of {@code true} <em>breaks</em>
non-MongoDB version
+ * store types.
+ */
+public class MongoDBConfigSourceFactory implements ConfigSourceFactory {
+ @Override
+ public Iterable<ConfigSource> getConfigSources(ConfigSourceContext context) {
+ return List.of(
+ new ConfigSource() {
+ static final String ACTIVE_PROPERTY = "quarkus.mongodb.active";
+ static final Set<String> PROPERTY_NAMES = Set.of(ACTIVE_PROPERTY);
+
+ private String activeValue() {
+ var persistenceType = context.getValue("polaris.persistence.type");
+ if (persistenceType == null ||
!"nosql".equalsIgnoreCase(persistenceType.getValue())) {
+ return "false";
+ }
+
+ var backendType =
context.getValue("polaris.persistence.nosql.backend");
+ return backendType != null
+ &&
MongoDbBackendFactory.NAME.equalsIgnoreCase(backendType.getValue())
+ ? "true"
+ : "false";
+ }
+
+ @Override
+ public Map<String, String> getProperties() {
+ return Map.of(ACTIVE_PROPERTY, activeValue());
+ }
+
+ @Override
+ public int getOrdinal() {
+ // allows overriding the value in config files, system properties
and environment
+ // variables
+ return 150;
+ }
+
+ @Override
+ public Set<String> getPropertyNames() {
+ return PROPERTY_NAMES;
+ }
+
+ @Override
+ public String getValue(String propertyName) {
+ if (ACTIVE_PROPERTY.equals(propertyName)) {
+ return activeValue();
+ }
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ return "MongoDB-active config provider";
+ }
+ });
+ }
+}
diff --git
a/persistence/nosql/persistence/cdi/quarkus/src/main/java/org/apache/polaris/persistence/nosql/quarkus/backend/MongoDbBackendBuilder.java
b/persistence/nosql/persistence/cdi/quarkus/src/main/java/org/apache/polaris/persistence/nosql/quarkus/backend/MongoDbBackendBuilder.java
index 9a3b7615b..b037466a1 100644
---
a/persistence/nosql/persistence/cdi/quarkus/src/main/java/org/apache/polaris/persistence/nosql/quarkus/backend/MongoDbBackendBuilder.java
+++
b/persistence/nosql/persistence/cdi/quarkus/src/main/java/org/apache/polaris/persistence/nosql/quarkus/backend/MongoDbBackendBuilder.java
@@ -19,10 +19,8 @@
package org.apache.polaris.persistence.nosql.quarkus.backend;
import com.mongodb.client.MongoClient;
-import io.quarkus.arc.Arc;
-import io.quarkus.mongodb.runtime.MongoClientBeanUtil;
-import io.quarkus.mongodb.runtime.MongoClients;
import jakarta.enterprise.context.Dependent;
+import jakarta.enterprise.inject.Instance;
import jakarta.inject.Inject;
import org.apache.polaris.persistence.nosql.api.backend.Backend;
import org.apache.polaris.persistence.nosql.mongodb.MongoDbBackendConfig;
@@ -36,11 +34,11 @@ class MongoDbBackendBuilder implements BackendBuilder {
@ConfigProperty(name = "quarkus.mongodb.database", defaultValue = "polaris")
String databaseName;
+ @Inject Instance<MongoClient> mongoClientInstance;
+
@Override
public Backend buildBackend() {
- MongoClients mongoClients =
Arc.container().instance(MongoClients.class).get();
- MongoClient client =
-
mongoClients.createMongoClient(MongoClientBeanUtil.DEFAULT_MONGOCLIENT_NAME);
+ MongoClient client = mongoClientInstance.get();
var config = new MongoDbBackendConfig(databaseName, client, true, false);
diff --git
a/persistence/nosql/persistence/cdi/quarkus/src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceFactory
b/persistence/nosql/persistence/cdi/quarkus/src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceFactory
new file mode 100644
index 000000000..b91c2d5e9
--- /dev/null
+++
b/persistence/nosql/persistence/cdi/quarkus/src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceFactory
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF 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.
+#
+
+org.apache.polaris.persistence.nosql.quarkus.backend.MongoDBConfigSourceFactory
diff --git
a/runtime/service/src/test/java/org/apache/polaris/service/test/DefaultTestEnvironmentResolver.java
b/runtime/service/src/test/java/org/apache/polaris/service/test/DefaultTestEnvironmentResolver.java
index 50ddb250d..fc9686a9d 100644
---
a/runtime/service/src/test/java/org/apache/polaris/service/test/DefaultTestEnvironmentResolver.java
+++
b/runtime/service/src/test/java/org/apache/polaris/service/test/DefaultTestEnvironmentResolver.java
@@ -18,16 +18,20 @@
*/
package org.apache.polaris.service.test;
+import org.eclipse.microprofile.config.ConfigProvider;
import org.junit.jupiter.api.extension.ExtensionContext;
public class DefaultTestEnvironmentResolver implements TestEnvironmentResolver
{
- private final int localPort = Integer.getInteger("quarkus.http.port");
- private final int localManagementPort =
Integer.getInteger("quarkus.management.port");
-
/** Resolves the TestEnvironment to point to the local Quarkus Application
instance. */
@Override
public TestEnvironment resolveTestEnvironment(ExtensionContext
extensionContext) {
+ var quarkusManagementPort =
+ ConfigProvider.getConfig().getConfigValue("quarkus.management.port");
+ var localManagementPort =
Integer.parseInt(quarkusManagementPort.getValue());
+ var quarkusHttpPort =
ConfigProvider.getConfig().getConfigValue("quarkus.http.port");
+ var localPort = Integer.parseInt(quarkusHttpPort.getValue());
+
return new TestEnvironment(
String.format("http://localhost:%d/", localPort),
String.format("http://localhost:%d/", localManagementPort));
diff --git
a/runtime/service/src/test/java/org/apache/polaris/service/tracing/RequestIdHeaderTest.java
b/runtime/service/src/test/java/org/apache/polaris/service/tracing/RequestIdHeaderTest.java
index 8a653476d..6ab969216 100644
---
a/runtime/service/src/test/java/org/apache/polaris/service/tracing/RequestIdHeaderTest.java
+++
b/runtime/service/src/test/java/org/apache/polaris/service/tracing/RequestIdHeaderTest.java
@@ -23,13 +23,13 @@ import static org.assertj.core.api.Assertions.assertThat;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.QuarkusTestProfile;
import io.quarkus.test.junit.TestProfile;
+import io.quarkus.vertx.http.HttpServer;
+import jakarta.inject.Inject;
import jakarta.ws.rs.client.Entity;
import jakarta.ws.rs.core.MultivaluedHashMap;
import jakarta.ws.rs.core.Response;
-import java.net.URI;
import java.util.HashSet;
import java.util.Map;
-import java.util.Objects;
import java.util.Set;
import org.apache.polaris.service.it.env.PolarisApiEndpoints;
import org.apache.polaris.service.it.env.PolarisClient;
@@ -57,16 +57,14 @@ public class RequestIdHeaderTest {
private static final String CLIENT_ID = "client1";
private static final String CLIENT_SECRET = "secret1";
- private static final URI baseUri =
- URI.create(
- "http://localhost:"
- + Objects.requireNonNull(
- Integer.getInteger("quarkus.http.test-port"),
- "System property not set correctly:
quarkus.http.test-port"));
+ @SuppressWarnings("CdiInjectionPointsInspection")
+ @Inject
+ HttpServer httpServer;
private Response request(Map<String, String> headers) {
try (PolarisClient client =
- PolarisClient.polarisClient(new PolarisApiEndpoints(baseUri, REALM,
headers))) {
+ PolarisClient.polarisClient(
+ new PolarisApiEndpoints(httpServer.getLocalBaseUri(), REALM,
headers))) {
return client
.catalogApiPlain()
.request("v1/oauth/tokens")
diff --git
a/runtime/service/src/testFixtures/java/org/apache/polaris/service/it/ServerManager.java
b/runtime/service/src/testFixtures/java/org/apache/polaris/service/it/ServerManager.java
index dc3ccc8f6..ca8af7719 100644
---
a/runtime/service/src/testFixtures/java/org/apache/polaris/service/it/ServerManager.java
+++
b/runtime/service/src/testFixtures/java/org/apache/polaris/service/it/ServerManager.java
@@ -19,11 +19,11 @@
package org.apache.polaris.service.it;
import java.net.URI;
-import java.util.Objects;
import org.apache.polaris.service.it.env.ClientCredentials;
import org.apache.polaris.service.it.env.ClientPrincipal;
import org.apache.polaris.service.it.env.Server;
import org.apache.polaris.service.it.ext.PolarisServerManager;
+import org.eclipse.microprofile.config.ConfigProvider;
import org.junit.jupiter.api.extension.ExtensionContext;
public class ServerManager implements PolarisServerManager {
@@ -51,9 +51,8 @@ public class ServerManager implements PolarisServerManager {
};
}
- private static Integer getQuarkusTestPort() {
- return Objects.requireNonNull(
- Integer.getInteger("quarkus.http.test-port"),
- "System property not set correctly: quarkus.http.test-port");
+ private static int getQuarkusTestPort() {
+ var quarkusHttpPort =
ConfigProvider.getConfig().getConfigValue("quarkus.http.port");
+ return Integer.parseInt(quarkusHttpPort.getValue());
}
}