Skip to content

Commit

Permalink
server: avoid Fatal when draining early
Browse files Browse the repository at this point in the history
  • Loading branch information
tbg committed Oct 26, 2017
1 parent c884b47 commit 1d38bf4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,13 @@ If problems persist, please see ` + base.DocsURL("cluster-setup-troubleshooting.
migMgr := migrations.NewManager(
s.stopper, s.db, s.sqlExecutor, s.clock, &s.internalMemMetrics, s.NodeID().String())
if err := migMgr.EnsureMigrations(ctx); err != nil {
log.Fatal(ctx, err)
select {
case <-s.stopper.ShouldQuiesce():
// Avoid turning an early shutdown into a fatal error. See #19579.
return errors.New("server is shutting down")
default:
log.Fatal(ctx, err)
}
}
log.Infof(ctx, "done ensuring all necessary migrations have run")
close(serveSQL)
Expand Down

0 comments on commit 1d38bf4

Please sign in to comment.