mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-11-24 16:53:14 +08:00
faster loading boltdb or leveldb needle map metrics by bloomfilter
avoid btree
This commit is contained in:
@@ -84,46 +84,3 @@ func (nm *baseNeedleMapper) IndexFileContent() ([]byte, error) {
|
||||
defer nm.indexFileAccessLock.Unlock()
|
||||
return ioutil.ReadFile(nm.indexFile.Name())
|
||||
}
|
||||
|
||||
type mapMetric struct {
|
||||
indexFile *os.File
|
||||
|
||||
DeletionCounter int `json:"DeletionCounter"`
|
||||
FileCounter int `json:"FileCounter"`
|
||||
DeletionByteCounter uint64 `json:"DeletionByteCounter"`
|
||||
FileByteCounter uint64 `json:"FileByteCounter"`
|
||||
MaximumFileKey uint64 `json:"MaxFileKey"`
|
||||
}
|
||||
|
||||
func (mm *mapMetric) logDelete(deletedByteCount uint32) {
|
||||
mm.DeletionByteCounter = mm.DeletionByteCounter + uint64(deletedByteCount)
|
||||
mm.DeletionCounter++
|
||||
}
|
||||
|
||||
func (mm *mapMetric) logPut(key uint64, oldSize uint32, newSize uint32) {
|
||||
if key > mm.MaximumFileKey {
|
||||
mm.MaximumFileKey = key
|
||||
}
|
||||
mm.FileCounter++
|
||||
mm.FileByteCounter = mm.FileByteCounter + uint64(newSize)
|
||||
if oldSize > 0 {
|
||||
mm.DeletionCounter++
|
||||
mm.DeletionByteCounter = mm.DeletionByteCounter + uint64(oldSize)
|
||||
}
|
||||
}
|
||||
|
||||
func (mm mapMetric) ContentSize() uint64 {
|
||||
return mm.FileByteCounter
|
||||
}
|
||||
func (mm mapMetric) DeletedSize() uint64 {
|
||||
return mm.DeletionByteCounter
|
||||
}
|
||||
func (mm mapMetric) FileCount() int {
|
||||
return mm.FileCounter
|
||||
}
|
||||
func (mm mapMetric) DeletedCount() int {
|
||||
return mm.DeletionCounter
|
||||
}
|
||||
func (mm mapMetric) MaxFileKey() uint64 {
|
||||
return mm.MaximumFileKey
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user