mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Disables fsync in db operations
Disabling fsync can greatly reduce the amount of unneccessary serialization of filesystem operations.
This commit is contained in:
parent
4bcc0a37ab
commit
0604998958
1 changed files with 4 additions and 1 deletions
|
|
@ -78,6 +78,7 @@ func NewLDBDatabase(file string, cache int, handles int) (*LDBDatabase, error) {
|
||||||
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),
|
||||||
|
NoSync: true,
|
||||||
})
|
})
|
||||||
if _, corrupted := err.(*errors.ErrCorrupted); corrupted {
|
if _, corrupted := err.(*errors.ErrCorrupted); corrupted {
|
||||||
db, err = leveldb.RecoverFile(file, nil)
|
db, err = leveldb.RecoverFile(file, nil)
|
||||||
|
|
@ -371,7 +372,9 @@ func (b *ldbBatch) Delete(key []byte) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *ldbBatch) Write() error {
|
func (b *ldbBatch) Write() error {
|
||||||
return b.db.Write(b.b, nil)
|
return b.db.Write(b.b, &opt.WriteOptions{
|
||||||
|
Sync: false,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *ldbBatch) ValueSize() int {
|
func (b *ldbBatch) ValueSize() int {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue