-
Notifications
You must be signed in to change notification settings - Fork 332
Consolidate CallContext with PolarisCallContext #1806
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
Conversation
dimas-b
left a comment
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.
Thanks, @flyrain ! This refactoring looks reasonable to me... Just one comment about Clock
| this.metaStore = metaStore; | ||
| this.diagServices = diagServices; | ||
| this.configurationStore = new PolarisConfigurationStore() {}; | ||
| this.clock = Clock.system(ZoneId.systemDefault()); |
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.
why not Clock.systemUTC()?
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 was a copy from the deprecated method, see line 90. I'm OK to change it to UTC. I'd suggest to make that change in a separate PR, as it isn't related to the refactor in this PR.
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.
Ok to defer, but we must not forget... IIRC we already have a mix of clocks in the codebase. It'd be nice to have a uniform pattern.
| * low-level services required to process that request | ||
| */ | ||
| public class PolarisCallContext { | ||
| public class PolarisCallContext implements CallContext { |
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.
Just curious, why not go the other way? It seems like it would be easier to have CallContext extend PolarisCallContext, since it can immediately implement all the methods just by delegating to the current PolarisCallContext
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.
I think that's also a nice idea, however, it will need to change CallContext from an interface to a class, which isn't trivial -- all anonymous classes have to go. Besides, it's reasonable to keep CallContext as an interface, while PolarisCallContext as an impl. I also list the step 3 which promotes methods in PolarisCallContext to the interface CallContext, like getMetaStore(). This will even clean up more, so that, PolarisCallContext doesn't have to return itself from the method getPolarisCallContext().
adutra
left a comment
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.
The changes LGTM and definitely bring a nice simplification.
I just think that there is one last follow-up step that we should consider: getting rid of CallContext and PolarisCallContext completely.
As you know, this was attempted before, but I'll admit it was done too hastily. But the intent is still relevant imho: CallContext is progressively becoming an empty interface, and PolarisCallContext does not have any business logic attached to it.
Moreover, PolarisCallContext has 3 application-scoped beans, but also one non-CDI bean that is realm-dependent. Because of that, PolarisCallContext itself must be in request scope. Besides, not all injectees require access to all of these beans. By de-entangling those beans and injecting them one by one, we would loosen the coupling between components and maybe even promote some beans from request scope to application scope.
+1, let's keep improving on it. |
c4a9c44
After pr #1806, the original constructor is marked as deprecated and is not suppose to be used anymore. This PR removes the usage of the old constructors.
This PR is a follow-up of #1806 to remove all usage of CallContext.of() in tests and the method itself
* main: Update dependency software.amazon.awssdk:bom to v2.31.54 (apache#1769) * main: Update dependency org.apache.spark:spark-sql_2.12 to v3.5.6 (apache#1752) * main: Update docker.io/apache/spark Docker tag to v3.5.6 (apache#1795) * main: Update dependency org.apache.spark:spark-sql_2.12 to v3.5.6 (apache#1794) * main: Update apache/spark Docker tag to v3.5.6 (apache#1791) * feat(cdi): Remove CallContext.close() (apache#1776) Now that every catalog created by PolarisCallContextCatalogFactory is correctly closed by IcebergCatalogAdapter, we can finally remove the CallContext.close() method and the associated cloaseables group. This simplification will hopefully pave the way to a more robust handling of request-scoped beans in task executor threads. * Remove the unused field in CallContextCatalogFactory (apache#1784) * Test: silence CDS warning from admin tool tests (apache#1800) * Update ascii banner (apache#1654) * Don't rotate root's credentials on startup in JdbcMetaStoreManagerFactory (apache#1804) * Core: Consolidate CallContext with PolarisCallContext part 1(apache#1806) * Automate regeneration of Python client (apache#1675) When running regtests or the CLI, we should run `./gradlew regeneratePythonClient` in order to run against the most up-to-date Python client. As part of this change, I've also updated the generator to 7.12 to match what's in the `libs.version.toml` and regenerated the code managed in github. Once the automatic generation works as part of CI, we can remove the generated code from the repo altogether. In the future, it can be added to .gitignore. * Remove deprecated constructor for PolarisCallContext (apache#1813) After pr apache#1806, the original constructor is marked as deprecated and is not suppose to be used anymore. This PR removes the usage of the old constructors. * Remove CallContext.of (apache#1812) This PR is a follow-up of apache#1806 to remove all usage of CallContext.of() in tests and the method itself * Remove CallContext.getDiagnostics (apache#1815) This shall be part of the CallContext cleanup process. `CallContext.getDiagnostics` is never used anywhere * Turn CallContext.copyOf into an interface instead of static function (apache#1816) * Refactor getConfiguration to use RealmContext (Part 2) (apache#1783) * main: Update dependency gradle to v8.14.2 (apache#1820) * main: Update dependency gradle to v8.14.2 * adjust to Polaris build --------- Co-authored-by: Dmitri Bourlatchkov <dmitri.bourlatchkov@dremio.com> * NoSQL: merge-conflict fixes * Last merged commit: 553b644 --------- Co-authored-by: Mend Renovate <bot@renovateapp.com> Co-authored-by: Alexandre Dutra <adutra@users.noreply.github.com> Co-authored-by: Yufei Gu <yufei@apache.org> Co-authored-by: Scott Teal <s.teal726@gmail.com> Co-authored-by: Eric Maynard <eric.maynard+oss@snowflake.com> Co-authored-by: gh-yzou <167037035+gh-yzou@users.noreply.github.com> Co-authored-by: Honah (Jonas) J. <honahx@apache.org> Co-authored-by: Dmitri Bourlatchkov <dmitri.bourlatchkov@dremio.com>
This is the first step to consolidate call context. After this change, you can already use
PolarisCallContextto get aRealmContext. To finish the consolidation, here are follow-ups.PolarisCallContextextendCallContextCallContext.of(), then remove the method.PolarisCallContextto the interfaceCallContext, likegetMetaStore()CallContextinstead ofPolarisCallContextas much as possible. For example,EntitiesResult createEntitiesIfNotExist( @Nonnull PolarisCallContext callCtx, ...)