Skip to content

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 klion26 and zhoujinsong 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]>
@baiyangtx baiyangtx deleted the stateless-catalog-manager branch August 4, 2025 15:13
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