Skip to content

Commit

Permalink
[IMPROVED] Move reallocation warnings on psim to debug. (#5085)
Browse files Browse the repository at this point in the history
They should not happen, but it is possible and not actionable by
operators, so debug is better.

Signed-off-by: Derek Collison <derek@nats.io>
  • Loading branch information
derekcollison committed Feb 14, 2024
2 parents e4ee17e + 65dd44d commit 4ea35d7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion server/filestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,16 @@ func (fs *fileStore) warn(format string, args ...any) {
fs.srv.Warnf(fmt.Sprintf("Filestore [%s] %s", fs.cfg.Name, format), args...)
}

// For doing debug logging.
// Lock should be held.
func (fs *fileStore) debug(format string, args ...any) {
// No-op if no server configured.
if fs.srv == nil {
return
}
fs.srv.Debugf(fmt.Sprintf("Filestore [%s] %s", fs.cfg.Name, format), args...)
}

// Track local state but ignore timestamps here.
func updateTrackingState(state *StreamState, mb *msgBlock) {
if state.FirstSeq == 0 {
Expand Down Expand Up @@ -7542,7 +7552,7 @@ func (fs *fileStore) writeFullState() error {
}

if cap(buf) > sz {
fs.warn("WriteFullState reallocated from %d to %d", sz, cap(buf))
fs.debug("WriteFullState reallocated from %d to %d", sz, cap(buf))
}

// Write to a tmp file and rename.
Expand Down

0 comments on commit 4ea35d7

Please sign in to comment.