mirror of
https://github.com/kaspanet/kaspad.git
synced 2026-02-16 08:34:17 +00:00
[NOD-1581] Enable fsync in database writes (#1168)
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
|||||||
"github.com/kaspanet/kaspad/infrastructure/db/database"
|
"github.com/kaspanet/kaspad/infrastructure/db/database"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/syndtr/goleveldb/leveldb"
|
"github.com/syndtr/goleveldb/leveldb"
|
||||||
|
"github.com/syndtr/goleveldb/leveldb/opt"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LevelDBTransaction is a thin wrapper around native leveldb
|
// LevelDBTransaction is a thin wrapper around native leveldb
|
||||||
@@ -53,7 +54,7 @@ func (tx *LevelDBTransaction) Commit() error {
|
|||||||
|
|
||||||
tx.isClosed = true
|
tx.isClosed = true
|
||||||
tx.snapshot.Release()
|
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
|
// Rollback rolls back whatever changes were made to the
|
||||||
|
|||||||
Reference in New Issue
Block a user