Merge pull request #2327 from joshuafc/patch-2

This commit is contained in:
Chris Lu 2021-09-08 19:52:19 -07:00 committed by GitHub
commit ac574d5572
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 16 deletions

View file

@ -46,10 +46,9 @@ func (store *LevelDBStore) initialize(dir string) (err error) {
} }
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: 10, Filter: filter.NewBloomFilter(8), // false positive rate 0.02
Filter: filter.NewBloomFilter(8), // false positive rate 0.02
} }
if store.db, err = leveldb.OpenFile(dir, opts); err != nil { if store.db, err = leveldb.OpenFile(dir, opts); err != nil {

View file

@ -46,10 +46,9 @@ func (store *LevelDB2Store) initialize(dir string, dbCount int) (err error) {
} }
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, Filter: filter.NewBloomFilter(8), // false positive rate 0.02
Filter: filter.NewBloomFilter(8), // false positive rate 0.02
} }
for d := 0; d < dbCount; d++ { for d := 0; d < dbCount; d++ {

View file

@ -66,17 +66,15 @@ 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 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, Filter: bloom,
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, Filter: bloom,
Filter: bloom,
} }
} }