Skip to content

Commit

Permalink
nodedb: use SafeNoSync (#13545)
Browse files Browse the repository at this point in the history
port of #13457
  • Loading branch information
AskAlexSharov authored Jan 24, 2025
1 parent b8be070 commit 381c069
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions erigon-lib/kv/mdbx/kv_mdbx.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ func (opts MdbxOpts) WriteMergeThreshold(v uint64) MdbxOpts { opts.mergeTh
func (opts MdbxOpts) WithTableCfg(f TableCfgFunc) MdbxOpts { opts.bucketsCfg = f; return opts }

// Flags
func (opts MdbxOpts) HasFlag(flag uint) bool { return opts.flags&flag != 0 }
func (opts MdbxOpts) AddFlags(flags uint) MdbxOpts { opts.flags = opts.flags | flags; return opts }
func (opts MdbxOpts) RemoveFlags(flags uint) MdbxOpts { opts.flags = opts.flags &^ flags; return opts }
func (opts MdbxOpts) HasFlag(flag uint) bool { return opts.flags&flag != 0 }
func (opts MdbxOpts) Flags(f func(uint) uint) MdbxOpts { opts.flags = f(opts.flags); return opts }
func (opts MdbxOpts) AddFlags(flags uint) MdbxOpts { opts.flags = opts.flags | flags; return opts }
func (opts MdbxOpts) RemoveFlags(flags uint) MdbxOpts { opts.flags = opts.flags &^ flags; return opts }
func (opts MdbxOpts) boolToFlag(enabled bool, flag uint) MdbxOpts {
if enabled {
return opts.AddFlags(flag)
Expand Down
6 changes: 4 additions & 2 deletions p2p/enode/nodedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ import (
"time"

"github.com/c2h5oh/datasize"

"github.com/erigontech/erigon-lib/log/v3"
mdbx1 "github.com/erigontech/mdbx-go/mdbx"

"github.com/erigontech/erigon-lib/kv"
"github.com/erigontech/erigon-lib/kv/mdbx"
"github.com/erigontech/erigon-lib/log/v3"
"github.com/erigontech/erigon-lib/rlp"
)

Expand Down Expand Up @@ -124,6 +124,8 @@ func newPersistentDB(ctx context.Context, logger log.Logger, path string) (*DB,
WithTableCfg(bucketsConfig).
MapSize(8 * datasize.GB).
GrowthStep(16 * datasize.MB).
Flags(func(f uint) uint { return f ^ mdbx1.Durable | mdbx1.SafeNoSync }).
SyncPeriod(2 * time.Second).
DirtySpace(uint64(64 * datasize.MB)).
Open(ctx)
if err != nil {
Expand Down

0 comments on commit 381c069

Please sign in to comment.