aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/disk_location.go
diff options
context:
space:
mode:
authorchenqieqie <chenqieqie@gmail.com>2020-12-16 20:23:51 +0800
committerchenqieqie <chenqieqie@gmail.com>2020-12-16 20:23:51 +0800
commit45f902a9b7abf907b31f43bb88d2b15e420cbac5 (patch)
tree57bdc8bf85286c0aab2fb4a33eeca946c2c8eefc /weed/storage/disk_location.go
parent4e58a4f24e6fe489b890c82d08e98a30b0bbc076 (diff)
downloadseaweedfs-45f902a9b7abf907b31f43bb88d2b15e420cbac5.tar.xz
seaweedfs-45f902a9b7abf907b31f43bb88d2b15e420cbac5.zip
smaller critical section
Diffstat (limited to 'weed/storage/disk_location.go')
-rw-r--r--weed/storage/disk_location.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/weed/storage/disk_location.go b/weed/storage/disk_location.go
index 73d9d8111..359d0cec2 100644
--- a/weed/storage/disk_location.go
+++ b/weed/storage/disk_location.go
@@ -104,19 +104,19 @@ func (l *DiskLocation) loadExistingVolume(fileInfo os.FileInfo, needleMapKind Ne
l.volumesLock.Unlock()
glog.V(1).Infof("loaded volume, %v", vid)
return true
+ } else {
+ l.volumes[vid] = nil
+ l.volumesLock.Unlock()
}
// load the volume
v, e := NewVolume(l.Directory, l.IdxDirectory, collection, vid, needleMapKind, nil, nil, 0, 0)
if e != nil {
- l.volumesLock.Unlock()
glog.V(0).Infof("new volume %s error %s", volumeName, e)
return false
}
-
- l.volumes[vid] = v
- v.location = l
- l.volumesLock.Unlock()
+
+ l.SetVolume(vid, v)
size, _, _ := v.FileStat()
glog.V(0).Infof("data file %s, replicaPlacement=%s v=%d size=%d ttl=%s",