Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stashed WalkDir cleanup, update pebble #1176

Merged
merged 2 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions db/pebbledb/pebledb.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ func iterate(reader pebble.Reader, prefix []byte, callback func(k, v []byte) boo
LowerBound: prefix,
UpperBound: keyUpperBound(prefix),
}
iter := reader.NewIter(iterOptions)
iter, err := reader.NewIter(iterOptions)
if err != nil {
return err
}
defer func() {
errC := iter.Close()
if err != nil {
Expand Down Expand Up @@ -180,7 +183,10 @@ func (db *PebbleDB) Iterate(prefix []byte, callback func(k, v []byte) bool) (err
// Compact implements the db.Database.Compact interface method
func (db *PebbleDB) Compact() error {
// from https://github.com/cockroachdb/pebble/issues/1474#issuecomment-1022313365
iter := db.db.NewIter(nil)
iter, err := db.db.NewIter(nil)
if err != nil {
return err
}
var first, last []byte
if iter.First() {
first = append(first, iter.Key()...)
Expand Down
28 changes: 18 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ require (
github.com/766b/chi-prometheus v0.0.0-20211217152057-87afa9aa2ca8
github.com/VictoriaMetrics/metrics v1.24.0
github.com/arnaucube/go-blindsecp256k1 v0.0.0-20211204171003-644e7408753f
github.com/cockroachdb/pebble v0.0.0-20230620232302-06034ff014e0
github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593
github.com/cometbft/cometbft v0.38.0
github.com/cometbft/cometbft-db v0.8.0
github.com/ethereum/go-ethereum v1.11.6
github.com/ethereum/go-ethereum v1.13.4
github.com/fatih/color v1.15.0
github.com/frankban/quicktest v1.14.6
github.com/glendc/go-external-ip v0.1.0
Expand Down Expand Up @@ -62,7 +62,7 @@ require (
go.vocdoni.io/proto v1.15.4-0.20231023165811-02adcc48142a
golang.org/x/crypto v0.14.0
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
golang.org/x/net v0.16.0
golang.org/x/net v0.17.0
google.golang.org/protobuf v1.31.0
)

Expand All @@ -72,11 +72,13 @@ require (
github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 // indirect
github.com/DataDog/zstd v1.5.2 // indirect
github.com/Jorropo/jsync v1.0.1 // indirect
github.com/VictoriaMetrics/fastcache v1.6.0 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/VictoriaMetrics/fastcache v1.12.1 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/alexbrainman/goissue34681 v0.0.0-20191006012335-3fc7a47baff5 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.7.0 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 // indirect
Expand All @@ -89,11 +91,14 @@ require (
github.com/cockroachdb/errors v1.9.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/redact v1.1.3 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230613231145-182959a1fad6 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/containerd/cgroups v1.1.0 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cosmos/gogoproto v1.4.11 // indirect
github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 // indirect
github.com/crate-crypto/go-kzg-4844 v0.3.0 // indirect
github.com/cskr/pubsub v1.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
Expand All @@ -107,6 +112,7 @@ require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/elastic/gosigar v0.14.2 // indirect
github.com/elgris/jsondiff v0.0.0-20160530203242-765b5c24c302 // indirect
github.com/ethereum/c-kzg-4844 v0.3.1 // indirect
github.com/facebookgo/atomicfile v0.0.0-20151019160806-2de1f203e7d5 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fjl/memsize v0.0.1 // indirect
Expand Down Expand Up @@ -146,8 +152,8 @@ require (
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/golang-lru v0.6.0 // indirect
github.com/hashicorp/hcl v1.0.1-vault-5 // indirect
github.com/holiman/uint256 v1.2.2 // indirect
github.com/huin/goupnp v1.2.0 // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/huin/goupnp v1.3.0 // indirect
github.com/ipfs/bbloom v0.0.4 // indirect
github.com/ipfs/go-bitfield v1.1.0 // indirect
github.com/ipfs/go-block-format v0.1.2 // indirect
Expand Down Expand Up @@ -223,6 +229,7 @@ require (
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
Expand Down Expand Up @@ -267,8 +274,9 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/ucarion/urlpath v0.0.0-20200424170820-7ccc79b76bbb // indirect
github.com/valyala/fastrand v1.1.0 // indirect
github.com/valyala/histogram v1.2.0 // indirect
Expand Down Expand Up @@ -320,9 +328,9 @@ require (
google.golang.org/genproto/googleapis/rpc v0.0.0-20230815205213-6bfd019c3878 // indirect
google.golang.org/grpc v1.57.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/square/go-jose.v2 v2.5.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.2.1 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)
Loading