Skip to content

Conversation

yuqi1129
Copy link
Contributor

What changes were proposed in this pull request?

Support store entities with the same name under a namespace.

Why are the changes needed?

It's a necessary feature for Gravitino.

Fix: #2697

Does this PR introduce any user-facing change?

N/A.

How was this patch tested?

UTs

@yuqi1129 yuqi1129 self-assigned this Mar 27, 2024
@jerryshao
Copy link
Contributor

I think the key thing here is to make this change backward compatible, otherwise there's no way for users to upgrade.

@yuqi1129
Copy link
Contributor Author

yuqi1129 commented Apr 1, 2024

I think the key thing here is to make this change backward compatible, otherwise there's no way for users to upgrade.

Yeah, that is why I'm hesitant about it.

@@ -199,72 +189,15 @@ public <E extends Entity & HasIdentifier> E update(

// Update the name mapping
nameMappingService.updateName(
generateKeyForMapping(ident), generateKeyForMapping(updatedE.nameIdentifier()));
generateKeyForMapping(ident, entityType, nameMappingService),
generateKeyForMapping(updatedE.nameIdentifier(), entityType, nameMappingService));
Copy link
Contributor

Choose a reason for hiding this comment

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

Only changing here is enough, do you need to change put/get also?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

all have been changed through method concatIdAndName and put/get/update will use this method to generate key format.

@yuqi1129
Copy link
Contributor Author

yuqi1129 commented Apr 1, 2024

I think the key thing here is to make this change backward compatible, otherwise there's no way for users to upgrade.

Yeah, that is why I'm hesitant about it.

I have updated the code and added support for backward compatibility. Please take a look if you have time. Thanks.

prefixes.add(replacePrefixTypeInfo(encode, FILESET.getShortName()));
break;
case TABLE:
case FILESET:
Copy link
Contributor

Choose a reason for hiding this comment

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

Should you also add USER and GROUP here?

Copy link
Contributor

Choose a reason for hiding this comment

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

If we add USER and GROUP here, USER and GROUP will block the non-cascade deletion of metalake.

Copy link
Contributor

@jerryshao jerryshao left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for your work @yuqi1129

@jerryshao jerryshao merged commit d2cde88 into apache:main Apr 3, 2024
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.

[Improvement] KvEntity does not support different entity type with the same name under the same namespace
3 participants