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

Rename "RealmId" to "Realm" #899

Closed
wants to merge 3 commits into from
Closed

Conversation

flyrain
Copy link
Contributor

@flyrain flyrain commented Jan 28, 2025

To fix #910.

}

@Value.Parameter
@JsonValue
String id();
String name();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think id and name are almost interchangeable, but I change it to name to be consistent with other entities in Polaris, like catalog, namespace.

Copy link
Contributor

Choose a reason for hiding this comment

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

SGTM

new PolarisMetaStoreManagerImpl(realmId, diagnostics, configurationStore, clock);
metaStoreManagerMap.put(realmId.id(), metaStoreManager);
new PolarisMetaStoreManagerImpl(realm, diagnostics, configurationStore, clock);
metaStoreManagerMap.put(realm.name(), metaStoreManager);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be keyed on Realm instead of String?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was think of the refactor of this part, but it seems a relative big refactor as it changes the key type of the map. Can we do that as a followup PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

If it's a pretty big change we can defer it. My concern is the same as you noted in another comment, making everything consistent.

Copy link
Contributor

@eric-maynard eric-maynard left a comment

Choose a reason for hiding this comment

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

This change seems fine to me, left a few small comments

@flyrain
Copy link
Contributor Author

flyrain commented Jan 29, 2025

Thanks @eric-maynard. Resolved the comments. Ready for another look.

Copy link
Contributor

@eric-maynard eric-maynard 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 am okay to save the changes to things like sessionSupplierMap for a followup PR.

Copy link
Contributor

@dimas-b dimas-b left a comment

Choose a reason for hiding this comment

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

This renaming is fine from my POV.

Please allow for another day for @adutra and @snazy to add comments if they have any.

@@ -53,7 +53,7 @@ public InMemoryStorageIntegration(
* Check that the locations being accessed are all equal to or subdirectories of at least one of
* the {@link PolarisStorageConfigurationInfo#getAllowedLocations}.
*
* @param realmId
* @param realm
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: param without a description - might as well remove :)

Copy link
Member

@snazy snazy left a comment

Choose a reason for hiding this comment

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

This change looks like it's implementing "Option 1" from #910, which says The interface can be extensible in case we want to add any subconcept to the realm. This is against the documented contract, which says Represents the ID of the realm used in a REST request ....

There is also a fundamental difference between the ID (or call it "name") of a realm and the attributes of a realm. This change seems to prepare the pathway add more attributes to the type that is solely meant to contain only the ID/name of the realm.

In any case, if realm-ID/name-related/custom information is needed, CDI mechanisms should be used to not affect other code.

Making Realm/Id extensible makes it even harder if not impossible for HTTP/REST layers components (realm-ID extraction, request throttling) to do their job properly and without unnecessary performance implications. Those "low level components" should really not need to have knowledge about any extension. This would not be the case with the proposed "option 1", where those would have to go though some code that likely does a lot of things that those components do not need.

Also, if Realm/Id is considered extensible, how should two extensions for "realm" from different sources work together - only one extension could win.

If it's not the case that this change is meant to add more attributes to Realm/Id, then this PR is a pure nomenclature change while changing class names and function signatures (aka a breaking change). Nomenclature is almost always subjective, but not worth such a change like this.

Therefore my -1 on this PR.

@eric-maynard
Copy link
Contributor

Closing after #920

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.

Proposal: Use of Realm Instead of RealmId
4 participants