mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
e3: indices wal - to reuse etl collector (#6757)
This commit is contained in:
parent
8c0774f3d2
commit
dfca60c054
@ -140,7 +140,7 @@ func (rs *ReconState) Get(table string, key1, key2 []byte, txNum uint64) []byte
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
i, ok := t.GetHint(reconPair{txNum: txNum, key1: key1, key2: key2}, rs.hints[table])
|
||||
i, ok := t.Get(reconPair{txNum: txNum, key1: key1, key2: key2})
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
|
@ -789,11 +789,10 @@ func reconstituteStep(last bool,
|
||||
chainConfig *chain.Config, logger log.Logger, genesis *core.Genesis, engine consensus.Engine,
|
||||
batchSize datasize.ByteSize, s *StageState, blockNum uint64, total uint64,
|
||||
) error {
|
||||
var err error
|
||||
var startOk, endOk bool
|
||||
startTxNum, endTxNum := as.TxNumRange()
|
||||
var startBlockNum, endBlockNum uint64 // First block which is not covered by the history snapshot files
|
||||
if err := chainDb.View(ctx, func(tx kv.Tx) error {
|
||||
if err := chainDb.View(ctx, func(tx kv.Tx) (err error) {
|
||||
startOk, startBlockNum, err = rawdbv3.TxNums.FindBlockNum(tx, startTxNum)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -870,6 +869,7 @@ func reconstituteStep(last bool,
|
||||
}
|
||||
}()
|
||||
for i := 0; i < workerCount; i++ {
|
||||
var err error
|
||||
if roTxs[i], err = db.BeginRo(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -933,14 +933,14 @@ func reconstituteStep(last bool,
|
||||
"alloc", common.ByteCount(m.Alloc), "sys", common.ByteCount(m.Sys))
|
||||
if sizeEstimate >= commitThreshold {
|
||||
t := time.Now()
|
||||
if err = func() error {
|
||||
if err := func() error {
|
||||
lock.Lock()
|
||||
defer lock.Unlock()
|
||||
for i := 0; i < workerCount; i++ {
|
||||
roTxs[i].Rollback()
|
||||
}
|
||||
if err := db.Update(ctx, func(tx kv.RwTx) error {
|
||||
if err = rs.Flush(tx); err != nil {
|
||||
if err := rs.Flush(tx); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@ -948,6 +948,7 @@ func reconstituteStep(last bool,
|
||||
return err
|
||||
}
|
||||
for i := 0; i < workerCount; i++ {
|
||||
var err error
|
||||
if roTxs[i], err = db.BeginRo(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -967,6 +968,7 @@ func reconstituteStep(last bool,
|
||||
var b *types.Block
|
||||
var txKey [8]byte
|
||||
getHeaderFunc := func(hash common.Hash, number uint64) (h *types.Header) {
|
||||
var err error
|
||||
if err = chainDb.View(ctx, func(tx kv.Tx) error {
|
||||
h, err = blockReader.Header(ctx, tx, hash, number)
|
||||
if err != nil {
|
||||
@ -979,6 +981,8 @@ func reconstituteStep(last bool,
|
||||
}
|
||||
return h
|
||||
}
|
||||
|
||||
var err error // avoid declare global mutable variable
|
||||
for bn = startBlockNum; bn <= endBlockNum; bn++ {
|
||||
t = time.Now()
|
||||
b, err = blockWithSenders(chainDb, nil, blockReader, bn)
|
||||
|
4
go.mod
4
go.mod
@ -3,7 +3,7 @@ module github.com/ledgerwatch/erigon
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20230129035339-c8e1b58da166
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20230201020413-1637be299be5
|
||||
github.com/ledgerwatch/erigon-snapshot v1.1.1-0.20230120022649-cd9409a200da
|
||||
github.com/ledgerwatch/log/v3 v3.7.0
|
||||
github.com/ledgerwatch/secp256k1 v1.0.0
|
||||
@ -73,6 +73,7 @@ require (
|
||||
github.com/stretchr/testify v1.8.1
|
||||
github.com/tendermint/go-amino v0.14.1
|
||||
github.com/tendermint/tendermint v0.31.12
|
||||
github.com/thomaso-mirodin/intmath v0.0.0-20160323211736-5dc6d854e46e
|
||||
github.com/tidwall/btree v1.5.0
|
||||
github.com/ugorji/go/codec v1.1.13
|
||||
github.com/ugorji/go/codec/codecgen v1.1.13
|
||||
@ -229,7 +230,6 @@ require (
|
||||
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/supranational/blst v0.3.10 // indirect
|
||||
github.com/thomaso-mirodin/intmath v0.0.0-20160323211736-5dc6d854e46e // indirect
|
||||
github.com/valyala/fastrand v1.1.0 // indirect
|
||||
github.com/valyala/histogram v1.2.0 // indirect
|
||||
github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee // indirect
|
||||
|
4
go.sum
4
go.sum
@ -555,8 +555,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-20230129035339-c8e1b58da166 h1:HLkAsGg52srGtDmu7phHX3/GAU25yWnimNzKKf6CSEo=
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20230129035339-c8e1b58da166/go.mod h1:I3Gbzi7rY6Q5lPvKg2/lcXT5bOTrm+p0lphDmcsAjN8=
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20230201020413-1637be299be5 h1:xhYi19wpt3bjzxsO0J5p3bVnJE0A9Zq31OiNSAZBK/Q=
|
||||
github.com/ledgerwatch/erigon-lib v0.0.0-20230201020413-1637be299be5/go.mod h1:I3Gbzi7rY6Q5lPvKg2/lcXT5bOTrm+p0lphDmcsAjN8=
|
||||
github.com/ledgerwatch/erigon-snapshot v1.1.1-0.20230120022649-cd9409a200da h1:lQQBOHzAUThkymfXJj/m07vAjyMx9XoMMy3OomaeOrA=
|
||||
github.com/ledgerwatch/erigon-snapshot v1.1.1-0.20230120022649-cd9409a200da/go.mod h1:3AuPxZc85jkehh/HA9h8gabv5MSi3kb/ddtzBsTVJFo=
|
||||
github.com/ledgerwatch/log/v3 v3.7.0 h1:aFPEZdwZx4jzA3+/Pf8wNDN5tCI0cIolq/kfvgcM+og=
|
||||
|
Loading…
Reference in New Issue
Block a user