diff --git a/erigon-lib/kv/kv_interface.go b/erigon-lib/kv/kv_interface.go index c7a26f59aa5..7e414eb9281 100644 --- a/erigon-lib/kv/kv_interface.go +++ b/erigon-lib/kv/kv_interface.go @@ -146,15 +146,15 @@ type DBVerbosityLvl int8 type Label uint8 const ( - ChainDB Label = 0 - TxPoolDB Label = 1 - SentryDB Label = 2 - ConsensusDB Label = 3 - DownloaderDB Label = 4 - InMem Label = 5 - HeimdallDB Label = 6 - DiagnosticsDB Label = 7 - PolygonBridgeDB Label = 8 + Unknown Label = iota + ChainDB + TxPoolDB + SentryDB + ConsensusDB + DownloaderDB + HeimdallDB + DiagnosticsDB + PolygonBridgeDB ) func (l Label) String() string { @@ -169,8 +169,6 @@ func (l Label) String() string { return "consensus" case DownloaderDB: return "downloader" - case InMem: - return "inMem" case HeimdallDB: return "heimdall" case DiagnosticsDB: @@ -193,14 +191,14 @@ func UnmarshalLabel(s string) Label { return ConsensusDB case "downloader": return DownloaderDB - case "inMem": - return InMem case "heimdall": return HeimdallDB case "diagnostics": return DiagnosticsDB case "polygon-bridge": return PolygonBridgeDB + case "unknown": + return Unknown default: panic(fmt.Sprintf("unexpected label: %s", s)) } diff --git a/erigon-lib/kv/mdbx/kv_mdbx.go b/erigon-lib/kv/mdbx/kv_mdbx.go index 2f309cce8ad..0d1a1663cdd 100644 --- a/erigon-lib/kv/mdbx/kv_mdbx.go +++ b/erigon-lib/kv/mdbx/kv_mdbx.go @@ -89,7 +89,7 @@ func NewMDBX(log log.Logger) MdbxOpts { growthStep: DefaultGrowthStep, mergeThreshold: 2 * 8192, shrinkThreshold: -1, // default - label: kv.InMem, + label: kv.Unknown, } return opts } @@ -142,7 +142,6 @@ func (opts MdbxOpts) InMem(tmpDir string) MdbxOpts { opts.mapSize = 512 * datasize.MB opts.dirtySpace = uint64(64 * datasize.MB) opts.shrinkThreshold = 0 // disable - opts.label = kv.InMem opts.pageSize = 4096 return opts } diff --git a/erigon-lib/kv/mdbx/kv_mdbx_temporary.go b/erigon-lib/kv/mdbx/kv_mdbx_temporary.go index df8e7082bd8..ef9e79c172e 100644 --- a/erigon-lib/kv/mdbx/kv_mdbx_temporary.go +++ b/erigon-lib/kv/mdbx/kv_mdbx_temporary.go @@ -36,7 +36,7 @@ func NewTemporaryMdbx(ctx context.Context, tempdir string) (kv.RwDB, error) { return &TemporaryMdbx{}, err } - db, err := NewMDBX(log.Root()).Label(kv.InMem).Label(kv.InMem).Path(path).Open(ctx) + db, err := NewMDBX(log.Root()).Label(kv.Unknown).InMem(path).Open(ctx) if err != nil { return &TemporaryMdbx{}, err } diff --git a/erigon-lib/kv/membatchwithdb/memory_mutation.go b/erigon-lib/kv/membatchwithdb/memory_mutation.go index 5192ebc9abe..3bce9c02321 100644 --- a/erigon-lib/kv/membatchwithdb/memory_mutation.go +++ b/erigon-lib/kv/membatchwithdb/memory_mutation.go @@ -69,7 +69,7 @@ func NewMemoryBatch(tx kv.Tx, tmpDir string, logger log.Logger) *MemoryMutation } } -func NewMemoryBatchWithCustomDB(tx kv.Tx, db kv.RwDB, uTx kv.RwTx, tmpDir string) *MemoryMutation { +func NewMemoryBatchWithCustomDB(tx kv.Tx, db kv.RwDB, uTx kv.RwTx) *MemoryMutation { return &MemoryMutation{ db: tx, memDb: db, diff --git a/turbo/engineapi/engine_block_downloader/core.go b/turbo/engineapi/engine_block_downloader/core.go index f609cfee046..1e9352f4388 100644 --- a/turbo/engineapi/engine_block_downloader/core.go +++ b/turbo/engineapi/engine_block_downloader/core.go @@ -76,7 +76,7 @@ func (e *EngineBlockDownloader) download(ctx context.Context, hashToDownload lib } defer tmpTx.Rollback() - memoryMutation := membatchwithdb.NewMemoryBatchWithCustomDB(tx, tmpDb, tmpTx, e.tmpdir) + memoryMutation := membatchwithdb.NewMemoryBatchWithCustomDB(tx, tmpDb, tmpTx) defer memoryMutation.Rollback() startBlock, endBlock, startHash, err := e.loadDownloadedHeaders(memoryMutation)