mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-28 14:47:16 +00:00
[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:
parent
e77f25bce6
commit
9e7f22667e
@ -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
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user