Skip to content

Commit

Permalink
[IMPROVED] JetStream: add file names for invalid checksums
Browse files Browse the repository at this point in the history
On restart, we report when we find error in checksums, but we
did not report the name of the file.

Signed-off-by: Ivan Kozlovic <[email protected]>
  • Loading branch information
kozlovic committed Apr 18, 2022
1 parent 12f134a commit 2659b30
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions server/jetstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -1118,11 +1118,11 @@ func (a *Account) EnableJetStream(limits map[string]JetStreamAccountLimits) erro
}
buf, err := ioutil.ReadFile(metafile)
if err != nil {
s.Warnf(" Error reading metafile %q: %v", metasum, err)
s.Warnf(" Error reading metafile %q: %v", metafile, err)
continue
}
if _, err := os.Stat(metasum); os.IsNotExist(err) {
s.Warnf(" Missing stream checksum for %q", metasum)
s.Warnf(" Missing stream checksum file %q", metasum)
continue
}
sum, err := ioutil.ReadFile(metasum)
Expand All @@ -1133,7 +1133,7 @@ func (a *Account) EnableJetStream(limits map[string]JetStreamAccountLimits) erro
hh.Write(buf)
checksum := hex.EncodeToString(hh.Sum(nil))
if checksum != string(sum) {
s.Warnf(" Stream metafile checksums do not match %q vs %q", sum, checksum)
s.Warnf(" Stream metafile %q: checksums do not match %q vs %q", metafile, sum, checksum)
continue
}

Expand All @@ -1153,7 +1153,7 @@ func (a *Account) EnableJetStream(limits map[string]JetStreamAccountLimits) erro

var cfg FileStreamInfo
if err := json.Unmarshal(buf, &cfg); err != nil {
s.Warnf(" Error unmarshalling stream metafile: %v", err)
s.Warnf(" Error unmarshalling stream metafile %q: %v", metafile, err)
continue
}

Expand Down Expand Up @@ -1221,7 +1221,7 @@ func (a *Account) EnableJetStream(limits map[string]JetStreamAccountLimits) erro
}
buf, err := ioutil.ReadFile(metafile)
if err != nil {
s.Warnf(" Error reading consumer metafile %q: %v", metasum, err)
s.Warnf(" Error reading consumer metafile %q: %v", metafile, err)
continue
}
if _, err := os.Stat(metasum); os.IsNotExist(err) {
Expand All @@ -1241,7 +1241,7 @@ func (a *Account) EnableJetStream(limits map[string]JetStreamAccountLimits) erro

var cfg FileConsumerInfo
if err := json.Unmarshal(buf, &cfg); err != nil {
s.Warnf(" Error unmarshalling consumer metafile: %v", err)
s.Warnf(" Error unmarshalling consumer metafile %q: %v", metafile, err)
continue
}
isEphemeral := !isDurableConsumer(&cfg.ConsumerConfig)
Expand All @@ -1252,7 +1252,7 @@ func (a *Account) EnableJetStream(limits map[string]JetStreamAccountLimits) erro
}
obs, err := e.mset.addConsumer(&cfg.ConsumerConfig)
if err != nil {
s.Warnf(" Error adding consumer: %v", err)
s.Warnf(" Error adding consumer %q: %v", cfg.Name, err)
continue
}
if isEphemeral {
Expand All @@ -1266,7 +1266,7 @@ func (a *Account) EnableJetStream(limits map[string]JetStreamAccountLimits) erro
err = obs.readStoredState(lseq)
obs.mu.Unlock()
if err != nil {
s.Warnf(" Error restoring consumer state: %v", err)
s.Warnf(" Error restoring consumer %q state: %v", cfg.Name, err)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion server/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -1597,7 +1597,7 @@ func (n *raft) run() {
case <-s.quitCh:
return
case <-time.After(100 * time.Millisecond):
s.RateLimitWarnf("Waiting for routing to established...")
s.RateLimitWarnf("Waiting for routing to be established...")
}
} else {
break
Expand Down

0 comments on commit 2659b30

Please sign in to comment.