-
Notifications
You must be signed in to change notification settings - Fork 332
Refactor getConfiguration to use RealmContext (Part 2) #1783
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
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.
@dimas-b I added the change here to address your comment in the other PR #1780 (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.
thx!
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 looks functionally correct to me, but it contradicts the @Nonnull annotation on the realm context parameter now 🤷 Let's go back to testRealmContext to be aligned with annotations.
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.
sg! added back
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 wonder if it wouldn't be safer to pass CallContext otherwise you could in theory pass a PolarisCallContext that does not correspond to the passed RealmContext.
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.
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.
PolarisCallContext and RealmContext together in the same method call do raise an alarm in my head ;)
This is what I call "API skew" - both parameters are associated with a realm, but there's no guarantee the realm ID is the same. Moreover, there's no clarity what implementations should use for getting the realm ID.
CallContext might be acceptable in the short term if the ripple effects of using it are not too large.
In general, I'd like Polaris code to get all "context" stuff injected via CDI, though.
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.
To be clear: I'm -1 on using PolarisCallContext and RealmContext together in the same method.
+0 on using CallContext instead.
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.
Also for context: I personally do not have a good understanding of how PolarisCallContext and CallContext were envisioned to be used initially. My comments are based on what exists in code ATM.
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.
+1 on using CallContext. TBH, I'd be fine to replace all of the PolarisCallContext params in this interface with 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.
+1 on using CallContext. More broadly, I'd consider consolidating CallContext and PolarisCallContext into one class. Any concerns?
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'm fine with consolidating CallContext and PolarisCallContext into one class... but I reserve the right to object when I see the specific change set for that :) Note that ATM the former is an interface, the latter a class 🤷
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.
polaris-core/src/main/java/org/apache/polaris/core/config/PolarisConfigurationStore.java
Outdated
Show resolved
Hide resolved
...e/src/test/java/org/apache/polaris/service/quarkus/config/DefaultConfigurationStoreTest.java
Outdated
Show resolved
Hide resolved
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.
nit: my IDE is warning me about nullability issues, since the return types are marked @Nullable :-)
The following change removes the warnings:
Boolean featureDefaultValue =
configurationStore.getConfiguration(realmContext, trueByDefaultKey);
assertThat(featureDefaultValue).isTrue();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.
updated, Thanks!
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.
Let's rebase after #1806 merges... I hope it might simplify this PR.
|
@dimas-b Thanks a lot for the heads up! I am aware of that change, and I am currently helping on some of the follow up work to position the whole polaris call context is a cleaner way, once finished will rebase the change. |
851ccec to
7bdfaaf
Compare
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 looks functionally correct to me, but it contradicts the @Nonnull annotation on the realm context parameter now 🤷 Let's go back to testRealmContext to be aligned with annotations.
ef9ff35 to
1179e98
Compare
|
@flyrain : over to you for review (just to be in sync) |
This is the last PR to deal with issue #1775.
This PR refactors loadTasks to take RealmContext as a parameter, and completely removes the usage of getConfiguration(@nonnull PolarisCallContext ctx, String configName).