Skip to content

Commit 3cebd4e

Browse files
craig[bot]darinpp
craig[bot]
andcommitted
Merge #37168
37168: server: ensure first node status written within Server.Start() r=darinpp a=darinpp The fix ensures that the status of the first node is written before the end of `Server.Start`. Currently this is deferred and sometimes the code doesn't execute by the time the tests start running. For the rest of the nodes, the status is written as part of the node bootstrap. Fixes #33559, FIxes #36990. Release note: None Co-authored-by: Darin <[email protected]>
2 parents d3ec0c8 + 77c4222 commit 3cebd4e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

pkg/server/node.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -759,12 +759,12 @@ func (n *Node) startGraphiteStatsExporter(st *cluster.Settings) {
759759
func (n *Node) startWriteNodeStatus(frequency time.Duration) {
760760
ctx := logtags.AddTag(n.AnnotateCtx(context.Background()), "summaries", nil)
761761
// Immediately record summaries once on server startup.
762+
if err := n.writeNodeStatus(ctx, 0 /* alertTTL */); err != nil {
763+
log.Warningf(ctx, "error recording initial status summaries: %s", err)
764+
}
762765
n.stopper.RunWorker(ctx, func(ctx context.Context) {
763766
// Write a status summary immediately; this helps the UI remain
764767
// responsive when new nodes are added.
765-
if err := n.writeNodeStatus(ctx, 0 /* alertTTL */); err != nil {
766-
log.Warningf(ctx, "error recording initial status summaries: %s", err)
767-
}
768768
ticker := time.NewTicker(frequency)
769769
defer ticker.Stop()
770770
for {

pkg/server/server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,9 +1545,6 @@ func (s *Server) Start(ctx context.Context) error {
15451545
s.cfg.AmbientCtx, s.recorder, DefaultMetricsSampleInterval, ts.Resolution10s, s.stopper,
15461546
)
15471547

1548-
// Begin recording status summaries.
1549-
s.node.startWriteNodeStatus(DefaultMetricsSampleInterval)
1550-
15511548
var graphiteOnce sync.Once
15521549
graphiteEndpoint.SetOnChange(&s.st.SV, func() {
15531550
if graphiteEndpoint.Get(&s.st.SV) != "" {
@@ -1601,6 +1598,9 @@ func (s *Server) Start(ctx context.Context) error {
16011598
}
16021599
})
16031600

1601+
// Begin recording status summaries.
1602+
s.node.startWriteNodeStatus(DefaultMetricsSampleInterval)
1603+
16041604
{
16051605
var regLiveness jobs.NodeLiveness = s.nodeLiveness
16061606
if testingLiveness := s.cfg.TestingKnobs.RegistryLiveness; testingLiveness != nil {

0 commit comments

Comments
 (0)