From a792d4a19e3ab81363a80f86b8089807f8baef3b Mon Sep 17 00:00:00 2001 From: stasatdaglabs <39559713+stasatdaglabs@users.noreply.github.com> Date: Thu, 4 Feb 2021 16:36:46 +0200 Subject: [PATCH] Don't fsync immediately after all writes (#1490) --- infrastructure/db/database/ldb/options.go | 1 + infrastructure/db/database/ldb/transaction.go | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/infrastructure/db/database/ldb/options.go b/infrastructure/db/database/ldb/options.go index 92e61cfea..00a9e5e47 100644 --- a/infrastructure/db/database/ldb/options.go +++ b/infrastructure/db/database/ldb/options.go @@ -8,6 +8,7 @@ var ( BlockCacheCapacity: 256 * opt.MiB, WriteBuffer: 128 * opt.MiB, DisableSeeksCompaction: true, + NoSync: true, } // Options is a function that returns a leveldb diff --git a/infrastructure/db/database/ldb/transaction.go b/infrastructure/db/database/ldb/transaction.go index 095bc37fc..10cfa2035 100644 --- a/infrastructure/db/database/ldb/transaction.go +++ b/infrastructure/db/database/ldb/transaction.go @@ -4,7 +4,6 @@ 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 @@ -41,7 +40,7 @@ func (tx *LevelDBTransaction) Commit() error { } tx.isClosed = true - return errors.WithStack(tx.db.ldb.Write(tx.batch, &opt.WriteOptions{Sync: true})) + return errors.WithStack(tx.db.ldb.Write(tx.batch, nil)) } // Rollback rolls back whatever changes were made to the