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 volume property MemoryMap to MemoryMapMaxSizeMB

j.laycock5885ab67b3d1
diff --git a/weed/storage/volume.go b/weed/storage/volume.go
index 7d1a2802a4..afe3b4c8a6 100644
--- a/weed/storage/volume.go
+++ b/weed/storage/volume.go
@@ -18,14 +18,14 @@ import (
)
type Volume struct {
- Id needle.VolumeId
- dir string
- Collection string
- dataFile *os.File
- nm NeedleMapper
- needleMapKind NeedleMapType
- readOnly bool
- MemoryMapped uint32
+ Id needle.VolumeId
+ dir string
+ Collection string
+ dataFile *os.File
+ nm NeedleMapper
+ needleMapKind NeedleMapType
+ readOnly bool
+ MemoryMapMaxSizeMB uint32
SuperBlock
@@ -39,9 +39,9 @@ type Volume struct {
isCompacting bool
}
-func NewVolume(dirname string, collection string, id needle.VolumeId, needleMapKind NeedleMapType, replicaPlacement *ReplicaPlacement, ttl *needle.TTL, preallocate int64, memoryMapped uint32) (v *Volume, e error) {
+func NewVolume(dirname string, collection string, id needle.VolumeId, needleMapKind NeedleMapType, replicaPlacement *ReplicaPlacement, ttl *needle.TTL, preallocate int64, memoryMapMaxSizeMB uint32) (v *Volume, e error) {
// if replicaPlacement is nil, the superblock will be loaded from disk
- v = &Volume{dir: dirname, Collection: collection, Id: id, MemoryMapped: memoryMapped}
+ v = &Volume{dir: dirname, Collection: collection, Id: id, MemoryMapMaxSizeMB: memoryMapMaxSizeMB}
v.SuperBlock = SuperBlock{ReplicaPlacement: replicaPlacement, Ttl: ttl}
v.needleMapKind = needleMapKind
e = v.load(true, true, needleMapKind, preallocate)
diff --git a/weed/storage/volume_loading.go b/weed/storage/volume_loading.go
index bdf9984e5d..49bbcd22b3 100644
--- a/weed/storage/volume_loading.go
+++ b/weed/storage/volume_loading.go
@@ -42,7 +42,7 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
}
} else {
if createDatIfMissing {
- v.dataFile, e = createVolumeFile(fileName+".dat", preallocate, v.MemoryMapped)
+ v.dataFile, e = createVolumeFile(fileName+".dat", preallocate, v.MemoryMapMaxSizeMB)
} else {
return fmt.Errorf("Volume Data file %s.dat does not exist.", fileName)
}
diff --git a/weed/storage/volume_vacuum.go b/weed/storage/volume_vacuum.go
index 301c8bb0e0..1b47f0483a 100644
--- a/weed/storage/volume_vacuum.go
+++ b/weed/storage/volume_vacuum.go
@@ -23,7 +23,7 @@ func (v *Volume) garbageLevel() float64 {
func (v *Volume) Compact(preallocate int64, compactionBytePerSecond int64) error {
- if v.MemoryMapped > 0 { //it makes no sense to compact in memory
+ if v.MemoryMapMaxSizeMB > 0 { //it makes no sense to compact in memory
glog.V(3).Infof("Compacting volume %d ...", v.Id)
//no need to lock for copy on write
//v.accessLock.Lock()
@@ -46,7 +46,7 @@ func (v *Volume) Compact(preallocate int64, compactionBytePerSecond int64) error
func (v *Volume) Compact2() error {
- if v.MemoryMapped > 0 { //it makes no sense to compact in memory
+ if v.MemoryMapMaxSizeMB > 0 { //it makes no sense to compact in memory
glog.V(3).Infof("Compact2 volume %d ...", v.Id)
v.isCompacting = true
@@ -63,7 +63,7 @@ func (v *Volume) Compact2() error {
}
func (v *Volume) CommitCompact() error {
- if v.MemoryMapped>0 { //it makes no sense to compact in memory
+ if v.MemoryMapMaxSizeMB > 0 { //it makes no sense to compact in memory
glog.V(0).Infof("Committing volume %d vacuuming...", v.Id)
v.isCompacting = true
@@ -311,7 +311,7 @@ func (v *Volume) copyDataAndGenerateIndexFile(dstName, idxName string, prealloca
var (
dst, idx *os.File
)
- if dst, err = createVolumeFile(dstName, preallocate, v.MemoryMapped); err != nil {
+ if dst, err = createVolumeFile(dstName, preallocate, v.MemoryMapMaxSizeMB); err != nil {
return
}
defer dst.Close()