aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--weed/storage/volume.go20
-rw-r--r--weed/storage/volume_loading.go2
-rw-r--r--weed/storage/volume_vacuum.go8
3 files changed, 15 insertions, 15 deletions
diff --git a/weed/storage/volume.go b/weed/storage/volume.go
index 7d1a2802a..afe3b4c8a 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 bdf9984e5..49bbcd22b 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 301c8bb0e..1b47f0483 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()