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

ClusterID has been saved in too many places #8588

Closed
okJiang opened this issue Sep 3, 2024 · 0 comments · Fixed by #8615
Closed

ClusterID has been saved in too many places #8588

okJiang opened this issue Sep 3, 2024 · 0 comments · Fixed by #8615
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@okJiang
Copy link
Member

okJiang commented Sep 3, 2024

Enhancement Task

ClusterID is the ID which is initialized before startServer. It is initialized once during the serving.

ClusterID init

s.clusterID.Store(clusterID)

After this, all operations on ClusterID are read operations. To read it, PD passed the ClusterId layer by layer and saved it.

s.cluster = cluster.NewRaftCluster(ctx, clusterID, s.GetBasicCluster(), s.GetStorage(), syncer.NewRegionSyncer(s), s.client, s.httpClient)

s.keyspaceGroupManager = keyspace.NewKeyspaceGroupManager(s.ctx, s.storage, s.client, clusterID)

s.hbStreams = hbstream.NewHeartbeatStreams(ctx, clusterID, "", s.cluster)

m.clusterID = srv.(T).ClusterID()

clusterID: clusterID,

clusterID: clusterID,

Strongly related to the ClusterID is the rootPath field, which is also passed and stored hierarchically.

s.rootPath = endpoint.PDRootPath(clusterID)

For ClusterID, a better way is to use a global variable so that we can clearly know where it was modified and where it was used.

@okJiang okJiang added the type/enhancement The issue or PR belongs to an enhancement. label Sep 3, 2024
@ti-chi-bot ti-chi-bot bot closed this as completed in e257097 Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant