-
Notifications
You must be signed in to change notification settings - Fork 380
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
base: main
Are you sure you want to change the base?
Conversation
### 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.
core/src/main/java/org/apache/gravitino/listener/TagEventDispatcher.java
Show resolved
Hide resolved
|
||
public class TagFailureEvent extends FailureEvent { | ||
public TagFailureEvent(String user, Exception exception) { | ||
super(user, null, exception); |
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.
identifier should not be null for tag event.
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.
What should I pass here?
DELETE_TAG, | ||
ALTER_TAG, | ||
LIST_TAG, | ||
TAG_EXISTS, |
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.
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); |
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.
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); |
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.
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
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.
Ok
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.
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?
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.
what do you mean about Do I need to replace all String metalake in the TagDispatcher interface
?
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 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.
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 perfer not changing the interfaces in TagManager
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.
Ok
event describes what happened to a resource identified by a nameIdentifier,
|
|
||
import org.apache.gravitino.NameIdentifier; | ||
import org.apache.gravitino.tag.TagChange; | ||
|
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.
please add @DeveloperApi
and simple java doc to all tag failure event, please refer to SchemaFailureEvent
...java/org/apache/gravitino/listener/api/event/AssociateTagsForMetadataObjectFailureEvent.java
Show resolved
Hide resolved
hi @FANNG1 Please help review this PR, thanks. |
*/ | ||
public AlterTagFailureEvent( | ||
String user, String metalake, String name, TagChange[] changes, Exception exception) { | ||
super(user, TagManager.ofTagIdent(metalake, name), exception); |
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 odd to refer TagManager
here, how about move ofTagIdent
to NameIdentifierUtil
?
* | ||
* @return the name of the tag | ||
*/ | ||
public String name() { |
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.
please remove name()
and metalake()
, because they are not temp variables to generate tag identifier
* | ||
* @return The metadata object. | ||
*/ | ||
public MetadataObject metadataObject() { |
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.
remove metadataObject
and metalake
too
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.
please check other events
Could you fix the comments and could you add related document in |
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.
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.