Skip to content

Commit

Permalink
server: call ReadyFn in secondary tenant servers
Browse files Browse the repository at this point in the history
Release note: None
  • Loading branch information
knz committed Oct 26, 2022
1 parent a6fe3df commit 3904270
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkg/server/tenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,17 @@ func (s *SQLServerWrapper) PreStart(ctx context.Context) error {
// in _every_ store directory? Not just the first one?
}

// Set up calling s.cfg.ReadyFn at the right time. Essentially, this call
// determines when `./cockroach [...] --background` returns.
var onSuccessfulReturnFn func()
{
readyFn := func(bool) {}
if s.sqlServer.cfg.ReadyFn != nil {
readyFn = s.sqlServer.cfg.ReadyFn
}
onSuccessfulReturnFn = func() { readyFn(false /* waitForInit */) }
}

// This opens the main listener.
startRPCServer(workersCtx)

Expand All @@ -416,6 +427,9 @@ func (s *SQLServerWrapper) PreStart(ctx context.Context) error {
// TODO(tbg): clarify the contract here and move closer to usage if possible.
orphanedLeasesTimeThresholdNanos := s.clock.Now().WallTime

// Signal server readiness to the caller.
onSuccessfulReturnFn()

// Configure the Sentry reporter to add some additional context to reports.
//
// NB: In (*Server).PreStart(), we can also configure the cluster ID
Expand Down

0 comments on commit 3904270

Please sign in to comment.