mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
rename volume property MemoryMap to MemoryMapMaxSizeMB
This commit is contained in:
parent
5a6dfb05fc
commit
5885ab67b3
|
@ -25,7 +25,7 @@ type Volume struct {
|
|||
nm NeedleMapper
|
||||
needleMapKind NeedleMapType
|
||||
readOnly bool
|
||||
MemoryMapped uint32
|
||||
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)
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue