[server] Add the leader of bucket to metadata cache #386
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
ServerMetadataCache
, cache the mapping fromtableBucket
toleader
UpdateMetadataRequest
in rpc proto to addPbTableBucketMetadata
,deleted_table_id
, `deleted_partition_id.UpdateMetadataRequest
with the updated leader inPbTableBucketMetadata
to tablet servers, then tablet servers can update their own cache.UpdateMetadataRequest
withdeleted_table_id
/deleted_partition_id
to tablet servers, then tablet servers can remove these tables from their own cacheTests
ServerMetadataCacheImplTest
to verify theServerMetadataCache
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