weed volume: disable block cache on leveldb

saving 8MB for each volume, but at the cost of slower lookup
This commit is contained in:
Chris Lu 2019-04-09 00:24:32 -07:00
parent 35aba35c07
commit 9924fa3b1a

View file

@ -2,6 +2,7 @@ package storage
import ( import (
"fmt" "fmt"
"github.com/syndtr/goleveldb/leveldb/opt"
"os" "os"
"path/filepath" "path/filepath"
@ -27,7 +28,9 @@ func NewLevelDbNeedleMap(dbFileName string, indexFile *os.File) (m *LevelDbNeedl
glog.V(0).Infof("Finished Generating %s from %s", dbFileName, indexFile.Name()) glog.V(0).Infof("Finished Generating %s from %s", dbFileName, indexFile.Name())
} }
glog.V(1).Infof("Opening %s...", dbFileName) glog.V(1).Infof("Opening %s...", dbFileName)
if m.db, err = leveldb.OpenFile(dbFileName, nil); err != nil { if m.db, err = leveldb.OpenFile(dbFileName, &opt.Options{
BlockCacheCapacity: -1, // default value is 8MiB
}); err != nil {
return return
} }
glog.V(1).Infof("Loading %s...", indexFile.Name()) glog.V(1).Infof("Loading %s...", indexFile.Name())