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

[server] Add the leader of bucket to metadata cache #386

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

luoyuxia
Copy link
Collaborator

@luoyuxia luoyuxia commented Feb 12, 2025

Purpose

Linked issue: close #386
Currnetly, to know the leader of a TableBucket, we always need to get from zk..When the buckets increase, it will cost too many time which will cause the job fail to startup just like the issue describes

In this pr, we only add the leader of a TableBucket to metadata for simplicity, maybe in the future, we can add more to metadata cache.

  1. In ServerMetadataCache, cache the mapping from tableBucket to leader
  2. Modify UpdateMetadataRequest in rpc proto to add PbTableBucketMetadata, deleted_table_id, `deleted_partition_id.
  3. When the leader of any bucket changes, coordinator sends UpdateMetadataRequest with the updated leader in PbTableBucketMetadata to tablet servers, then tablet servers can update their own cache.
  4. When table/partition is dropped, coordinator sends UpdateMetadataRequest with deleted_table_id/deleted_partition_id to tablet servers, then tablet servers can remove these tables from their own cache

Tests

ServerMetadataCacheImplTest to verify the ServerMetadataCache works as expected.
MetadataUpdateITCase to verify when table created, bucket leader changed, server down/up, the cache is as expected.

API and Format

N/A

Documentation

N/A

@luoyuxia luoyuxia force-pushed the add-metadata-cache-final branch 3 times, most recently from 20fbae3 to c6aca6e Compare February 12, 2025 12:10
@luoyuxia luoyuxia marked this pull request as ready for review February 13, 2025 02:41
@luoyuxia luoyuxia force-pushed the add-metadata-cache-final branch 4 times, most recently from 96ba9ea to 8432333 Compare February 13, 2025 08:23
@luoyuxia luoyuxia force-pushed the add-metadata-cache-final branch from 8432333 to 07bfb61 Compare February 13, 2025 11:55
@luoyuxia luoyuxia changed the title add metadata cache [server] Add the leader of bucket to metadata cache Feb 13, 2025
@luoyuxia
Copy link
Collaborator Author

@wuchong Add the leader of bucket to metadata cache to avoid get table metadata cost too much time.. Pr ready

@@ -130,7 +129,7 @@ void beforeEach() throws Exception {
} catch (CatalogException e) {
// the auto partitioned manager may create the db zk node
// in an another thread, so if exception is NodeExistsException, just ignore
if (!ExceptionUtils.findThrowable(e, KeeperException.NodeExistsException.class)
if (!ExceptionUtils.findThrowableWithMessage(e, "KeeperException$NodeExistsException")
Copy link
Member

Choose a reason for hiding this comment

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

Could you extract this into a separate hotfix pull request? This seems quite unstable in these days. https://github.com/alibaba/fluss/actions/runs/13626469089/job/38084662575

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