Fix raft log debug reloading (#4047)

Fixes being able to reload debug logging for running raft groups.
This commit is contained in:
Waldemar Quevedo
2023-04-13 16:21:53 -07:00
committed by GitHub
2 changed files with 3 additions and 4 deletions

View File

@@ -563,11 +563,10 @@ func (s *Server) lookupRaftNode(group string) RaftNode {
return n
}
func (s *Server) reloadDebugRaftNodes() {
func (s *Server) reloadDebugRaftNodes(debug bool) {
if s == nil {
return
}
debug := atomic.LoadInt32(&s.logging.debug) > 0
s.rnMu.RLock()
for _, ni := range s.raftNodes {
n := ni.(*raft)

View File

@@ -1,4 +1,4 @@
// Copyright 2017-2022 The NATS Authors
// Copyright 2017-2023 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
@@ -148,7 +148,7 @@ type debugOption struct {
// However we will kick the raft nodes if they exist to reload.
func (d *debugOption) Apply(server *Server) {
server.Noticef("Reloaded: debug = %v", d.newValue)
server.reloadDebugRaftNodes()
server.reloadDebugRaftNodes(d.newValue)
}
// logtimeOption implements the option interface for the `logtime` setting.