Ensure that Autopilot sees all nodes in KnownServers at outset (#24246)

This commit is contained in:
Nick Cabatoff
2023-12-04 09:31:16 -05:00
committed by GitHub
parent 85b3dba310
commit 31ccb2667a
2 changed files with 15 additions and 9 deletions

3
changelog/24246.txt Normal file
View File

@@ -0,0 +1,3 @@
```release-note:bug
storage/raft: Fix a race whereby a new leader may present inconsistent node data to Autopilot.
```

View File

@@ -314,14 +314,6 @@ func (c *Core) setupRaftActiveNode(ctx context.Context) error {
c.logger.Info("starting raft active node")
raftBackend.SetEffectiveSDKVersion(c.effectiveSDKVersion)
autopilotConfig, err := c.loadAutopilotConfiguration(ctx)
if err != nil {
c.logger.Error("failed to load autopilot config from storage when setting up cluster; continuing since autopilot falls back to default config", "error", err)
}
disableAutopilot := c.disableAutopilot
raftBackend.SetupAutopilot(c.activeContext, autopilotConfig, c.raftFollowerStates, disableAutopilot)
c.pendingRaftPeers = &sync.Map{}
// Reload the raft TLS keys to ensure we are using the latest version.
@@ -334,7 +326,18 @@ func (c *Core) setupRaftActiveNode(ctx context.Context) error {
if err := c.monitorUndoLogs(); err != nil {
return err
}
return c.startPeriodicRaftTLSRotate(ctx)
if err := c.startPeriodicRaftTLSRotate(ctx); err != nil {
return err
}
autopilotConfig, err := c.loadAutopilotConfiguration(ctx)
if err != nil {
c.logger.Error("failed to load autopilot config from storage when setting up cluster; continuing since autopilot falls back to default config", "error", err)
}
disableAutopilot := c.disableAutopilot
raftBackend.SetupAutopilot(c.activeContext, autopilotConfig, c.raftFollowerStates, disableAutopilot)
return nil
}
func (c *Core) stopRaftActiveNode() {