From 877ecab960d955a54d94e87a2cb3cfb6f6941b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Mon, 25 Jan 2021 19:28:38 +0000 Subject: [PATCH] update go-bs-lmdb and migrate to ledgerwatch/lmdb-go. --- chain/store/splitstore/liveset.go | 2 +- chain/store/splitstore/liveset_test.go | 2 +- chain/store/splitstore/snoop.go | 2 +- chain/store/splitstore/snoop_test.go | 2 +- chain/store/splitstore/splitstore.go | 11 +++++++++-- go.mod | 4 ++-- go.sum | 6 ++++-- 7 files changed, 19 insertions(+), 10 deletions(-) diff --git a/chain/store/splitstore/liveset.go b/chain/store/splitstore/liveset.go index 433046371..f4d06129e 100644 --- a/chain/store/splitstore/liveset.go +++ b/chain/store/splitstore/liveset.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "github.com/bmatsuo/lmdb-go/lmdb" + "github.com/ledgerwatch/lmdb-go/lmdb" cid "github.com/ipfs/go-cid" ) diff --git a/chain/store/splitstore/liveset_test.go b/chain/store/splitstore/liveset_test.go index 77c8cb5e6..449b3c92f 100644 --- a/chain/store/splitstore/liveset_test.go +++ b/chain/store/splitstore/liveset_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - "github.com/bmatsuo/lmdb-go/lmdb" + "github.com/ledgerwatch/lmdb-go/lmdb" cid "github.com/ipfs/go-cid" "github.com/multiformats/go-multihash" diff --git a/chain/store/splitstore/snoop.go b/chain/store/splitstore/snoop.go index 286c43be2..731014fb6 100644 --- a/chain/store/splitstore/snoop.go +++ b/chain/store/splitstore/snoop.go @@ -5,7 +5,7 @@ import ( "fmt" "os" - "github.com/bmatsuo/lmdb-go/lmdb" + "github.com/ledgerwatch/lmdb-go/lmdb" cid "github.com/ipfs/go-cid" diff --git a/chain/store/splitstore/snoop_test.go b/chain/store/splitstore/snoop_test.go index 5fc62d3b1..7e60d03d9 100644 --- a/chain/store/splitstore/snoop_test.go +++ b/chain/store/splitstore/snoop_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/bmatsuo/lmdb-go/lmdb" + "github.com/ledgerwatch/lmdb-go/lmdb" cid "github.com/ipfs/go-cid" "github.com/multiformats/go-multihash" diff --git a/chain/store/splitstore/splitstore.go b/chain/store/splitstore/splitstore.go index e280bca15..474ae2a50 100644 --- a/chain/store/splitstore/splitstore.go +++ b/chain/store/splitstore/splitstore.go @@ -9,7 +9,7 @@ import ( "sync/atomic" "time" - "github.com/bmatsuo/lmdb-go/lmdb" + "github.com/ledgerwatch/lmdb-go/lmdb" blocks "github.com/ipfs/go-block-format" cid "github.com/ipfs/go-cid" @@ -59,7 +59,14 @@ var _ bstore.Blockstore = (*SplitStore)(nil) // compaction. func NewSplitStore(path string, ds dstore.Datastore, cold bstore.Blockstore) (*SplitStore, error) { // the hot store - hot, err := lmdbbs.Open(filepath.Join(path, "hot.db")) + path = filepath.Join(path, "hot.db") + hot, err := lmdbbs.Open(&lmdbbs.Options{ + Path: path, + InitialMmapSize: 256 << 20, // 256MiB. + MmapGrowthStepFactor: 1.25, // scale slower than the default of 1.5 + MmapGrowthStepMax: 512 << 20, // 512MiB. + MaxReaders: 32, + }) if err != nil { return nil, err } diff --git a/go.mod b/go.mod index 536251e17..56d193618 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,6 @@ require ( github.com/Jeffail/gabs v1.4.0 github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d - github.com/bmatsuo/lmdb-go v1.8.0 github.com/buger/goterm v0.0.0-20200322175922-2f3e71b85129 github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e github.com/cockroachdb/pebble v0.0.0-20201001221639-879f3bfeef07 @@ -29,7 +28,7 @@ require ( github.com/filecoin-project/go-address v0.0.5 github.com/filecoin-project/go-amt-ipld/v2 v2.1.1-0.20201006184820-924ee87a1349 // indirect github.com/filecoin-project/go-bitfield v0.2.4 - github.com/filecoin-project/go-bs-lmdb v0.0.3 + github.com/filecoin-project/go-bs-lmdb v1.0.1 github.com/filecoin-project/go-cbor-util v0.0.0-20191219014500-08c40a1e63a2 github.com/filecoin-project/go-commp-utils v0.0.0-20201119054358-b88f7a96a434 github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03 @@ -97,6 +96,7 @@ require ( github.com/ipld/go-car v0.1.1-0.20201119040415-11b6074b6d4d github.com/ipld/go-ipld-prime v0.5.1-0.20201021195245-109253e8a018 github.com/kelseyhightower/envconfig v1.4.0 + github.com/ledgerwatch/lmdb-go v1.17.4 github.com/lib/pq v1.7.0 github.com/libp2p/go-buffer-pool v0.0.2 github.com/libp2p/go-eventbus v0.2.1 diff --git a/go.sum b/go.sum index ae413c088..13155e513 100644 --- a/go.sum +++ b/go.sum @@ -90,8 +90,6 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bmatsuo/lmdb-go v1.8.0 h1:ohf3Q4xjXZBKh4AayUY4bb2CXuhRAI8BYGlJq08EfNA= -github.com/bmatsuo/lmdb-go v1.8.0/go.mod h1:wWPZmKdOAZsl4qOqkowQ1aCrFie1HU8gWloHMCeAUdM= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/briandowns/spinner v1.11.1/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= @@ -254,6 +252,8 @@ github.com/filecoin-project/go-bs-lmdb v0.0.3-0.20201201162933-d7f9ef615d0f h1:P github.com/filecoin-project/go-bs-lmdb v0.0.3-0.20201201162933-d7f9ef615d0f/go.mod h1:Oq9zP5FMx7IomcY79neGD76YsfeMY3N7BKGDkofn/Ao= github.com/filecoin-project/go-bs-lmdb v0.0.3 h1:tSgG5S9+5zojhmnRSQxiabWFyHPxdDP9eU7sAgaECvI= github.com/filecoin-project/go-bs-lmdb v0.0.3/go.mod h1:Oq9zP5FMx7IomcY79neGD76YsfeMY3N7BKGDkofn/Ao= +github.com/filecoin-project/go-bs-lmdb v1.0.1 h1:kAoPGgZqUQ0IowIzjdDo251X6smWuy286E6h3m03zqY= +github.com/filecoin-project/go-bs-lmdb v1.0.1/go.mod h1:peFIZ9XEE9OLFkCzi7FMlr84UexqVKj6+AyxZD5SiGs= github.com/filecoin-project/go-cbor-util v0.0.0-20191219014500-08c40a1e63a2 h1:av5fw6wmm58FYMgJeoB/lK9XXrgdugYiTqkdxjTy9k8= github.com/filecoin-project/go-cbor-util v0.0.0-20191219014500-08c40a1e63a2/go.mod h1:pqTiPHobNkOVM5thSRsHYjyQfq7O5QSCMhvuu9JoDlg= github.com/filecoin-project/go-commp-utils v0.0.0-20201119054358-b88f7a96a434 h1:0kHszkYP3hgApcjl5x4rpwONhN9+j7XDobf6at5XfHs= @@ -762,6 +762,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/ledgerwatch/lmdb-go v1.17.4 h1:dDgPXUrzFWG/EB3RwOKZ+P3XGAlbsZxmVahjc+qWwyA= +github.com/ledgerwatch/lmdb-go v1.17.4/go.mod h1:NKRpCxksoTQPyxsUcBiVOe0135uqnJsnf6cElxmOL0o= github.com/lib/pq v1.7.0 h1:h93mCPfUSkaul3Ka/VG8uZdmW1uMHDGxzu0NWHuJmHY= github.com/lib/pq v1.7.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ=