Skip to content

Commit

Permalink
Backport of replication: fix potential panic during upgrades into rel…
Browse files Browse the repository at this point in the history
…ease/1.5.x (#17493)

This pull request was automerged via backport-assistant
  • Loading branch information
hc-github-team-nomad-core authored and tgross committed Jun 12, 2023
1 parent e94463a commit f3a0602
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/17476.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
replication: Fix a potential panic when a non-authoritative region is upgraded and a server with the new version becomes the leader.
```
11 changes: 11 additions & 0 deletions nomad/leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -1830,6 +1830,17 @@ func (s *Server) replicateACLRoles(stopCh chan struct{}) {
// parameters are controlled internally.
_ = limiter.Wait(context.Background())

if !ServersMeetMinimumVersion(
s.serf.Members(), s.Region(), minACLRoleVersion, true) {
s.logger.Trace(
"all servers must be upgraded to 1.4.0 or later before ACL Roles can be replicated")
if s.replicationBackoffContinue(stopCh) {
continue
} else {
return
}
}

// Set the replication token on each replication iteration so that
// it is always current and can handle agent SIGHUP reloads.
req.AuthToken = s.ReplicationToken()
Expand Down

0 comments on commit f3a0602

Please sign in to comment.