From 0b977288628d146da7cc2e3cd483023089296337 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Thu, 6 Jul 2023 11:08:23 +0700 Subject: [PATCH] mdbx bug in DeleteCurrentDuplicates() workaround (#7850) --- Makefile | 2 +- core/rawdb/accessors_chain.go | 2 +- eth/stagedsync/stage_call_traces.go | 2 +- eth/stagedsync/stage_execute.go | 3 +-- go.mod | 2 +- go.sum | 4 ++-- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 34b7c8733..81456b2ed 100644 --- a/Makefile +++ b/Makefile @@ -167,7 +167,7 @@ lintci: ## lintci-deps: (re)installs golangci-lint to build/bin/golangci-lint lintci-deps: rm -f ./build/bin/golangci-lint - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.53.2 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.53.3 ## clean: cleans the go cache, build dir, libmdbx db dir clean: diff --git a/core/rawdb/accessors_chain.go b/core/rawdb/accessors_chain.go index dc0818bcb..75fbe19bc 100644 --- a/core/rawdb/accessors_chain.go +++ b/core/rawdb/accessors_chain.go @@ -1371,7 +1371,7 @@ func PruneTableDupSort(tx kv.RwTx, table string, logPrefix string, pruneTo uint6 return common2.ErrStopped default: } - if err = c.DeleteCurrentDuplicates(); err != nil { + if err = tx.Delete(table, k); err != nil { return fmt.Errorf("failed to remove for block %d: %w", blockNum, err) } } diff --git a/eth/stagedsync/stage_call_traces.go b/eth/stagedsync/stage_call_traces.go index 861f74ea4..f6c94008e 100644 --- a/eth/stagedsync/stage_call_traces.go +++ b/eth/stagedsync/stage_call_traces.go @@ -191,7 +191,7 @@ func promoteCallTraces(logPrefix string, tx kv.RwTx, startBlock, endBlock uint64 logger.Info(fmt.Sprintf("[%s] Pruning call trace table", logPrefix), "number", blockNum, "alloc", libcommon.ByteCount(m.Alloc), "sys", libcommon.ByteCount(m.Sys)) } - if err = traceCursor.DeleteCurrentDuplicates(); err != nil { + if err = tx.Delete(kv.CallTraceSet, k); err != nil { return fmt.Errorf("remove trace call set for block %d: %w", blockNum, err) } if blockNum < prunedMin { diff --git a/eth/stagedsync/stage_execute.go b/eth/stagedsync/stage_execute.go index 03e650562..3b72f9539 100644 --- a/eth/stagedsync/stage_execute.go +++ b/eth/stagedsync/stage_execute.go @@ -794,8 +794,7 @@ func unwindExecutionStage(u *UnwindState, s *StageState, tx kv.RwTx, ctx context if err != nil { return err } - err = c.DeleteCurrentDuplicates() - if err != nil { + if err = tx.Delete(kv.CallTraceSet, k); err != nil { return err } } diff --git a/go.mod b/go.mod index 08f34cc0d..3315b259d 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/ledgerwatch/erigon go 1.19 require ( - github.com/ledgerwatch/erigon-lib v0.0.0-20230627104814-797724496a65 + github.com/ledgerwatch/erigon-lib v0.0.0-20230706040551-efbc6c260daa github.com/ledgerwatch/erigon-snapshot v1.2.1-0.20230622075030-1d69651854c2 github.com/ledgerwatch/log/v3 v3.8.0 github.com/ledgerwatch/secp256k1 v1.0.0 diff --git a/go.sum b/go.sum index 3d474964c..d83f0754c 100644 --- a/go.sum +++ b/go.sum @@ -415,8 +415,8 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758 h1:0D5M2HQSGD3PYPwICLl+/9oulQauOuETfgFvhBDffs0= github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= -github.com/ledgerwatch/erigon-lib v0.0.0-20230627104814-797724496a65 h1:KiLnZa8ALmNovK96dQ6gvXf01RFxJYNB/rqjdtIW4Go= -github.com/ledgerwatch/erigon-lib v0.0.0-20230627104814-797724496a65/go.mod h1:DmziKzY3PtjCCAQxqSYvJbRxru/sNHESud6LgO3YWAI= +github.com/ledgerwatch/erigon-lib v0.0.0-20230706040551-efbc6c260daa h1:sCroEMsIMftYOdcknJ8+VMqNgS2/upQt3Bzak1iywGM= +github.com/ledgerwatch/erigon-lib v0.0.0-20230706040551-efbc6c260daa/go.mod h1:DmziKzY3PtjCCAQxqSYvJbRxru/sNHESud6LgO3YWAI= github.com/ledgerwatch/erigon-snapshot v1.2.1-0.20230622075030-1d69651854c2 h1:Ls2itRGHMOr2PbHRDA4g1HH8HQdwfJhRVfMPEaLQe94= github.com/ledgerwatch/erigon-snapshot v1.2.1-0.20230622075030-1d69651854c2/go.mod h1:3AuPxZc85jkehh/HA9h8gabv5MSi3kb/ddtzBsTVJFo= github.com/ledgerwatch/log/v3 v3.8.0 h1:gCpp7uGtIerEz1jKVPeDnbIopFPud9ZnCpBLlLBGqPU=