diff options
| author | 柏杰 <2063169+bai-jie@users.noreply.github.com> | 2023-06-15 05:39:58 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-14 14:39:58 -0700 |
| commit | 0b0fb9b9e4835265abf71e0b0f384fe9bbfce3ea (patch) | |
| tree | 25ad4e2a258b03c0a8d5080ff6431de3000795e9 /weed/command/backup.go | |
| parent | 1e22d5caf2f34df5886b464f16948a294d429657 (diff) | |
| download | seaweedfs-0b0fb9b9e4835265abf71e0b0f384fe9bbfce3ea.tar.xz seaweedfs-0b0fb9b9e4835265abf71e0b0f384fe9bbfce3ea.zip | |
avoid data race read volume.IsEmpty (#4574)
* avoid data race read volume.IsEmpty
- avoid phantom read isEmpty for onlyEmpty
- use `v.DataBackend.GetStat()` in v.dataFileAccessLock scope
* add Destroy(onlyEmpty: true) test
* add Destroy(onlyEmpty: false) test
* remove unused `IsEmpty()`
* change literal `8` to `SuperBlockSize`
Diffstat (limited to 'weed/command/backup.go')
| -rw-r--r-- | weed/command/backup.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/weed/command/backup.go b/weed/command/backup.go index 58eda638e..bbb6c6724 100644 --- a/weed/command/backup.go +++ b/weed/command/backup.go @@ -137,7 +137,7 @@ func runBackup(cmd *Command, args []string) bool { if datSize > stats.TailOffset { // remove the old data - v.Destroy() + v.Destroy(false) // recreate an empty volume v, err = storage.NewVolume(util.ResolvePath(*s.dir), util.ResolvePath(*s.dir), *s.collection, vid, storage.NeedleMapInMemory, replication, ttl, 0, 0, 0) if err != nil { |
