Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Quarkus-based Polaris service runtime #469

Draft
wants to merge 111 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
595601f
Bootstrap polaris-core-quarkus and polaris-service-quarkus
jbonofre Oct 24, 2024
141ff61
./gradlew clean :polaris-service-quarkus:quarkusBuild spotlessApply
adutra Oct 25, 2024
cfa77ec
migrate polaris-server.yml to application.properties
adutra Oct 25, 2024
90dda9a
more config
adutra Oct 25, 2024
d3a0844
more config
adutra Oct 26, 2024
83e103c
forgot to commit those
adutra Oct 26, 2024
8fdcf60
adding some comments
adutra Oct 26, 2024
ca6bc04
application starts
adutra Oct 27, 2024
89d685f
make DefaultConfigurationStore work
adutra Oct 28, 2024
44e639e
remove spurious stuff
adutra Oct 28, 2024
8a17857
rate limiter
adutra Oct 28, 2024
404fd80
inject call context
adutra Oct 28, 2024
33fb5a3
nits
adutra Oct 28, 2024
e88cf23
fix IcebergJerseyViolationExceptionMapper
adutra Oct 28, 2024
893710e
fix RateLimiterFilter
adutra Oct 28, 2024
caf131f
remove servlet api
adutra Oct 28, 2024
1619819
fix logging... for now
adutra Oct 28, 2024
c43e0f4
first test
adutra Oct 28, 2024
bdd3c38
make test a quarkus test
adutra Oct 28, 2024
5dded9f
purge realm after test
adutra Oct 28, 2024
920d12f
Make rat happy
jbonofre Oct 28, 2024
6c18997
view tests
adutra Oct 28, 2024
dcca472
more tests
adutra Oct 28, 2024
26d00e2
nit
adutra Oct 28, 2024
91974f8
diag services
adutra Oct 28, 2024
54d1682
fix test
adutra Oct 28, 2024
ddb428d
first integration test
adutra Oct 28, 2024
cd1d751
Update README.md
jbonofre Oct 28, 2024
b5b6c75
add TODO for CallContext
adutra Oct 28, 2024
69e13f0
nit: lowecase docker ima
dimas-b Oct 28, 2024
d85e8d2
nit: add North Star to banner :)
dimas-b Oct 28, 2024
32ad7a3
Actually log in memory creds (for bootstrapping local env.)
dimas-b Oct 28, 2024
af05021
Use micrometer @Timed
jbonofre Oct 29, 2024
39ce4ff
fix wrong copy-paste
adutra Oct 29, 2024
e9bb14c
Rename PolarisQuarkusConfig as PolarisQuarkusInfrastructure (as it's …
jbonofre Oct 29, 2024
eec2993
Use Optional for configuration properties
jbonofre Oct 29, 2024
9704a81
select beans at runtime
adutra Oct 29, 2024
06036f4
remove some CallContext.getCurrentContext()
adutra Oct 29, 2024
fbb6b59
use @Decorator
adutra Oct 29, 2024
3e27ec0
update todo
adutra Oct 29, 2024
06f45aa
nits
adutra Oct 29, 2024
d6d77c6
Remove unused polaris-core-quarkus for now
jbonofre Oct 29, 2024
08418ac
Revert LOG of creds in InMemoryPolarisMetaStoreManagerFactory
dimas-b Oct 29, 2024
c005ecc
oauth (wip)
adutra Oct 29, 2024
6004287
more oauth (still wip)
adutra Oct 29, 2024
cb178f3
Add Dockerfile in polaris-service-quarkus
jbonofre Oct 29, 2024
5be3ba2
more oauth (still wip)
adutra Oct 29, 2024
40f7c0f
Enable Spark SQL with S3
dimas-b Oct 29, 2024
36fc534
cleanup
adutra Oct 30, 2024
0576e9d
fix mock declaration
adutra Oct 30, 2024
6995619
cleanup
adutra Oct 30, 2024
af7dfaf
spotless
adutra Oct 30, 2024
40d9e0e
fix CL issues in tests
adutra Oct 30, 2024
0cf9714
make integration test pass
adutra Oct 31, 2024
1efd88e
port more integration tests
adutra Oct 31, 2024
3ab6443
port auth tests
adutra Oct 31, 2024
60e61d6
port admin tests
adutra Oct 31, 2024
30f2aab
port overlapping table tests
adutra Oct 31, 2024
51d3332
port rate limiter integration test
adutra Oct 31, 2024
26d1db5
port PolarisSparkIntegrationTest
adutra Oct 31, 2024
718d068
Rebase polaris-service-quarkus
jbonofre Nov 5, 2024
782b0cb
Add AWS_REGION environment variable in the test task
jbonofre Nov 5, 2024
1c7aeed
Fix integration tests (indexing polaris-core)
jbonofre Nov 6, 2024
80642de
Implement eclipselink extension with Quarkus
jbonofre Nov 5, 2024
9ad75b4
Add config property to load eclipselink store manager factory
jbonofre Nov 5, 2024
a70a438
Fix build and tests on eclipselink-quarkus
jbonofre Nov 7, 2024
46cddb7
Workaround for https://github.com/quarkusio/quarkus/issues/44367
jbonofre Nov 7, 2024
3682d31
Fix eclipse-link property
jbonofre Nov 7, 2024
d3a637b
REbase
jbonofre Nov 14, 2024
c2ad91e
Update
jbonofre Nov 15, 2024
4904f31
Fix test compile issues
jbonofre Nov 20, 2024
5f0f7b0
New rebase
jbonofre Nov 21, 2024
3dd30a3
Update after rebase
jbonofre Nov 21, 2024
b1a5262
fix more tests
adutra Nov 21, 2024
b1c0335
fix last tests
adutra Nov 22, 2024
79c76e8
class is not a managed bean
adutra Nov 22, 2024
6365250
merge polaris-service-quarkus with polaris-service
adutra Nov 22, 2024
3d765d8
fix FileIOIntegrationTest
adutra Nov 23, 2024
bd6620a
fix PolarisRestCatalogViewIntegrationTest
adutra Nov 23, 2024
e5a0423
fix DefaultConfigurationStoreTest
adutra Nov 23, 2024
5714953
disable testMetricsAreEmittedWhenRateLimiting for now
adutra Nov 23, 2024
574496a
Wire up Micrometer and fix RateLimiterFilterTest
adutra Nov 25, 2024
fe2226e
fix testRequestBodyTooLarge
adutra Nov 25, 2024
e9a94c8
properly close call context
adutra Nov 25, 2024
49c255d
simplify config
adutra Nov 25, 2024
7c1aa27
debug testRequestBodyTooLarge
adutra Nov 25, 2024
5ab9eb0
wire up logging and MDC
adutra Nov 25, 2024
986c400
wire up docker and regtests (wip)
adutra Nov 25, 2024
a84ed3d
more debug tests
adutra Nov 25, 2024
b10c3af
Minor cleanups (#2)
snazy Nov 26, 2024
50a9b9a
ninja fix
snazy Nov 26, 2024
e53a51e
fix fix
snazy Nov 26, 2024
9ab6c80
fix fix fix
snazy Nov 26, 2024
7b519ed
fix PolarisIntegrationTestHelper
adutra Nov 26, 2024
a4162f2
fix Dockerfile
adutra Nov 26, 2024
02f61f4
disable OTel for now
adutra Nov 26, 2024
6c7bef6
more debugging
adutra Nov 26, 2024
1ff71fa
spotless
adutra Nov 26, 2024
07bd742
fix regtest docker-compose.yml
adutra Nov 26, 2024
abd7d33
attempt to fix gradle execution error
adutra Nov 26, 2024
e909352
fix gradle execution error
adutra Nov 26, 2024
174a96a
use mocks for TaskExecutor
adutra Nov 26, 2024
dcf9dda
improvements to container image builds
adutra Nov 26, 2024
527b159
enforcedPlatform for Quarkus BOM in eclipse-link module
adutra Nov 26, 2024
7a8c7e8
nits
adutra Nov 26, 2024
8dd2283
deep copy CallContext
adutra Nov 27, 2024
c1e0428
Propagate context to TaskExecutorImpl
adutra Nov 27, 2024
3bee125
better rate limiter config
adutra Nov 27, 2024
98ff14a
MDC fix
adutra Nov 27, 2024
ed787dd
ConfigSourceInterceptor
adutra Nov 27, 2024
c8b915f
initial otel implementation
adutra Nov 27, 2024
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
38 changes: 29 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,36 @@ WORKDIR /app
RUN rm -rf build

# Build the rest catalog
RUN ./gradlew --no-daemon --info ${ECLIPSELINK_DEPS+"-PeclipseLinkDeps=$ECLIPSELINK_DEPS"} -PeclipseLink=$ECLIPSELINK clean prepareDockerDist
RUN ./gradlew --no-daemon --info ${ECLIPSELINK_DEPS+"-PeclipseLinkDeps=$ECLIPSELINK_DEPS"} -PeclipseLink=$ECLIPSELINK clean :polaris-service:build -x test

FROM registry.access.redhat.com/ubi9/openjdk-21-runtime:1.20-2.1729089285
WORKDIR /app
COPY --from=build /app/polaris-service/build/docker-dist/bin /app/bin
COPY --from=build /app/polaris-service/build/docker-dist/lib /app/lib
COPY --from=build /app/polaris-server.yml /app
FROM registry.access.redhat.com/ubi9/openjdk-21:1.20-2.1726695192

LABEL org.opencontainers.image.source=https://github.com/apache/polaris
LABEL org.opencontainers.image.description="Apache Polaris"
LABEL org.opencontainers.image.licenses=Apache-2.0

ENV LANGUAGE='en_US:en'

USER root
RUN groupadd --gid 10001 polaris \
&& useradd --uid 10000 --gid polaris polaris \
&& chown -R polaris:polaris /opt/jboss/container \
&& chown -R polaris:polaris /deployments

USER polaris
WORKDIR /home/polaris
ENV USER=polaris
ENV UID=10000
ENV HOME=/home/polaris

# We make four distinct layers so if there are application changes the library layers can be re-used
COPY --from=build --chown=polaris:polaris /app/polaris-service/build/quarkus-app/lib/ /deployments/lib/
COPY --from=build --chown=polaris:polaris /app/polaris-service/build/quarkus-app/*.jar /deployments/
COPY --from=build --chown=polaris:polaris /app/polaris-service/build/quarkus-app/app/ /deployments/app/
COPY --from=build --chown=polaris:polaris /app/polaris-service/build/quarkus-app/quarkus/ /deployments/quarkus/

EXPOSE 8181
EXPOSE 8182

# Run the resulting java binary
ENTRYPOINT ["/app/bin/polaris-service"]
CMD ["server", "polaris-server.yml"]
ENV AB_JOLOKIA_OFF=""
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ tasks.named<RatTask>("rat").configure {
excludes.add("gradle/wrapper/gradle-wrapper*.jar*")

excludes.add("logs/**")
excludes.add("polaris-service/src/**/banner.txt")
excludes.add("polaris-service/src/**/polaris-banner.txt")
excludes.add("polaris-service/logs")

excludes.add("site/node_modules/**")
Expand Down
6 changes: 4 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ services:
- "8182"
environment:
AWS_REGION: us-west-2
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
GOOGLE_APPLICATION_CREDENTIALS: $GOOGLE_APPLICATION_CREDENTIALS
AZURE_TENANT_ID: $AZURE_TENANT_ID
AZURE_CLIENT_ID: $AZURE_CLIENT_ID
AZURE_CLIENT_SECRET: $AZURE_CLIENT_SECRET
# add aws keys as dropwizard config
JAVA_OPTS: -Ddw.awsAccessKey=$AWS_ACCESS_KEY_ID -Ddw.awsSecretKey=$AWS_SECRET_ACCESS_KEY
POLARIS_AUTHENTICATION_TYPE: test
POLARIS_AUTHENTICATION_OAUTH2_SERVICE_TYPE: test
volumes:
- ./regtests/credentials:/tmp/credentials/

Expand Down
21 changes: 16 additions & 5 deletions extension/persistence/eclipselink/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ fun isValidDep(dep: String): Boolean {
}

plugins {
alias(libs.plugins.quarkus)
id("polaris-server")
`java-library`
}

dependencies {
implementation(project(":polaris-core"))
implementation(libs.eclipselink)
implementation(platform(libs.dropwizard.bom))
implementation("io.dropwizard:dropwizard-jackson")
implementation(enforcedPlatform(libs.quarkus.bom))

val eclipseLinkDeps: String? = project.findProperty("eclipseLinkDeps") as String?
eclipseLinkDeps?.let {
val dependenciesList = it.split(",")
Expand All @@ -46,14 +47,20 @@ dependencies {
}

compileOnly(libs.jetbrains.annotations)
compileOnly(libs.jakarta.enterprise.cdi.api)
compileOnly(libs.jakarta.inject.api)
compileOnly("io.quarkus:quarkus-arc")
compileOnly("org.eclipse.microprofile.config:microprofile-config-api")
compileOnly(platform(libs.jackson.bom))
compileOnly("com.fasterxml.jackson.core:jackson-annotations")
compileOnly("com.fasterxml.jackson.core:jackson-core")

testImplementation(libs.h2)
testImplementation(testFixtures(project(":polaris-core")))

testImplementation(platform(libs.junit.bom))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation(libs.assertj.core)
testImplementation(libs.mockito.core)
testImplementation(libs.bundles.junit.testing)
testRuntimeOnly("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}

Expand All @@ -65,3 +72,7 @@ tasks.register<Jar>("archiveConf") {
}

tasks.named("test") { dependsOn("archiveConf") }

tasks.named("compileJava") { dependsOn("compileQuarkusGeneratedSourcesJava") }

tasks.named("sourcesJar") { dependsOn("compileQuarkusGeneratedSourcesJava") }
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,37 @@
*/
package org.apache.polaris.extension.persistence.impl.eclipselink;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import io.quarkus.arc.lookup.LookupIfProperty;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import org.apache.polaris.core.PolarisDiagnostics;
import org.apache.polaris.core.config.RuntimeCandidate;
import org.apache.polaris.core.context.RealmContext;
import org.apache.polaris.core.persistence.LocalPolarisMetaStoreManagerFactory;
import org.apache.polaris.core.persistence.PolarisMetaStoreManager;
import org.apache.polaris.core.persistence.PolarisMetaStoreSession;
import org.apache.polaris.core.storage.PolarisStorageIntegrationProvider;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.jetbrains.annotations.NotNull;

/**
* The implementation of Configuration interface for configuring the {@link PolarisMetaStoreManager}
* using an EclipseLink based meta store to store and retrieve all Polaris metadata. It can be
* configured through persistence.xml to use supported RDBMS as the meta store.
*/
@JsonTypeName("eclipse-link")
@ApplicationScoped
@RuntimeCandidate
@LookupIfProperty(name = "polaris.persistence.metastore-manager.type", stringValue = "eclipse-link")
public class EclipseLinkPolarisMetaStoreManagerFactory
extends LocalPolarisMetaStoreManagerFactory<PolarisEclipseLinkStore> {
@JsonProperty("conf-file")
private String confFile;

@JsonProperty("persistence-unit")
private String persistenceUnitName;
@ConfigProperty(name = "polaris.eclipselink.conf-file")
String confFile;

@ConfigProperty(name = "polaris.eclipselink.persistence-unit", defaultValue = "polaris")
String persistenceUnitName;

@Inject PolarisStorageIntegrationProvider storageIntegration;

@Override
protected PolarisEclipseLinkStore createBackingStore(@NotNull PolarisDiagnostics diagnostics) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import static org.eclipse.persistence.config.PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML;
import static org.eclipse.persistence.config.PersistenceUnitProperties.JDBC_URL;

import com.google.common.base.Predicates;
import jakarta.persistence.EntityManager;
import jakarta.persistence.EntityManagerFactory;
import jakarta.persistence.EntityTransaction;
Expand Down Expand Up @@ -523,7 +522,7 @@ public List<PolarisEntityActiveRecord> lookupEntityActiveBatch(
long catalogId,
long parentId,
@NotNull PolarisEntityType entityType) {
return listActiveEntities(callCtx, catalogId, parentId, entityType, Predicates.alwaysTrue());
return listActiveEntities(callCtx, catalogId, parentId, entityType, x -> true);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ org.gradle.configureondemand=true
org.gradle.configuration-cache=false
#org.gradle.configuration-cache-problems=warn
# bump the Gradle daemon heap size (you can set bigger heap sizes as well)
org.gradle.jvmargs=-Xms2g -Xmx4g -XX:MaxMetaspaceSize=768m
org.gradle.jvmargs=-Xms2g -Xmx4g -XX:MaxMetaspaceSize=768m
21 changes: 17 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
[versions]
hadoop = "3.4.0"
iceberg = "1.6.1"
dropwizard = "4.0.8"
junit = "5.10.3"
quarkus = "3.16.4"
slf4j = "2.0.13"
swagger = "1.6.14"

[bundles]
junit-testing = ["assertj-core", "mockito-core", "mockito-junit-jupiter", "junit-jupiter-api", "junit-jupiter-params", "junit-platform-reporting"]


[libraries]
Expand All @@ -40,30 +42,40 @@ bouncycastle-bcprov = { module = "org.bouncycastle:bcprov-jdk18on", version = "1
caffeine = { module = "com.github.ben-manes.caffeine:caffeine", version = "3.1.8" }
commons-codec1 = { module = "commons-codec:commons-codec", version = "1.17.1" }
commons-lang3 = { module = "org.apache.commons:commons-lang3", version = "3.17.0" }
dropwizard-bom = { module = "io.dropwizard:dropwizard-bom", version.ref = "dropwizard" }
eclipselink = { module = "org.eclipse.persistence:eclipselink", version = "4.0.4" }
errorprone = { module = "com.google.errorprone:error_prone_core", version = "2.29.2" }
google-cloud-storage-bom = { module = "com.google.cloud:google-cloud-storage-bom", version = "2.42.0" }
guava = { module = "com.google.guava:guava", version = "33.3.0-jre" }
h2 = { module = "com.h2database:h2", version = "2.3.232" }
hadoop-client-api = { module = "org.apache.hadoop:hadoop-client-api", version.ref = "hadoop" }
hadoop-client-runtime = { module = "org.apache.hadoop:hadoop-client-runtime", version.ref = "hadoop" }
hadoop-common = { module = "org.apache.hadoop:hadoop-common", version.ref = "hadoop" }
hadoop-hdfs-client = { module = "org.apache.hadoop:hadoop-hdfs-client", version.ref = "hadoop" }
iceberg-bom = { module = "org.apache.iceberg:iceberg-bom", version.ref = "iceberg" }
jackson-bom = { module = "com.fasterxml.jackson:jackson-bom", version = "2.17.2" }
jakarta-annotation-api = { module = "jakarta.annotation:jakarta.annotation-api", version = "3.0.0" }
jakarta-validation-api = { module = "jakarta.validation:jakarta.validation-api", version = "3.1.0" }
jakarta-enterprise-cdi-api = { module = "jakarta.enterprise:jakarta.enterprise.cdi-api", version = "4.1.0" }
jakarta-inject-api = { module = "jakarta.inject:jakarta.inject-api", version = "2.0.1" }
jakarta-persistence-api = { module = "jakarta.persistence:jakarta.persistence-api", version = "3.1.0" }
jakarta-servlet-api = { module = "jakarta.servlet:jakarta.servlet-api", version = "6.1.0" }
jakarta-validation-api = { module = "jakarta.validation:jakarta.validation-api", version = "3.0.2" }
jakarta-ws-rs-api = { module = "jakarta.ws.rs:jakarta.ws.rs-api", version = "3.1.0" }
javax-annotation-api = { module = "javax.annotation:javax.annotation-api", version = "1.3.2" }
javax-inject = { module = "javax.inject:javax.inject", version = "1" }
javax-servlet-api = { module = "javax.servlet:javax.servlet-api", version = "4.0.1" }
jetbrains-annotations = { module = "org.jetbrains:annotations", version = "24.1.0" }
junit-bom = { module = "org.junit:junit-bom", version = "5.10.3" }
junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" }
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" }
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit" }
junit-platform-reporting = { module = "org.junit.platform:junit-platform-reporting", version = "1.10.3" }
logback-core = { module = "ch.qos.logback:logback-core", version = "1.4.14" }
micrometer-bom = { module = "io.micrometer:micrometer-bom", version = "1.13.6" }
mockito-core = { module = "org.mockito:mockito-core", version = "5.11.0" }
mockito-junit-jupiter = { module = "org.mockito:mockito-junit-jupiter", version = "5.11.0" }
opentelemetry-bom = { module = "io.opentelemetry:opentelemetry-bom", version = "1.38.0" }
opentelemetry-semconv = { module = "io.opentelemetry.semconv:opentelemetry-semconv", version = "1.25.0-alpha" }
prometheus-metrics-exporter-servlet-jakarta = { module = "io.prometheus:prometheus-metrics-exporter-servlet-jakarta", version = "1.3.0" }
quarkus-bom = { module = "io.quarkus.platform:quarkus-bom", version.ref = "quarkus" }
s3mock-testcontainers = { module = "com.adobe.testing:s3mock-testcontainers", version = "3.11.0" }
slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
spotbugs-annotations = { module = "com.github.spotbugs:spotbugs-annotations", version = "4.8.5" }
Expand All @@ -74,5 +86,6 @@ threeten-extra = { module = "org.threeten:threeten-extra", version = "1.8.0" }

[plugins]
openapi-generator = { id = "org.openapi.generator", version = "7.6.0" }
quarkus = { id = "io.quarkus", version.ref = "quarkus" }
rat = { id = "org.nosphere.apache.rat", version = "0.8.1" }
spotless = { id = "com.diffplug.spotless", version = "6.25.0" }
13 changes: 6 additions & 7 deletions polaris-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ plugins {
id("polaris-client")
id("java-library")
id("java-test-fixtures")
id("org.kordamp.gradle.jandex") version "2.1.0"
}

dependencies {
Expand All @@ -33,10 +34,6 @@ dependencies {
constraints {
implementation("io.airlift:aircompressor:0.27") { because("Vulnerability detected in 0.25") }
}
// TODO - this is only here for the Discoverable interface
// We should use a different mechanism to discover the plugin implementations
implementation(platform(libs.dropwizard.bom))
implementation("io.dropwizard:dropwizard-jackson")

implementation(platform(libs.jackson.bom))
implementation("com.fasterxml.jackson.core:jackson-annotations")
Expand All @@ -49,6 +46,7 @@ dependencies {
implementation(libs.slf4j.api)
compileOnly(libs.jetbrains.annotations)
compileOnly(libs.spotbugs.annotations)
compileOnly(libs.jakarta.inject.api) // FIXME remove when RuntimeCandidate is removed

constraints {
implementation("org.xerial.snappy:snappy-java:1.1.10.4") {
Expand Down Expand Up @@ -102,15 +100,14 @@ dependencies {
implementation("io.micrometer:micrometer-core")

testFixturesApi(platform(libs.junit.bom))
testFixturesApi("org.junit.jupiter:junit-jupiter")
testFixturesApi(libs.assertj.core)
testFixturesApi(libs.mockito.core)
testFixturesApi(libs.bundles.junit.testing)
testFixturesApi("com.fasterxml.jackson.core:jackson-core")
testFixturesApi("com.fasterxml.jackson.core:jackson-databind")
testFixturesApi(libs.commons.lang3)
testFixturesApi(libs.threeten.extra)
testFixturesApi(libs.jetbrains.annotations)
testFixturesApi(platform(libs.jackson.bom))
testRuntimeOnly("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")

compileOnly(libs.jakarta.annotation.api)
Expand Down Expand Up @@ -150,3 +147,5 @@ listOf("sourcesJar", "compileJava").forEach { task ->
sourceSets {
main { java { srcDir(project.layout.buildDirectory.dir("generated/src/main/java")) } }
}

tasks.named("javadoc") { dependsOn("jandex") }
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ public PolarisCallContext(
this.clock = Clock.system(ZoneId.systemDefault());
}

public static PolarisCallContext copyOf(PolarisCallContext base) {
return new PolarisCallContext(
base.getMetaStore(), base.getDiagServices(), base.getConfigurationStore(), base.getClock());
}

public PolarisMetaStoreSession getMetaStore() {
return metaStore;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,23 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.test;
package org.apache.polaris.core.config;

import java.lang.annotation.ElementType;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import jakarta.inject.Qualifier;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Annotation used to specify where to inject the Polaris test realm identifier. This is provided by
* PolarisConnectionExtension.
*/
@Target({ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
public @interface PolarisRealm {}
/** Qualifier for candidate beans that are resolved at runtime based on configuration properties. */
@Qualifier
@Retention(RUNTIME)
@Target({TYPE, METHOD, FIELD, PARAMETER})
@Documented
// FIXME remove or replace
public @interface RuntimeCandidate {}
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ public Map<String, Object> contextVariables() {
* CallContext}.
*/
static CallContext copyOf(CallContext base) {
RealmContext realmContext = base.getRealmContext();
PolarisCallContext polarisCallContext = base.getPolarisCallContext();
RealmContext realmContext = RealmContext.copyOf(base.getRealmContext());
PolarisCallContext polarisCallContext = PolarisCallContext.copyOf(base.getPolarisCallContext());
Map<String, Object> contextVariables =
base.contextVariables().entrySet().stream()
.filter(e -> !e.getKey().equals(CLOSEABLES))
Expand Down Expand Up @@ -142,16 +142,16 @@ public Map<String, Object> contextVariables() {
default void close() {
if (CURRENT_CONTEXT.get() == this) {
unsetCurrentContext();
CloseableGroup closeables = closeables();
try {
closeables.close();
} catch (IOException e) {
Logger logger = LoggerFactory.getLogger(CallContext.class);
logger
.atWarn()
.addKeyValue("closeableGroup", closeables)
.log("Unable to close closeable group", e);
}
}
CloseableGroup closeables = closeables();
try {
closeables.close();
} catch (IOException e) {
Logger logger = LoggerFactory.getLogger(CallContext.class);
logger
.atWarn()
.addKeyValue("closeableGroup", closeables)
.log("Unable to close closeable group", e);
}
}
}
Loading