-
Notifications
You must be signed in to change notification settings - Fork 366
Remove dropwizard-jackson dep from core #435
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
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3f5bcdd
Remove dropwizard-jackson dep from core
dimas-b c7f73ea
review: add PolarisApplicationConfigurationTest
dimas-b a249d99
Add coherent service descriptors for discoverable metastore classes
dimas-b c343504
review: add EclipseLink-specific config to tests
dimas-b 1e713ff
Merge branch 'main' into remove-dw-from-core
dimas-b File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...e/polaris/extension/persistence/impl/eclipselink/DiscoverableMetaStoreManagerFactory.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| /* | ||
| * 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.extension.persistence.impl.eclipselink; | ||
|
|
||
| import io.dropwizard.jackson.Discoverable; | ||
| import io.dropwizard.jackson.DiscoverableSubtypeResolver; | ||
|
|
||
| /** | ||
| * Discoverability aid for Dropwizard. Leaf classes cannot implement {@link Discoverable} directly, | ||
| * they have to implement another interface, which implements {@link Discoverable}. | ||
| * | ||
| * @see DiscoverableSubtypeResolver | ||
| */ | ||
| public interface DiscoverableMetaStoreManagerFactory extends Discoverable {} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...tence/eclipselink/src/main/resources/META-INF/services/io.dropwizard.jackson.Discoverable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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.extension.persistence.impl.eclipselink.DiscoverableMetaStoreManagerFactory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...main/java/org/apache/polaris/service/persistence/DiscoverableMetaStoreManagerFactory.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| /* | ||
| * 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.service.persistence; | ||
|
|
||
| import io.dropwizard.jackson.Discoverable; | ||
| import io.dropwizard.jackson.DiscoverableSubtypeResolver; | ||
|
|
||
| /** | ||
| * Discoverability aid for Dropwizard. Leaf classes cannot implement {@link Discoverable} directly, | ||
| * they have to implement another interface, which implements {@link Discoverable}. | ||
| * | ||
| * @see DiscoverableSubtypeResolver | ||
| */ | ||
| public interface DiscoverableMetaStoreManagerFactory extends Discoverable {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...A-INF/services/org.apache.polaris.service.persistence.DiscoverableMetaStoreManagerFactory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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.service.persistence.InMemoryPolarisMetaStoreManagerFactory |
78 changes: 78 additions & 0 deletions
78
...service/src/test/java/org/apache/polaris/service/PolarisApplicationConfigurationTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| /* | ||
| * 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.service; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| import io.dropwizard.testing.ConfigOverride; | ||
| import io.dropwizard.testing.ResourceHelpers; | ||
| import io.dropwizard.testing.junit5.DropwizardAppExtension; | ||
| import io.dropwizard.testing.junit5.DropwizardExtensionsSupport; | ||
| import org.apache.polaris.extension.persistence.impl.eclipselink.EclipseLinkPolarisMetaStoreManagerFactory; | ||
| import org.apache.polaris.service.config.PolarisApplicationConfig; | ||
| import org.apache.polaris.service.persistence.InMemoryPolarisMetaStoreManagerFactory; | ||
| import org.junit.jupiter.api.Nested; | ||
| import org.junit.jupiter.api.Test; | ||
| import org.junit.jupiter.api.extension.ExtendWith; | ||
|
|
||
| @ExtendWith(DropwizardExtensionsSupport.class) | ||
| public class PolarisApplicationConfigurationTest { | ||
|
|
||
| public static final String CONFIG_PATH = | ||
| ResourceHelpers.resourceFilePath("polaris-server-integrationtest.yml"); | ||
| // Bind to random ports to support parallelism | ||
| public static final ConfigOverride RANDOM_APP_PORT = | ||
| ConfigOverride.config("server.applicationConnectors[0].port", "0"); | ||
| public static final ConfigOverride RANDOM_ADMIN_PORT = | ||
| ConfigOverride.config("server.adminConnectors[0].port", "0"); | ||
|
|
||
| @Nested | ||
| class DefaultMetastore { | ||
| private final DropwizardAppExtension<PolarisApplicationConfig> app = | ||
| new DropwizardAppExtension<>( | ||
| PolarisApplication.class, CONFIG_PATH, RANDOM_APP_PORT, RANDOM_ADMIN_PORT); | ||
|
|
||
| @Test | ||
| void testMetastoreType() { | ||
| assertThat(app.getConfiguration().getMetaStoreManagerFactory()) | ||
| .isInstanceOf(InMemoryPolarisMetaStoreManagerFactory.class); | ||
| } | ||
| } | ||
|
|
||
| @Nested | ||
| class EclipseLinkMetastore { | ||
| private final DropwizardAppExtension<PolarisApplicationConfig> app = | ||
| new DropwizardAppExtension<>( | ||
| PolarisApplication.class, | ||
| CONFIG_PATH, | ||
| RANDOM_APP_PORT, | ||
| RANDOM_ADMIN_PORT, | ||
| ConfigOverride.config("metaStoreManager.type", "eclipse-link"), | ||
| ConfigOverride.config("metaStoreManager.persistence-unit", "test-unit"), | ||
| ConfigOverride.config("metaStoreManager.conf-file", "/test-conf-file")); | ||
|
|
||
| @Test | ||
| void testMetastoreType() { | ||
| assertThat(app.getConfiguration().getMetaStoreManagerFactory()) | ||
| .isInstanceOf(EclipseLinkPolarisMetaStoreManagerFactory.class) | ||
| .extracting("persistenceUnitName", "confFile") | ||
| .containsExactly("test-unit", "/test-conf-file"); | ||
| } | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.,
MetaStoreManagerFactoryin this case. Why would the subtype resolver ever ask for the eclipse-link specific version of theDiscoverableMetaStoreManagerFactory?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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
DiscoverableSubtypeResolverto discover implementation classes. That latter part has peculiar logic, whereDiscoverableSubtypeResolverperforms a two stage lookup: 1) classes listed inMETA-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
Discoverableinterface is not possible as this PR specifically proposes to remove DW dependencies frompolaris-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 separateDiscoverableinterfaces was less intrusive. WDYT?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this the exact setup we have right now, where the leaf classes implement
MetastoreManagerFactory?Should we just move
MetastoreManagerFactoryout of core?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 ?
There was a problem hiding this comment.
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
MetastoreManagerFactorydirectly 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.
There was a problem hiding this comment.
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.)