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

Quarkus-based Polaris service runtime #469

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

adutra
Copy link
Contributor

@adutra adutra commented Nov 22, 2024

Fixes #392.

Read the README_quarkus.md file for more details on what changes, how, and what remains to be done.

@adutra adutra force-pushed the polaris-quarkus-replacement branch from f714c40 to dcf8ccd Compare November 23, 2024 16:25
@adutra adutra force-pushed the polaris-quarkus-replacement branch 4 times, most recently from 2f18194 to adfbbc2 Compare November 25, 2024 16:38
@snazy snazy mentioned this pull request Nov 25, 2024
8 tasks
@adutra adutra force-pushed the polaris-quarkus-replacement branch 7 times, most recently from 4ac2974 to 5cc6fec Compare November 28, 2024 10:42
@adutra adutra changed the title [WIP] Quarkus-based Polaris service runtime Quarkus-based Polaris service runtime Nov 28, 2024
@adutra adutra force-pushed the polaris-quarkus-replacement branch 13 times, most recently from fe8b9dc to 9fd4ce3 Compare November 29, 2024 16:16
@snazy snazy mentioned this pull request Dec 2, 2024
11 tasks
snazy added a commit to snazy/polaris that referenced this pull request Jan 13, 2025
Having documentation about the configuration that is both "up-to-date" and "in-sync with the source code" with the actual code is good practice.

The functionality added in this change allows generating markdown docs from smallrye-config based configuration types, starting at and grouped by types that are annotated with `@ConfigMapping`. The javadoc of the config interfaces and properties is emitted as markdown. On top there is functionality to generate reference docs for "static" types (currently unused in Polaris).

The code is nearly a 1:1 port of the same functionality in Nessie. This change will become useful with/after apache#469.

Gradle projects added in this change are:
* `polaris-config-doc-annotations` adds an annotation used when generating docs to influence the generation of the configuration reference docs.
* `polaris-config-doc-generator` is the reference doc generator implementation, as a "standalone" tool that uses javadoc _infrastructure_. See `ReferenceConfigDocsGenerator` why it needs to be a separate tool than "just" a doclet (class loader isolation issues).
* `polaris-site-reference-docs` actually generates the markdown files from referenced Gradle projects. Currently there are no projects referenced, so generation yields nothing.

