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

Remove dropwizard-jackson dep from core #435

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

dimas-b
Copy link
Contributor

@dimas-b dimas-b commented Nov 7, 2024

This is a simplification / cleanup. The dependency does not appear to be required in polaris-core

How Has This Been Tested?

Manual bootstrap execution with EclipseLink and PostgreSQL.

@dimas-b
Copy link
Contributor Author

dimas-b commented Nov 12, 2024

I'm going to add one more commit and rebase presently... hopefully clarifying the use of Discoverable.

@dimas-b
Copy link
Contributor Author

dimas-b commented Nov 13, 2024

I rebased and refactored service descriptors (resources) to be coherent both with java type hierarchies and comply with the Dropwizard way of discovering Jackson sub-types.

As a side benefit, the last commit fixes this message that happens when running without EclipseLink:

INFO  [2024-11-12 19:41:53,334 - 12224 ] [main] [] i.d.j.DiscoverableSubtypeResolver: Unable to load org.apache.polaris.extension.persistence.impl.eclipselink.EclipseLinkPolarisMetaStoreManagerFactory 

@dimas-b dimas-b requested a review from adutra November 13, 2024 00:59
Copy link
Contributor

@adutra adutra left a comment

Choose a reason for hiding this comment

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

LGTM – I think you achieved a nice balance between removing DW from core but keeping Discoverable around in relevant modules. 👍

*
* @see DiscoverableSubtypeResolver
*/
public interface DiscoverableMetaStoreManagerFactory extends Discoverable {}
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't make a lot of sense to me. When the subtype resolver is asked for implementations, it'll be for a common interface - i.e., MetaStoreManagerFactory in this case. Why would the subtype resolver ever ask for the eclipse-link specific version of the DiscoverableMetaStoreManagerFactory?

Copy link
Contributor Author

@dimas-b dimas-b Nov 14, 2024

Choose a reason for hiding this comment

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

Type resolution during YAML parsing is handled by Jackson, and it properly recognizes all types in the java hierarchy (even those not implementing Discoverable).

However, Jackson (in this setup) relies on DiscoverableSubtypeResolver to discover implementation classes. That latter part has peculiar logic, where DiscoverableSubtypeResolver performs a two stage lookup: 1) classes listed in META-INF/services/io.dropwizard.jackson.Discoverable, 2) classes listed in the service manifests for the classes from step 1. I do not really know why it does not directly inject classes from step 1 into Jackson.

I agree, it looks odd. However, having one Discoverable interface is not possible as this PR specifically proposes to remove DW dependencies from polaris-core, where the base interface exists and there is no other common root between the "in memory" metastore implementation and the EclipseLink implementation. We could add a rather small common module for that, of course, but in my mind having two separate Discoverable interfaces was less intrusive. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

Leaf classes cannot implement {@link Discoverable} directly, they have to implement another interface, which implements {@link Discoverable}.

Isn't this the exact setup we have right now, where the leaf classes implement MetastoreManagerFactory?

Should we just move MetastoreManagerFactory out of core?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we just move MetastoreManagerFactory out of core?

That's an option. This is what I meant by "add a rather small common module" above, because the EclipseLink and In-Memory implementations have to share it.

Would do other people think? @collado-mike @adutra ?

Copy link
Contributor

Choose a reason for hiding this comment

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

So, if I get this correctly, we would all love to have MetastoreManagerFactory directly in polaris-service like many other similar beans, but we can't, because of EclipseLink.

If that is correct, I'd prefer to keep your current solution for now, then revisit this later, when/if EclipseLink is replaced with some more robust persistence solution.

Copy link
Contributor

Choose a reason for hiding this comment

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

(and in any case, I'd avoid introducing a "polaris-core-dropwizard" module just for that.)

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.

4 participants