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

[#5902] feat: Add tag failure event to Gravitino server #5944

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

cool9850311
Copy link
Contributor

What changes were proposed in this pull request?

Add tag failure event to Gravitino server

Why are the changes needed?

Subtask: #5902

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Unit tests.

### What changes were proposed in this pull request?

Add tag failure event to Gravitino server

### Why are the changes needed?

Subtask: apache#5902

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Unit tests.

public class TagFailureEvent extends FailureEvent {
public TagFailureEvent(String user, Exception exception) {
super(user, null, exception);
Copy link
Contributor

Choose a reason for hiding this comment

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

identifier should not be null for tag event.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What should I pass here?

DELETE_TAG,
ALTER_TAG,
LIST_TAG,
TAG_EXISTS,
Copy link
Contributor

Choose a reason for hiding this comment

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

TAG_EXISTS not used? please remove it

throw e;
}
}

@Override
public Tag createTag(
String metalake, String name, String comment, Map<String, String> properties) {
MetalakeInfo metalakeInfo = new MetalakeInfo(name, comment, properties, null);
Copy link
Contributor

Choose a reason for hiding this comment

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

we should create a TagInfo not MetalakeInfo here

- Removed @SuppressWarnings annotations.
- Removed unused OperationType.
- Replaced MetalakeInfo with TagInfo.
- Refactored TagFailureEvent constructor.
@@ -7,7 +7,7 @@ public class AlterTagFailureEvent extends TagFailureEvent {
private final String name;
private final TagChange[] changes;
public AlterTagFailureEvent(String user, String metalake, String name, TagChange[] changes, Exception exception) {
super(user, exception);
super(user, null, exception);
Copy link
Contributor

Choose a reason for hiding this comment

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

please provide a meaning identifier to all failure event, for tag operations the resource identifier is the $metalake.$tagName, for list operations the the resource identifier is the objects which supports list tags, such as $metalake.$metadataObject in listTagsForMetadataObject

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do I need to replace all String metalake in the TagDispatcher interface, as well as the fields that have been replaced with NameIdentifier in the TagManager, with NameIdentifier and construct the NameIdentifier in operations instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

what do you mean about Do I need to replace all String metalake in the TagDispatcher interface?

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 mean, currently TagDispatcher's methods are passing metalake as a String, and then turn it to NameIdentifier in TagManager.
I'm asking about if I should turn it to NameIdentifier earlier in TagOperations and then pass it through event and manager.

Copy link
Contributor

Choose a reason for hiding this comment

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

I perfer not changing the interfaces in TagManager

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok

@FANNG1
Copy link
Contributor

FANNG1 commented Dec 25, 2024

event describes what happened to a resource identified by a nameIdentifier,

  1. for most tag event(create/get/delete), the identifier is the metalakeName.tagName which could be generated by ofTagIdent(String metalake, String tagName) ,
  2. list tag event, the identifier the resource which supports list tags like metalake, or metadata object
  3. for tag event with metadataObject, the identifier is the $metalake.$metadataObject


import org.apache.gravitino.NameIdentifier;
import org.apache.gravitino.tag.TagChange;

Copy link
Contributor

Choose a reason for hiding this comment

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

please add @DeveloperApi and simple java doc to all tag failure event, please refer to SchemaFailureEvent

@xunliu
Copy link
Member

xunliu commented Dec 26, 2024

hi @FANNG1 Please help review this PR, thanks.

@cool9850311 cool9850311 marked this pull request as ready for review December 27, 2024 02:25
*/
public AlterTagFailureEvent(
String user, String metalake, String name, TagChange[] changes, Exception exception) {
super(user, TagManager.ofTagIdent(metalake, name), exception);
Copy link
Contributor

Choose a reason for hiding this comment

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

It's odd to refer TagManager here, how about move ofTagIdent to NameIdentifierUtil?

*
* @return the name of the tag
*/
public String name() {
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove name() and metalake(), because they are not temp variables to generate tag identifier

*
* @return The metadata object.
*/
public MetadataObject metadataObject() {
Copy link
Contributor

Choose a reason for hiding this comment

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

remove metadataObject and metalake too

Copy link
Contributor

Choose a reason for hiding this comment

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

please check other events

@FANNG1
Copy link
Contributor

FANNG1 commented Dec 27, 2024

Could you fix the comments and could you add related document in gravitino-server-config.md?

@cool9850311
Copy link
Contributor Author

Could you fix the comments and could you add related document in gravitino-server-config.md?

OK

This commit cleans up the TagFailureEvent classes by removing the unused 'metalake',  'name' and 'metadataObject'fields, along with their associated methods. This refactoring simplifies the code and enhances maintainability.
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.

3 participants