[erigon2.2] FinishTx to aggregate with delay (to avoid MDBX panic) (#513)

* Add temporary table for Plain state reconstitution

* Add 2 more temp tables

* FinishTx with delay

* Fix search in history

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
This commit is contained in:
ledgerwatch 2022-07-06 06:42:40 +01:00 committed by GitHub
parent e77f25bce6
commit 9e7f22667e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -681,6 +681,10 @@ func (a *Aggregator) FinishTx() error {
}
closeAll := true
step := a.txNum / a.aggregationStep
if step == 0 {
return nil
}
step-- // Leave one step worth in the DB
collation, err := a.collate(step, step*a.aggregationStep, (step+1)*a.aggregationStep, a.rwTx)
if err != nil {
return err

View File

@ -58,21 +58,17 @@ func (d *Domain) MakeContext() *DomainContext {
}
func (dc *DomainContext) GetNoState(key []byte, txNum uint64) ([]byte, bool, uint64, error) {
var search filesItem
search.startTxNum = txNum
search.endTxNum = txNum
var foundTxNum uint64
var foundEndTxNum uint64
var foundStartTxNum uint64
var found bool
var anyItem bool
var maxTxNum uint64
dc.files[EfHistory].AscendGreaterOrEqual(&search, func(i btree.Item) bool {
dc.files[EfHistory].Ascend(func(i btree.Item) bool {
item := i.(*filesItem)
if item.index.Empty() {
return true
}
anyItem = true
offset := item.indexReader.Lookup(key)
g := item.getter
g.Reset(offset)
@ -88,6 +84,7 @@ func (dc *DomainContext) GetNoState(key []byte, txNum uint64) ([]byte, bool, uin
} else {
maxTxNum = ef.Max()
}
anyItem = true
}
return true
})
@ -95,6 +92,7 @@ func (dc *DomainContext) GetNoState(key []byte, txNum uint64) ([]byte, bool, uin
var txKey [8]byte
binary.BigEndian.PutUint64(txKey[:], foundTxNum)
var historyItem *filesItem
var search filesItem
search.startTxNum = foundStartTxNum
search.endTxNum = foundEndTxNum
if i := dc.files[History].Get(&search); i != nil {