Skip to content

Commit 267a2f6

Browse files
committed
Ensure that logs with ts suffix are not removed
... when mongod logs during physical restore
1 parent 97431be commit 267a2f6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pbm/restore/physical.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2604,7 +2604,7 @@ func removeAll(dir string, toIgnore []string, l log.LogEvent) error {
26042604
return errors.Wrap(err, "read file names")
26052605
}
26062606
for _, n := range names {
2607-
if n == internalMongodLog || slices.Contains(toIgnore, n) {
2607+
if isInternalMongoLog(n) || slices.Contains(toIgnore, n) {
26082608
continue
26092609
}
26102610
err = os.RemoveAll(filepath.Join(dir, n))
@@ -2616,6 +2616,12 @@ func removeAll(dir string, toIgnore []string, l log.LogEvent) error {
26162616
return nil
26172617
}
26182618

2619+
// isInternalMongoLog checks whether the file with the name f
2620+
// is internal mongo log file
2621+
func isInternalMongoLog(f string) bool {
2622+
return strings.HasPrefix(f, internalMongodLog)
2623+
}
2624+
26192625
func majmin(v string) string {
26202626
if len(v) == 0 {
26212627
return v

0 commit comments

Comments
 (0)