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

Draft
wants to merge 3 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

package org.apache.gravitino.listener.api.event;

import org.apache.gravitino.MetadataObject;
import org.apache.gravitino.utils.MetadataObjectUtil;
Copy link
Contributor

Choose a reason for hiding this comment

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

please format code ./gradlew spotlessApply

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.

2 participants