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: fix a race condition during server initialization #101097

Merged
merged 1 commit into from
Apr 10, 2023
Merged
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: 7 additions & 5 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1798,6 +1798,13 @@ func (s *Server) PreStart(ctx context.Context) error {
// to bypass admission control.
s.storeGrantCoords.SetPebbleMetricsProvider(ctx, s.node, s.node)

// Connect the engines to the disk stats map constructor.
// This also needs to wait until after `waitForAdditionalStoreInit` returns,
// as the store IDs may not be known until then.
if err := s.node.registerEnginesForDiskStatsMap(s.cfg.Stores.Specs, s.engines); err != nil {
return errors.Wrapf(err, "failed to register engines for the disk stats map")
}

// Once all stores are initialized, check if offline storage recovery
// was done prior to start and record any actions appropriately.
logPendingLossOfQuorumRecoveryEvents(workersCtx, s.node.stores)
Expand Down Expand Up @@ -1938,11 +1945,6 @@ func (s *Server) PreStart(ctx context.Context) error {
}
}

// Connect the engines to the disk stats map constructor.
if err := s.node.registerEnginesForDiskStatsMap(s.cfg.Stores.Specs, s.engines); err != nil {
return errors.Wrapf(err, "failed to register engines for the disk stats map")
}

if storage.WorkloadCollectorEnabled {
if err := s.debug.RegisterWorkloadCollector(s.node.stores); err != nil {
return errors.Wrapf(err, "failed to register workload collector with debug server")
Expand Down