diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2025-12-09 19:03:15 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-09 19:03:15 -0800 |
| commit | 1b13324fb79a8dcbc00044b90c357c41c2cc70c7 (patch) | |
| tree | 0270ea29eb43d014cdc31c43fc868f542194094b /weed/filer/filer_notify.go | |
| parent | 4f382b77c898b9685e16a49048681bb73d07ee54 (diff) | |
| download | seaweedfs-1b13324fb79a8dcbc00044b90c357c41c2cc70c7.tar.xz seaweedfs-1b13324fb79a8dcbc00044b90c357c41c2cc70c7.zip | |
fix: skip log files with deleted volumes in filer backup (#7692)
fix: skip log files with deleted volumes in filer backup (#3720)
When filer.backup or filer.meta.backup resumes after being stopped, it may
encounter persisted log files stored on volumes that have since been deleted
(via volume.deleteEmpty -force). Previously, this caused the backup to get
stuck in an infinite retry loop with 'volume X not found' errors.
This fix catches 'volume not found' errors when reading log files and skips
the problematic file instead of failing. The backup will now:
- Log a warning about the missing volume
- Skip the problematic log file
- Continue with the next log file, allowing progress
The VolumeNotFoundPattern regex was already defined but never used - this
change puts it to use.
Fixes #3720
Diffstat (limited to 'weed/filer/filer_notify.go')
| -rw-r--r-- | weed/filer/filer_notify.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/weed/filer/filer_notify.go b/weed/filer/filer_notify.go index 45c9b070f..6fd595f87 100644 --- a/weed/filer/filer_notify.go +++ b/weed/filer/filer_notify.go @@ -152,9 +152,21 @@ func (f *Filer) logFlushFunc(logBuffer *log_buffer.LogBuffer, startTime, stopTim } var ( - VolumeNotFoundPattern = regexp.MustCompile(`volume \d+? not found`) + volumeNotFoundPattern = regexp.MustCompile(`volume \d+? not found`) + chunkNotFoundPattern = regexp.MustCompile(`(urls not found|File Not Found)`) ) +// isChunkNotFoundError checks if the error indicates that a volume or chunk +// has been deleted and is no longer available. These errors can be skipped +// when reading persisted log files since the data is unrecoverable. +func isChunkNotFoundError(err error) bool { + if err == nil { + return false + } + errMsg := err.Error() + return volumeNotFoundPattern.MatchString(errMsg) || chunkNotFoundPattern.MatchString(errMsg) +} + func (f *Filer) ReadPersistedLogBuffer(startPosition log_buffer.MessagePosition, stopTsNs int64, eachLogEntryFn log_buffer.EachLogEntryFuncType) (lastTsNs int64, isDone bool, err error) { visitor, visitErr := f.collectPersistedLogBuffer(startPosition, stopTsNs) |
