mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
ethdb/leveldb: use larger table files to decrease filesys load
This commit is contained in:
parent
a54142987c
commit
18b41bdd42
1 changed files with 6 additions and 4 deletions
|
|
@ -91,10 +91,12 @@ func New(file string, cache int, handles int, namespace string) (*Database, erro
|
||||||
|
|
||||||
// Open the db and recover any potential corruptions
|
// Open the db and recover any potential corruptions
|
||||||
db, err := leveldb.OpenFile(file, &opt.Options{
|
db, err := leveldb.OpenFile(file, &opt.Options{
|
||||||
OpenFilesCacheCapacity: handles,
|
OpenFilesCacheCapacity: handles,
|
||||||
BlockCacheCapacity: cache / 2 * opt.MiB,
|
BlockCacheCapacity: cache / 2 * opt.MiB,
|
||||||
WriteBuffer: cache / 4 * opt.MiB, // Two of these are used internally
|
WriteBuffer: cache / 4 * opt.MiB, // Two of these are used internally
|
||||||
Filter: filter.NewBloomFilter(10),
|
Filter: filter.NewBloomFilter(10),
|
||||||
|
CompactionTableSize: 4 * opt.MiB,
|
||||||
|
CompactionTableSizeMultiplierPerLevel: []float64{1, 2, 4, 8, 8, 8, 8}, // Cap at 32MB files, higher explodes disk IO
|
||||||
})
|
})
|
||||||
if _, corrupted := err.(*errors.ErrCorrupted); corrupted {
|
if _, corrupted := err.(*errors.ErrCorrupted); corrupted {
|
||||||
db, err = leveldb.RecoverFile(file, nil)
|
db, err = leveldb.RecoverFile(file, nil)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue