mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-04-05 20:52:50 +08:00
Merge pull request #3159 from shichanglin5/_duplicateUUID
perf: Optimized volume handling duplicateUUID logic to avoid quitting…
This commit is contained in:
commit
37da689319
@ -119,16 +119,30 @@ func (vs *VolumeServer) doHeartbeat(masterAddress pb.ServerAddress, grpcDialOpti
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if len(in.DuplicatedUuids) > 0 {
|
if len(in.DuplicatedUuids) > 0 {
|
||||||
var duplictedDir []string
|
var duplicatedDir []string
|
||||||
|
|
||||||
|
foundDuplicate := false
|
||||||
|
duplicateSet := make(map[string]struct{})
|
||||||
for _, loc := range vs.store.Locations {
|
for _, loc := range vs.store.Locations {
|
||||||
|
directoryUuid := loc.DirectoryUuid
|
||||||
|
if _, exists := duplicateSet[directoryUuid]; !exists {
|
||||||
|
duplicateSet[directoryUuid] = struct{}{}
|
||||||
|
} else {
|
||||||
|
foundDuplicate = true
|
||||||
|
}
|
||||||
|
|
||||||
for _, uuid := range in.DuplicatedUuids {
|
for _, uuid := range in.DuplicatedUuids {
|
||||||
if uuid == loc.DirectoryUuid {
|
if uuid == directoryUuid {
|
||||||
duplictedDir = append(duplictedDir, loc.Directory)
|
duplicatedDir = append(duplicatedDir, loc.Directory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glog.Errorf("Shut down Volume Server due to duplicated volume directories: %v", duplictedDir)
|
if foundDuplicate {
|
||||||
os.Exit(1)
|
glog.Errorf("Shut down Volume Server due to duplicated volume directories: %v", duplicatedDir)
|
||||||
|
os.Exit(1)
|
||||||
|
} else {
|
||||||
|
glog.Warningf("Receive response of duplicated volume directories: %v, ignored(the check found no duplicates)", duplicatedDir)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if in.GetVolumeSizeLimit() != 0 && vs.store.GetVolumeSizeLimit() != in.GetVolumeSizeLimit() {
|
if in.GetVolumeSizeLimit() != 0 && vs.store.GetVolumeSizeLimit() != in.GetVolumeSizeLimit() {
|
||||||
vs.store.SetVolumeSizeLimit(in.GetVolumeSizeLimit())
|
vs.store.SetVolumeSizeLimit(in.GetVolumeSizeLimit())
|
||||||
|
@ -293,7 +293,6 @@ func (v *Volume) collectStatus() (maxFileKey types.NeedleId, datFileSize int64,
|
|||||||
fileCount = uint64(v.nm.FileCount())
|
fileCount = uint64(v.nm.FileCount())
|
||||||
deletedCount = uint64(v.nm.DeletedCount())
|
deletedCount = uint64(v.nm.DeletedCount())
|
||||||
deletedSize = v.nm.DeletedSize()
|
deletedSize = v.nm.DeletedSize()
|
||||||
fileCount = uint64(v.nm.FileCount())
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user