mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-01 00:31:21 +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
|
closeAll := true
|
||||||
step := a.txNum / a.aggregationStep
|
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)
|
collation, err := a.collate(step, step*a.aggregationStep, (step+1)*a.aggregationStep, a.rwTx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -58,21 +58,17 @@ func (d *Domain) MakeContext() *DomainContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (dc *DomainContext) GetNoState(key []byte, txNum uint64) ([]byte, bool, uint64, error) {
|
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 foundTxNum uint64
|
||||||
var foundEndTxNum uint64
|
var foundEndTxNum uint64
|
||||||
var foundStartTxNum uint64
|
var foundStartTxNum uint64
|
||||||
var found bool
|
var found bool
|
||||||
var anyItem bool
|
var anyItem bool
|
||||||
var maxTxNum uint64
|
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)
|
item := i.(*filesItem)
|
||||||
if item.index.Empty() {
|
if item.index.Empty() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
anyItem = true
|
|
||||||
offset := item.indexReader.Lookup(key)
|
offset := item.indexReader.Lookup(key)
|
||||||
g := item.getter
|
g := item.getter
|
||||||
g.Reset(offset)
|
g.Reset(offset)
|
||||||
@ -88,6 +84,7 @@ func (dc *DomainContext) GetNoState(key []byte, txNum uint64) ([]byte, bool, uin
|
|||||||
} else {
|
} else {
|
||||||
maxTxNum = ef.Max()
|
maxTxNum = ef.Max()
|
||||||
}
|
}
|
||||||
|
anyItem = true
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
@ -95,6 +92,7 @@ func (dc *DomainContext) GetNoState(key []byte, txNum uint64) ([]byte, bool, uin
|
|||||||
var txKey [8]byte
|
var txKey [8]byte
|
||||||
binary.BigEndian.PutUint64(txKey[:], foundTxNum)
|
binary.BigEndian.PutUint64(txKey[:], foundTxNum)
|
||||||
var historyItem *filesItem
|
var historyItem *filesItem
|
||||||
|
var search filesItem
|
||||||
search.startTxNum = foundStartTxNum
|
search.startTxNum = foundStartTxNum
|
||||||
search.endTxNum = foundEndTxNum
|
search.endTxNum = foundEndTxNum
|
||||||
if i := dc.files[History].Get(&search); i != nil {
|
if i := dc.files[History].Get(&search); i != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user