The generated docs are not yet integrated into the website, which will happen in a follow-up PR.
@adutra adutra force-pushed the polaris-quarkus-replacement branch 3 times, most recently from a4e8638 to ea66fd4 Compare January 13, 2025 19:08
queryParams.put("parent", RESTUtil.encodeNamespace(parent));
// TODO change this for Iceberg 1.7.2:
// queryParams.put("parent", RESTUtil.encodeNamespace(parent));
queryParams.put("parent", Joiner.on('\u001f').join(parent.levels()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Noted! Change LGTM!

import org.apache.polaris.service.it.test.PolarisRestCatalogIntegrationTest;

public class DropwizardRestCatalogIntegrationTest extends PolarisRestCatalogIntegrationTest {}
@QuarkusTest
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Do you think it should be @QuarkusIntegrationTest in the spirit of backbox tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but later: we don't have an intTest configuration in polaris yet :-)

Copy link
Member

Choose a reason for hiding this comment

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

Just add this to your build.gradle.kts (after #714)

testing {
  suites {
    val intTest by registering(JvmTestSuite::class)
  }
}

tasks.named("check") { dependsOn(testing.suites.named("intTest")) }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice, let's do it in a follow-up PR after the renamings etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

no rush :)

snazy added a commit to snazy/polaris that referenced this pull request Jan 13, 2025
When editing `.gitignore`, IntelliJ warns about a couple directories being ignored but not excluded from being indexed and searched. This change ignores the mentioned directories, except the one for DW, which is going away with apache#469.
snazy added a commit to snazy/polaris that referenced this pull request Jan 13, 2025
When editing `.gitignore`, IntelliJ warns about a couple directories being ignored but not excluded from being indexed and searched. This change ignores the mentioned directories, except the one for DW, which is going away with apache#469.
snazy added a commit to snazy/polaris that referenced this pull request Jan 13, 2025
Having documentation about the configuration that is both "up-to-date" and "in-sync with the source code" with the actual code is good practice.

The functionality added in this change allows generating markdown docs from smallrye-config based configuration types, starting at and grouped by types that are annotated with `@ConfigMapping`. The javadoc of the config interfaces and properties is emitted as markdown. On top there is functionality to generate reference docs for "static" types (currently unused in Polaris).

The code is nearly a 1:1 port of the same functionality in Nessie. This change will become useful with/after apache#469.

Gradle projects added in this change are:
* `polaris-config-doc-annotations` adds an annotation used when generating docs to influence the generation of the configuration reference docs.
* `polaris-config-doc-generator` is the reference doc generator implementation, as a "standalone" tool that uses javadoc _infrastructure_. See `ReferenceConfigDocsGenerator` why it needs to be a separate tool than "just" a doclet (class loader isolation issues).
* `polaris-site-reference-docs` actually generates the markdown files from referenced Gradle projects. Currently there are no projects referenced, so generation yields nothing.

The generated docs are not yet integrated into the website, which will happen in a follow-up PR.
snazy added a commit that referenced this pull request Jan 13, 2025
Having documentation about the configuration that is both "up-to-date" and "in-sync with the source code" with the actual code is good practice.

The functionality added in this change allows generating markdown docs from smallrye-config based configuration types, starting at and grouped by types that are annotated with `@ConfigMapping`. The javadoc of the config interfaces and properties is emitted as markdown. On top there is functionality to generate reference docs for "static" types (currently unused in Polaris).

The code is nearly a 1:1 port of the same functionality in Nessie. This change will become useful with/after #469.

Gradle projects added in this change are:
* `polaris-config-doc-annotations` adds an annotation used when generating docs to influence the generation of the configuration reference docs.
* `polaris-config-doc-generator` is the reference doc generator implementation, as a "standalone" tool that uses javadoc _infrastructure_. See `ReferenceConfigDocsGenerator` why it needs to be a separate tool than "just" a doclet (class loader isolation issues).
* `polaris-site-reference-docs` actually generates the markdown files from referenced Gradle projects. Currently there are no projects referenced, so generation yields nothing.

The generated docs are not yet integrated into the website, which will happen in a follow-up PR.
@adutra adutra force-pushed the polaris-quarkus-replacement branch from ea66fd4 to c4e6ff0 Compare January 13, 2025 20:33
Comment on lines +103 to +105
String realmId = base.getRealmContext().getRealmIdentifier();
RealmContext realmContext = () -> realmId;
PolarisCallContext polarisCallContext = PolarisCallContext.copyOf(base.getPolarisCallContext());
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: there are new comments in the caller, could we also add comments here to explain why we need cloned objects realmContext and polarisCallContext.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@flyrain this will soon disappear with #589 so I don't think there is need to explain.

But just for posterity, the reason is realted to TaskExecutor: these beans are request-scoped, and they would become unusable when the original request that created them completes, but the task hasn't finished executing yet.

@@ -107,12 +114,7 @@ private PolarisAdminService newAdminService(
PolarisMetaStoreManager metaStoreManager =
metaStoreManagerFactory.getOrCreateMetaStoreManager(realmContext);
return new PolarisAdminService(
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: are we going to use DI for the class PolarisAdminService later as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably. There is a huge overlap between PolarisServiceImpl (which is a request-scoped CDI bean) and PolarisAdminService, which is just a regular Pojo.

Comment on lines -133 to +135
PolarisCallContext polarisCallContext = CallContext.getCurrentContext().getPolarisCallContext();
PolarisCallContext polarisCallContext = callContext.getPolarisCallContext();
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest postponing this change until we've fixed line 101.

Copy link
Member

Choose a reason for hiding this comment

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

Let's keep this PR as it is - there is already #463 to get rid of the problematic TLs

metaStoreManager,
securityContext,
polarisAuthorizer);
callContext, entityManager, metaStoreManager, securityContext, polarisAuthorizer);
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest postponing this change until we've fixed the line 101.

Comment on lines +52 to +57
implementation(libs.jakarta.annotation.api)
implementation(libs.jakarta.enterprise.cdi.api)
implementation(libs.jakarta.inject.api)
implementation(libs.jakarta.servlet.api)
implementation(libs.jakarta.validation.api)
implementation(libs.jakarta.ws.rs.api)
Copy link
Contributor

Choose a reason for hiding this comment

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

Considering this is a service-common module, do we need these libs in runtime classpaths?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will take a note to check if these would work with compileOnly.

Comment on lines +68 to +72
* system properties
* environment variables
* `.env` file in the current working directory
* `$PWD/config/application.properties` file
* the `application.properties` packaged in the `polaris-quarkus-service` application
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we improve the documentation to provide clearer and more detailed descriptions like the following:

Quarkus aggregates configuration properties from multiple sources, applying them in a specific order of precedence. When a property is defined in multiple sources, the value from the source with the higher priority overrides those from lower-priority sources. This behavior replaces the old configuration file format, such as polaris-server.yml.

The sources are listed below, from highest to lowest priority:

  1. System properties: Properties set via the Java command line using -Dproperty.name=value.
  2. Environment variables in .env file of the current working directory.
  3. Settings in $PWD/config/application.properties file
  4. The application configuration file packaged as part of the lib polaris-quarkus-service.
  5. Default values: Hardcoded defaults within the application.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@flyrain this README is temporary, there is #700 to completely redesign the documentation.

There is already a paragraph about Quarkus configuration in #700, but I will make sure to include your suggestion above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Incorporated the above changes in #700. FYI.


* Bean injection (CDI) is made using `@ApplicationScoped` annotation on class and injected in other classes using `@Inject` annotation (https://quarkus.io/guides/cdi-reference).
* Codehale metrics registry and opentelemetry boilerplate (prometheus exporter included) are not needed anymore: Quarkus provides it "out of the box" (https://quarkus.io/guides/opentelemetry)
* `PolarisHealthCheck` is not needed anymore: Quarkus provides it "out of the box" (https://quarkus.io/guides/smallrye-health)
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this potentially breaks existing deployment as the endpoint url has changed, like this example shows:

 "http://localhost:8182/healthcheck" --> "http://localhost:8182/q/health"

I'd recommend to keep the existing health check in this PR. Deprecated it later if needed. cc @dennishuo @collado-mike @eric-maynard

Copy link
Member

Choose a reason for hiding this comment

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

@flyrain if you really have an existing deployment and need the old endpoint, then you can add it to your build (as a system integrator you likely have your own build).

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is a reasonable response to proposed breaking changes. This is a bit like saying "if you have your own fork, you can patch it". It is a reasonable use case that someone would check out the Polaris repo, package it up in a Docker build and deploy it to their K8s application and use the provided health checker endpoint to monitor it. We wouldn't remove one of the management APIs out from under users and tell them to just fix it in their own build. I don't think the health checker or the metrics APIs ought to be treated any differently

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We did not remove the health check endpoint nor the metrics endpoint.

Copy link
Contributor

Choose a reason for hiding this comment

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

@collado-mike : Does #782 help?

snazy added a commit that referenced this pull request Jan 14, 2025
When editing `.gitignore`, IntelliJ warns about a couple directories being ignored but not excluded from being indexed and searched. This change ignores the mentioned directories, except the one for DW, which is going away with #469.
@adutra adutra force-pushed the polaris-quarkus-replacement branch from c4e6ff0 to e15f55a Compare January 14, 2025 10:23
picocli = "4.7.6"
slf4j = "2.0.16"
swagger = "1.6.14"

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

Choose a reason for hiding this comment

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

I'll do a follow-up to adopt it to what #714 introduced

@adutra adutra merged commit 4c7ae00 into apache:main Jan 14, 2025
5 checks passed
@adutra adutra deleted the polaris-quarkus-replacement branch January 14, 2025 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhanced Apache Polaris runtime
9 participants