mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
refactoring
This commit is contained in:
parent
9114f7f432
commit
72a561ab7c
|
@ -25,7 +25,9 @@ func (v *Volume) garbageLevel() float64 {
|
|||
|
||||
func (v *Volume) Compact(preallocate int64, compactionBytePerSecond int64) error {
|
||||
|
||||
if v.MemoryMapMaxSizeMb == 0 { //it makes no sense to compact in memory
|
||||
if v.MemoryMapMaxSizeMb != 0 { //it makes no sense to compact in memory
|
||||
return nil
|
||||
}
|
||||
glog.V(3).Infof("Compacting volume %d ...", v.Id)
|
||||
//no need to lock for copy on write
|
||||
//v.accessLock.Lock()
|
||||
|
@ -41,14 +43,13 @@ func (v *Volume) Compact(preallocate int64, compactionBytePerSecond int64) error
|
|||
v.lastCompactRevision = v.SuperBlock.CompactionRevision
|
||||
glog.V(3).Infof("creating copies for volume %d ,last offset %d...", v.Id, v.lastCompactIndexOffset)
|
||||
return v.copyDataAndGenerateIndexFile(filePath+".cpd", filePath+".cpx", preallocate, compactionBytePerSecond)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func (v *Volume) Compact2() error {
|
||||
|
||||
if v.MemoryMapMaxSizeMb == 0 { //it makes no sense to compact in memory
|
||||
if v.MemoryMapMaxSizeMb != 0 { //it makes no sense to compact in memory
|
||||
return nil
|
||||
}
|
||||
glog.V(3).Infof("Compact2 volume %d ...", v.Id)
|
||||
|
||||
v.isCompacting = true
|
||||
|
@ -59,13 +60,12 @@ func (v *Volume) Compact2() error {
|
|||
filePath := v.FileName()
|
||||
glog.V(3).Infof("creating copies for volume %d ...", v.Id)
|
||||
return v.copyDataBasedOnIndexFile(filePath+".cpd", filePath+".cpx")
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func (v *Volume) CommitCompact() error {
|
||||
if v.MemoryMapMaxSizeMb == 0 { //it makes no sense to compact in memory
|
||||
if v.MemoryMapMaxSizeMb != 0 { //it makes no sense to compact in memory
|
||||
return nil
|
||||
}
|
||||
glog.V(0).Infof("Committing volume %d vacuuming...", v.Id)
|
||||
|
||||
v.isCompacting = true
|
||||
|
@ -116,8 +116,6 @@ func (v *Volume) CommitCompact() error {
|
|||
return e
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *Volume) cleanupCompact() error {
|
||||
glog.V(0).Infof("Cleaning up volume %d vacuuming...", v.Id)
|
||||
|
|
Loading…
Reference in a new issue