Browse Source

smaller critical section

pull/1683/head
chenqieqie 4 years ago
parent
commit
45f902a9b7
  1. 10
      weed/storage/disk_location.go

10
weed/storage/disk_location.go

@ -104,19 +104,19 @@ func (l *DiskLocation) loadExistingVolume(fileInfo os.FileInfo, needleMapKind Ne
l.volumesLock.Unlock() l.volumesLock.Unlock()
glog.V(1).Infof("loaded volume, %v", vid) glog.V(1).Infof("loaded volume, %v", vid)
return true return true
} else {
l.volumes[vid] = nil
l.volumesLock.Unlock()
} }
// load the volume // load the volume
v, e := NewVolume(l.Directory, l.IdxDirectory, collection, vid, needleMapKind, nil, nil, 0, 0) v, e := NewVolume(l.Directory, l.IdxDirectory, collection, vid, needleMapKind, nil, nil, 0, 0)
if e != nil { if e != nil {
l.volumesLock.Unlock()
glog.V(0).Infof("new volume %s error %s", volumeName, e) glog.V(0).Infof("new volume %s error %s", volumeName, e)
return false return false
} }
l.volumes[vid] = v
v.location = l
l.volumesLock.Unlock()
l.SetVolume(vid, v)
size, _, _ := v.FileStat() size, _, _ := v.FileStat()
glog.V(0).Infof("data file %s, replicaPlacement=%s v=%d size=%d ttl=%s", glog.V(0).Infof("data file %s, replicaPlacement=%s v=%d size=%d ttl=%s",

Loading…
Cancel
Save