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

[AMORO-3393]: A stateless catalog manager implement #3394

Merged
merged 11 commits into from
Jan 10, 2025

Conversation

baiyangtx
Copy link
Contributor

Why are the changes needed?

Close #3393.

This is a subtask to implement a stateless RESTController.

Brief change log

  • Rename the CatalogService interface to CatalogManager, indicating that the interface provides stateless services.
  • Provide a stateless implementation called DefaultCatalogManager.
  • The TableService interface will no longer inherit from CatalogManager.

How was this patch tested?

  • Add some test cases that check the changes thoroughly including negative and positive cases if possible

  • Add screenshots for manual tests if appropriate

  • Run test locally before making a pull request

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

@baiyangtx baiyangtx requested review from zhoujinsong and klion26 and removed request for zhoujinsong January 3, 2025 09:11
@github-actions github-actions bot added the module:ams-server Ams server module label Jan 3, 2025
Copy link
Contributor

@zhoujinsong zhoujinsong left a comment

Choose a reason for hiding this comment

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

@baiyangtx
Thanks for the contribution!
The PR looks good to me in general.

But I have a concern about the performance, you may want to check.


@Override
public List<ExternalCatalog> getExternalCatalogs() {
return listCatalogMetas().stream()
Copy link
Contributor

Choose a reason for hiding this comment

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

We can improve the performance of this method by reducing some database calls.
Now it will select all the catalog metadata and then select each one of them individually, which should be improved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed


@Override
public ServerCatalog getServerCatalog(String catalogName) {
Optional<CatalogMeta> catalogMeta = getCatalogMetaOptional(catalogName);
Copy link
Contributor

Choose a reason for hiding this comment

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

Catalog metadata changes are infrequent. Should we control the minimum query interval to avoid accessing the database too frequently?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cache will lead to consistency issues, and unit tests will also fail.

I have optimized this part, and now each call only accesses the database once.

Copy link
Contributor

@zhoujinsong zhoujinsong 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 the contribution!

zhangyongxiang.alpha added 2 commits January 10, 2025 14:05
@baiyangtx baiyangtx merged commit 417fed6 into apache:master Jan 10, 2025
4 checks passed
zhoujinsong pushed a commit to zhoujinsong/amoro that referenced this pull request Jan 21, 2025
* stateless catalog manager

* stateless catalog manager

* ci

* ci

* improve db access

* add catalog meta cache

* add catalog meta cache

* ut

* ut

---------

Co-authored-by: zhangyongxiang.alpha <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Subtask]: A stateless CatalogManager implement.
2 participants