|
@ -5,15 +5,17 @@ import ( |
|
|
"context" |
|
|
"context" |
|
|
"crypto/md5" |
|
|
"crypto/md5" |
|
|
"fmt" |
|
|
"fmt" |
|
|
"github.com/syndtr/goleveldb/leveldb" |
|
|
|
|
|
leveldb_errors "github.com/syndtr/goleveldb/leveldb/errors" |
|
|
|
|
|
"github.com/syndtr/goleveldb/leveldb/opt" |
|
|
|
|
|
leveldb_util "github.com/syndtr/goleveldb/leveldb/util" |
|
|
|
|
|
"io" |
|
|
"io" |
|
|
"os" |
|
|
"os" |
|
|
"strings" |
|
|
"strings" |
|
|
"sync" |
|
|
"sync" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/syndtr/goleveldb/leveldb" |
|
|
|
|
|
leveldb_errors "github.com/syndtr/goleveldb/leveldb/errors" |
|
|
|
|
|
"github.com/syndtr/goleveldb/leveldb/filter" |
|
|
|
|
|
"github.com/syndtr/goleveldb/leveldb/opt" |
|
|
|
|
|
leveldb_util "github.com/syndtr/goleveldb/leveldb/util" |
|
|
|
|
|
|
|
|
"github.com/chrislusf/seaweedfs/weed/filer" |
|
|
"github.com/chrislusf/seaweedfs/weed/filer" |
|
|
"github.com/chrislusf/seaweedfs/weed/glog" |
|
|
"github.com/chrislusf/seaweedfs/weed/glog" |
|
|
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb" |
|
|
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb" |
|
@ -62,17 +64,19 @@ func (store *LevelDB3Store) initialize(dir string) (err error) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (store *LevelDB3Store) loadDB(name string) (*leveldb.DB, error) { |
|
|
func (store *LevelDB3Store) loadDB(name string) (*leveldb.DB, error) { |
|
|
|
|
|
|
|
|
|
|
|
bloom := filter.NewBloomFilter(8) // false positive rate 0.02
|
|
|
opts := &opt.Options{ |
|
|
opts := &opt.Options{ |
|
|
BlockCacheCapacity: 32 * 1024 * 1024, // default value is 8MiB
|
|
|
BlockCacheCapacity: 32 * 1024 * 1024, // default value is 8MiB
|
|
|
WriteBuffer: 16 * 1024 * 1024, // default value is 4MiB
|
|
|
WriteBuffer: 16 * 1024 * 1024, // default value is 4MiB
|
|
|
CompactionTableSizeMultiplier: 4, |
|
|
CompactionTableSizeMultiplier: 4, |
|
|
|
|
|
Filter: bloom, |
|
|
} |
|
|
} |
|
|
if name != DEFAULT { |
|
|
if name != DEFAULT { |
|
|
opts = &opt.Options{ |
|
|
opts = &opt.Options{ |
|
|
BlockCacheCapacity: 4 * 1024 * 1024, // default value is 8MiB
|
|
|
BlockCacheCapacity: 4 * 1024 * 1024, // default value is 8MiB
|
|
|
WriteBuffer: 2 * 1024 * 1024, // default value is 4MiB
|
|
|
WriteBuffer: 2 * 1024 * 1024, // default value is 4MiB
|
|
|
CompactionTableSizeMultiplier: 4, |
|
|
CompactionTableSizeMultiplier: 4, |
|
|
|
|
|
Filter: bloom, |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|