1
0
Fork 0
mirror of https://github.com/chrislusf/seaweedfs synced 2024-07-02 07:06:44 +02:00
This commit is contained in:
Chris Lu 2019-06-04 22:04:10 -07:00
parent 2215e81be7
commit ca8a2bb534
5 changed files with 7 additions and 7 deletions

View file

@ -204,7 +204,7 @@ func (vs *VolumeServer) CopyFile(req *volume_server_pb.CopyFileRequest, stream v
baseFileName := erasure_coding.EcShardBaseFileName(req.Collection, int(req.VolumeId)) + req.Ext baseFileName := erasure_coding.EcShardBaseFileName(req.Collection, int(req.VolumeId)) + req.Ext
for _, location := range vs.store.Locations { for _, location := range vs.store.Locations {
tName := path.Join(location.Directory, baseFileName) tName := path.Join(location.Directory, baseFileName)
if util.FileExists(tName){ if util.FileExists(tName) {
fileName = tName fileName = tName
} }
} }

View file

@ -34,7 +34,7 @@ func (l *DiskLocation) DestroyEcVolume(vid needle.VolumeId) {
ecVolume, found := l.ecVolumes[vid] ecVolume, found := l.ecVolumes[vid]
if found { if found {
ecVolume.Destroy() ecVolume.Destroy()
delete(l.ecVolumes,vid) delete(l.ecVolumes, vid)
} }
} }

View file

@ -64,7 +64,7 @@ func EcShardFileName(collection string, dir string, id int) (fileName string) {
func EcShardBaseFileName(collection string, id int) (baseFileName string) { func EcShardBaseFileName(collection string, id int) (baseFileName string) {
baseFileName = strconv.Itoa(id) baseFileName = strconv.Itoa(id)
if collection != "" { if collection != "" {
baseFileName = collection+"_"+baseFileName baseFileName = collection + "_" + baseFileName
} }
return return
} }

View file

@ -221,11 +221,11 @@ func (s *Store) cachedLookupEcShardLocations(ctx context.Context, ecVolume *eras
shardCount := len(ecVolume.ShardLocations) shardCount := len(ecVolume.ShardLocations)
if shardCount < erasure_coding.DataShardsCount && if shardCount < erasure_coding.DataShardsCount &&
ecVolume.ShardLocationsRefreshTime.Add(11 * time.Second).After(time.Now()) || ecVolume.ShardLocationsRefreshTime.Add(11*time.Second).After(time.Now()) ||
shardCount == erasure_coding.TotalShardsCount && shardCount == erasure_coding.TotalShardsCount &&
ecVolume.ShardLocationsRefreshTime.Add(37 * time.Minute).After(time.Now()) || ecVolume.ShardLocationsRefreshTime.Add(37*time.Minute).After(time.Now()) ||
shardCount >= erasure_coding.DataShardsCount && shardCount >= erasure_coding.DataShardsCount &&
ecVolume.ShardLocationsRefreshTime.Add(7 * time.Minute).After(time.Now()) { ecVolume.ShardLocationsRefreshTime.Add(7*time.Minute).After(time.Now()) {
// still fresh // still fresh
return nil return nil
} }

View file

@ -139,7 +139,7 @@ func (t *Topology) ListEcServersByCollection(collection string) (dataNodes []str
dateNodeMap := make(map[string]bool) dateNodeMap := make(map[string]bool)
for _, ecVolumeLocation := range t.ecShardMap { for _, ecVolumeLocation := range t.ecShardMap {
if ecVolumeLocation.Collection == collection { if ecVolumeLocation.Collection == collection {
for _, locations := range ecVolumeLocation.Locations{ for _, locations := range ecVolumeLocation.Locations {
for _, loc := range locations { for _, loc := range locations {
dateNodeMap[string(loc.Id())] = true dateNodeMap[string(loc.Id())] = true
} }