Skip to content

Commit

Permalink
We no longer force remove our peer on out of space.
Browse files Browse the repository at this point in the history
We also delay restarting JetStream to make sure accounts are enabled.

Signed-off-by: Derek Collison <derek@nats.io>
  • Loading branch information
derekcollison committed Mar 15, 2021
1 parent a205f8f commit e530c98
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
2 changes: 0 additions & 2 deletions server/jetstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,6 @@ func (s *Server) DisableJetStream() error {
s.Warnf("JetStream timeout waiting for meta leader transfer")
}
}
// Once here we can forward our proposal to remove ourselves.
meta.ProposeRemovePeer(meta.ID())
meta.Delete()
}
}
Expand Down
26 changes: 18 additions & 8 deletions server/reload.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,14 +553,7 @@ type jetStreamOption struct {
}

func (a *jetStreamOption) Apply(s *Server) {
s.Noticef("Reloaded: jetstream")
if !a.newValue {
s.DisableJetStream()
} else if !s.JetStreamEnabled() {
if err := s.restartJetStream(); err != nil {
s.Warnf("Can't start JetStream: %v", err)
}
}
s.Noticef("Reloaded: JetStream")
}

func (jso jetStreamOption) IsJetStreamChange() bool {
Expand Down Expand Up @@ -1193,6 +1186,8 @@ func (s *Server) applyOptions(ctx *reloadContext, opts []option) {
reloadAuth = false
reloadClusterPerms = false
reloadClientTrcLvl = false
reloadJetstream = false
jsEnabled = false
)
for _, opt := range opts {
opt.Apply(s)
Expand All @@ -1208,6 +1203,10 @@ func (s *Server) applyOptions(ctx *reloadContext, opts []option) {
if opt.IsClusterPermsChange() {
reloadClusterPerms = true
}
if opt.IsJetStreamChange() {
reloadJetstream = true
jsEnabled = opt.(*jetStreamOption).newValue
}
}

if reloadLogging {
Expand All @@ -1222,6 +1221,17 @@ func (s *Server) applyOptions(ctx *reloadContext, opts []option) {
if reloadClusterPerms {
s.reloadClusterPermissions(ctx.oldClusterPerms)
}

if reloadJetstream {
if !jsEnabled {
s.DisableJetStream()
} else if !s.JetStreamEnabled() {
if err := s.restartJetStream(); err != nil {
s.Warnf("Can't start JetStream: %v", err)
}
}
}

// For remote gateways and leafnodes, make sure that their TLS configuration
// is updated (since the config is "captured" early and changes would otherwise
// not be visible).
Expand Down

0 comments on commit e530c98

Please sign in to comment.