-
Notifications
You must be signed in to change notification settings - Fork 338
MetaStoreManagerFactory: make purgeRealms() return purge results #889
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.
why copying? it's immutable
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.
It's RequestScoped, so I think it can get lost.
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.
It's potentially a CDI bean, and these are poor choices as map keys: the CDI specs do not say anything about how CDI proxies should handle equals() and hashCode(). Such beans can have surprising effects when put in a set or a map.
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 worry that this is an extremely easy mistake to make. I dislike proxies for this and other reasons. A person has to have a lot of context in their head before they do simple things like add keys to maps.
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.
@eric-maynard @adutra fair point. However, the realm-IDs here are parameters for bootstrap?
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.
Unfortunately the bootstrapRealms method can be called both from a bootstrap command (in which case RealmId is not a CDI proxy) and from "regular" server code (in which case it is a proxy). (The "regular" path only happens with the in-memory metastore 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.
This class seems like it does nothing
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.
It's used by Picocli to automatically convert Strings to RealmId.
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 see, and what does that do?
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.
It's removed anyways.
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.
ditto
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.
Same but this one is used by Quarkus / MicroProfile.
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.
Shouldn't this use RealmId not String, so we don't need to call id()?
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.
See my previous comment: CDI beans as map keys or set elements would have surprising effects here, notably containsKey() and addAll() wouldn't work as expected. We would need to copy the RealmId each time to be sure. In the end I think it's not worth it since these maps and collections are not public.
collado-mike
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.
no general opposition to the PR, but it does highlight some concern regarding the use of RealmId as a plain ole java object. There's now some assumed base framework knowledge, that, AFACIT, isn't documented anywhere and will likely lead to issues in the future.
I also think we are missing a lot of basic javadocs that will help those of us who are ramping up on the frameworks being used here.
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 worry that this is an extremely easy mistake to make. I dislike proxies for this and other reasons. A person has to have a lot of context in their head before they do simple things like add keys to maps.
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.
Javadoc comments are extremely helpful for people ramping up on the frameworks being used here
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.
Same re: javadoc comments
|
@collado-mike @eric-maynard @snazy Since the mailing list discussion around RealmId is still ongoing, and given that you raised concerns about using Would it be better for you if we keep using String ids in the bootstrap/purge parts of the I think I could make it work. The only change I really need to keep working on #887 is that |
WFM |
I certainly like typed keys over String keys, but my worry is that it will be too easy to make mistakes. If it was a POJO, I'd say use the typed key, but I don't think people should have to wonder about whether a Realm passed in as a method argument was originally a CDI bean or if it's safe to use. |
6850f7f to
540455d
Compare
|
Alright, I reverted the map key changes and went back to String keys. |
d45c626 to
bfceff3
Compare
|
PR rebased. With the revert from The new scope of this PR is now focused around making the @snazy @collado-mike @eric-maynard can an I have another review please? |
a7c0ca0 to
85eb460
Compare
85eb460 to
99baaa2
Compare
99baaa2 to
bb98c46
Compare
|
Rebased again. @snazy @collado-mike @eric-maynard can an I have another review please? |
Make the
purgeRealmsmethod return the purge results.These changes are a prerequisite for #878 and #887.