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

cluster: load region before leader campaign #8705

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions server/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,18 +653,6 @@ func (c *RaftCluster) LoadClusterInfo() (*RaftCluster, error) {
zap.Int("count", c.GetStoreCount()),
zap.Duration("cost", time.Since(start)),
)

start = time.Now()

// used to load region from kv storage to cache storage.
if err = storage.TryLoadRegionsOnce(c.ctx, c.storage, c.CheckAndPutRegion); err != nil {
return nil, err
}
log.Info("load regions",
zap.Int("count", c.GetTotalRegionCount()),
zap.Duration("cost", time.Since(start)),
)

return c, nil
}

Expand Down
10 changes: 10 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,16 @@ func (s *Server) startServer(ctx context.Context) error {
s.gcSafePointManager = gc.NewSafePointManager(s.storage, s.cfg.PDServerCfg)
s.basicCluster = core.NewBasicCluster()
s.cluster = cluster.NewRaftCluster(ctx, clusterID, s.GetBasicCluster(), s.GetStorage(), syncer.NewRegionSyncer(s), s.client, s.httpClient)
// used to load region from kv storage to cache storage.
start := time.Now()
if err = storage.TryLoadRegionsOnce(ctx, s.GetStorage(), s.cluster.CheckAndPutRegion); err != nil {
return err
}
log.Info("load regions",
zap.Int("count", s.cluster.GetTotalRegionCount()),
zap.Duration("cost", time.Since(start)),
)

keyspaceIDAllocator := id.NewAllocator(&id.AllocatorParams{
Client: s.client,
RootPath: s.rootPath,
Expand Down
Loading