Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

rename UUID file fix typo move locationUUID into DiskLocation

guol-fnst8fab39e775bd
diff --git a/weed/server/master_grpc_server.go b/weed/server/master_grpc_server.go
index b2ac4e700e..ce6967ed76 100644
--- a/weed/server/master_grpc_server.go
+++ b/weed/server/master_grpc_server.go
@@ -36,7 +36,7 @@ func (ms *MasterServer) RegisterUUIDs(heartbeat *master_pb.Heartbeat) error {
index := sort.SearchStrings(v, id)
if index < len(v) && v[index] == id {
glog.Error("directory of ", id, " on ", k, " has been loaded")
- return errors.New("volume: Duplicated volume directory was been loaded")
+ return errors.New("volume: Duplicated volume directories were loaded")
}
}
}
diff --git a/weed/storage/disk_location.go b/weed/storage/disk_location.go
index ae2a36296b..e6d61c6bbd 100644
--- a/weed/storage/disk_location.go
+++ b/weed/storage/disk_location.go
@@ -19,6 +19,7 @@ import (
type DiskLocation struct {
Directory string
+ DirectoryUUID string
IdxDirectory string
DiskType types.DiskType
MaxVolumeCount int
@@ -37,7 +38,7 @@ type DiskLocation struct {
func GenerateDirUUID(dir string) (dirUUIDString string, err error) {
glog.V(1).Infof("Getting UUID of volume directory:%s", dir)
dirUUIDString = ""
- fileName := dir + "/volume.uuid"
+ fileName := dir + "/vol_dir.uuid"
if !util.FileExists(fileName) {
dirUUID, _ := uuid.NewRandom()
dirUUIDString = dirUUID.String()
@@ -64,8 +65,10 @@ func NewDiskLocation(dir string, maxVolumeCount int, minFreeSpace util.MinFreeSp
} else {
idxDir = util.ResolvePath(idxDir)
}
+ dirUUID, _ := GenerateDirUUID(dir)
location := &DiskLocation{
Directory: dir,
+ DirectoryUUID: dirUUID,
IdxDirectory: idxDir,
DiskType: diskType,
MaxVolumeCount: maxVolumeCount,
diff --git a/weed/storage/store.go b/weed/storage/store.go
index 2df0aee831..2d37468b85 100644
--- a/weed/storage/store.go
+++ b/weed/storage/store.go
@@ -41,7 +41,6 @@ type Store struct {
GrpcPort int
PublicUrl string
Locations []*DiskLocation
- LocationUUIDs []string
dataCenter string // optional informaton, overwriting master setting if exists
rack string // optional information, overwriting master setting if exists
connected bool
@@ -66,8 +65,6 @@ func NewStore(grpcDialOption grpc.DialOption, ip string, port int, grpcPort int,
location := NewDiskLocation(dirnames[i], maxVolumeCounts[i], minFreeSpaces[i], idxFolder, diskTypes[i])
location.loadExistingVolumes(needleMapKind)
s.Locations = append(s.Locations, location)
- dirUUID, _ := GenerateDirUUID(dirnames[i])
- s.LocationUUIDs = append(s.LocationUUIDs, dirUUID)
stats.VolumeServerMaxVolumeCounter.Add(float64(maxVolumeCounts[i]))
}
s.NewVolumesChan = make(chan master_pb.VolumeShortInformationMessage, 3)
@@ -305,8 +302,8 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
}
var UUIDList []string
- for _, locationUUID := range s.LocationUUIDs {
- UUIDList = append(UUIDList, locationUUID)
+ for _, loc := range s.Locations {
+ UUIDList = append(UUIDList, loc.DirectoryUUID)
}
for col, size := range collectionVolumeSize {