mdbx: don't mix modes (#8490)

db must not use "Durable" and "SyncPeriod" in same time

txpool and downloader must be: Durable
nodedb:  SafeNoSync+SyncPeriod

because txpool and downloader already can call sync when they need
(txpool after regular flush, downloader after piece download+validation
completion).
This commit is contained in:
Alex Sharov 2023-10-16 16:21:44 +07:00 committed by GitHub
parent 2e9436a7d0
commit ab04de6d9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 3 deletions

View File

@ -610,7 +610,6 @@ func openClient(ctx context.Context, dbDir, snapDir string, cfg *torrent.ClientC
db, err = mdbx.NewMDBX(log.New()). db, err = mdbx.NewMDBX(log.New()).
Label(kv.DownloaderDB). Label(kv.DownloaderDB).
WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { return kv.DownloaderTablesCfg }). WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { return kv.DownloaderTablesCfg }).
SyncPeriod(15 * time.Second).
GrowthStep(16 * datasize.MB). GrowthStep(16 * datasize.MB).
MapSize(16 * datasize.GB). MapSize(16 * datasize.GB).
Path(dbDir). Path(dbDir).

View File

@ -22,7 +22,6 @@ import (
"time" "time"
"github.com/c2h5oh/datasize" "github.com/c2h5oh/datasize"
mdbx2 "github.com/erigontech/mdbx-go/mdbx"
"github.com/holiman/uint256" "github.com/holiman/uint256"
"github.com/ledgerwatch/log/v3" "github.com/ledgerwatch/log/v3"
@ -104,7 +103,6 @@ func AllComponents(ctx context.Context, cfg txpoolcfg.Config, cache kvcache.Cach
sentryClients []direct.SentryClient, stateChangesClient txpool.StateChangesClient, logger log.Logger) (kv.RwDB, *txpool.TxPool, *txpool.Fetch, *txpool.Send, *txpool.GrpcServer, error) { sentryClients []direct.SentryClient, stateChangesClient txpool.StateChangesClient, logger log.Logger) (kv.RwDB, *txpool.TxPool, *txpool.Fetch, *txpool.Send, *txpool.GrpcServer, error) {
opts := mdbx.NewMDBX(log.New()).Label(kv.TxPoolDB).Path(cfg.DBDir). opts := mdbx.NewMDBX(log.New()).Label(kv.TxPoolDB).Path(cfg.DBDir).
WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { return kv.TxpoolTablesCfg }). WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { return kv.TxpoolTablesCfg }).
Flags(func(f uint) uint { return f ^ mdbx2.Durable }).
WriteMergeThreshold(3 * 8192). WriteMergeThreshold(3 * 8192).
PageSize(uint64(16 * datasize.KB)). PageSize(uint64(16 * datasize.KB)).
GrowthStep(16 * datasize.MB). GrowthStep(16 * datasize.MB).