[NOD-1581] Enable fsync in database writes (#1168)

This commit is contained in:
Svarog
2020-12-07 14:18:33 +02:00
committed by GitHub
parent d90e18ec51
commit 37bf261da1

View File

@@ -4,6 +4,7 @@ import (
"github.com/kaspanet/kaspad/infrastructure/db/database"
"github.com/pkg/errors"
"github.com/syndtr/goleveldb/leveldb"
"github.com/syndtr/goleveldb/leveldb/opt"
)
// LevelDBTransaction is a thin wrapper around native leveldb
@@ -53,7 +54,7 @@ func (tx *LevelDBTransaction) Commit() error {
tx.isClosed = true
tx.snapshot.Release()
return errors.WithStack(tx.db.ldb.Write(tx.batch, nil))
return errors.WithStack(tx.db.ldb.Write(tx.batch, &opt.WriteOptions{Sync: true}))
}
// Rollback rolls back whatever changes were made to the