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

[#4309] feat(core): support tag events for event listener #5847

Merged
merged 11 commits into from
Dec 18, 2024

Conversation

TungYuChiang
Copy link
Contributor

What changes were proposed in this pull request?

support tag events for event listener

Why are the changes needed?

Fix: #4309

Does this PR introduce any user-facing change?

no

How was this patch tested?

existing tests

@TungYuChiang TungYuChiang marked this pull request as ready for review December 12, 2024 15:39
@TungYuChiang TungYuChiang changed the title Feature/tag system [Draft] Feature/tag system Dec 12, 2024
@TungYuChiang TungYuChiang changed the title [Draft] Feature/tag system [Draft][#4309] feat(core): support tag events for event listener Dec 12, 2024
@jerryshao jerryshao requested a review from FANNG1 December 13, 2024 03:20
// TODO: getTagFailureEvent
throw e;
}
return null;
Copy link
Collaborator

@orenccl orenccl Dec 13, 2024

Choose a reason for hiding this comment

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

I think TagEventDispatcher should forward requests to the TagManager?

Something like return dispathcer.getTag(metalake, name)

Copy link
Contributor

Choose a reason for hiding this comment

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

+1, if not forwarding request, the tag request will takes no effect after this PR is merged.

@FANNG1
Copy link
Contributor

FANNG1 commented Dec 13, 2024

suggest not moving SupportsTags in API module, but place SupportsTags in core module in org.apache.gravitino.connector, @jerryshao @xunliu WDYT?

@FANNG1
Copy link
Contributor

FANNG1 commented Dec 13, 2024

The architecture looks good to me.


import org.apache.gravitino.annotation.Evolving;
import org.apache.gravitino.exceptions.NoSuchTagException;
import org.apache.gravitino.exceptions.TagAlreadyAssociatedException;
import org.apache.gravitino.tag.Tag;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we do such changes in the API level? It will basically break the compatibility. If there's no strong reason, we should not do a such change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we do not move the Supports in the API module, it will conflict with the one in the core module. I referred to other designs under the API, such as catalog, and moved it out of the Tag folder. Would you happen to have any good suggestions?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can have two options:

  1. No need to use dispatcher pattern, just implement the listener logic in TagManager.
  2. To refer to PatitionDispatcher, just add the methods in this TagDispatcher interface, no need to have another SupportsXXX 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.

Hi Jerry,
I decided to go with Option 2 and have completed the implementation.

@jerryshao
Copy link
Contributor

suggest not moving SupportsTags in API module, but place SupportsTags in core module in org.apache.gravitino.connector, @jerryshao @xunliu WDYT?

SupportsTags is a user-facing API, not a dev-related interface, also should not be aware from the catalog developer. We should not move it to the connector package.

@TungYuChiang TungYuChiang force-pushed the feature/tag_system branch 2 times, most recently from 630132f to 4e2acad Compare December 16, 2024 12:02
@TungYuChiang TungYuChiang changed the title [Draft][#4309] feat(core): support tag events for event listener [#4309] feat(core): support tag events for event listener Dec 17, 2024
String[] listTagsForMetadataObject(String metalake, MetadataObject metadataObject);

/**
* @param metalake
Copy link
Contributor

Choose a reason for hiding this comment

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

please complement the java doc

@@ -485,5 +489,6 @@ private void initGravitinoServerComponents() {

// Tag manager
this.tagManager = new TagManager(idGenerator, entityStore);
this.tagDispatcher = new TagEventDispatcher(eventBus, tagManager);
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no need to keep tagManager as a member of GravitinoEnv class?

// TODO: getTagFailureEvent
throw e;
}
return null;
Copy link
Contributor

Choose a reason for hiding this comment

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

+1, if not forwarding request, the tag request will takes no effect after this PR is merged.

@TungYuChiang
Copy link
Contributor Author

@FANNG1 All comments have been addressed, and changes have been pushed. Please take another look when convenient. Thanks for the thorough review!

@FANNG1
Copy link
Contributor

FANNG1 commented Dec 18, 2024

LGTM, @TungYuChiang do you like to add tag event in this PR or create a new PR?

Copy link
Member

@xunliu xunliu left a comment

Choose a reason for hiding this comment

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

@TungYuChiang Thank you for your contributions.
LGTM

@xunliu xunliu added the 0.8.0 Release v0.8.0 label Dec 18, 2024
@TungYuChiang
Copy link
Contributor Author

@FANNG1 I prefer create a new PR, I will open a new issue and create a few subtasks so that others can participate

@xunliu xunliu merged commit c727df5 into apache:main Dec 18, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.8.0 Release v0.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Subtask] Add event listener support for Tag system.
5 participants