Skip to content

Commit

Permalink
Disable jetstream if disk permission error while writing raft state
Browse files Browse the repository at this point in the history
  • Loading branch information
souravagrawal committed Jan 7, 2025
1 parent 0b14aac commit d5d8b82
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions server/jetstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -3034,3 +3034,14 @@ func fixCfgMirrorWithDedupWindow(cfg *StreamConfig) {
cfg.Duplicates = 0
}
}

func (s *Server) handleWritePermissionError() {
//TODO Check if we should add s.jetStreamOOSPending in condition
if s.JetStreamEnabled() {
s.Errorf("file system permission denied while writing, disabling jetstream")

go s.DisableJetStream()

//TODO Send respective advisory if needed, same as in handleOutOfSpace
}
}
4 changes: 4 additions & 0 deletions server/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -3978,6 +3978,10 @@ func (n *raft) setWriteErrLocked(err error) {
n.error("Critical write error: %v", err)
n.werr = err

if os.IsPermission(err) {
go n.s.handleWritePermissionError()
}

if isOutOfSpaceErr(err) {
// For now since this can be happening all under the covers, we will call up and disable JetStream.
go n.s.handleOutOfSpace(nil)
Expand Down

0 comments on commit d5d8b82

Please sign in to comment.