mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-28 14:47:16 +00:00
e3: reconst MakeSteps - to check that files are indexed (#789)
This commit is contained in:
parent
2cabdd37fc
commit
f239b04a72
@ -1293,7 +1293,16 @@ type AggregatorStep struct {
|
||||
}
|
||||
|
||||
func (a *Aggregator22) MakeSteps() []*AggregatorStep {
|
||||
accountSteps := a.accounts.MakeSteps()
|
||||
to := a.maxTxNum.Load()
|
||||
indexedMax := cmp.Min(
|
||||
cmp.Min(a.accounts.endIndexedTxNumMinimax(), a.storage.endIndexedTxNumMinimax()),
|
||||
a.code.endIndexedTxNumMinimax(),
|
||||
)
|
||||
if to != indexedMax {
|
||||
log.Warn("[snapshots] not all files are indexed", "files", to/a.aggregationStep, "indexed", indexedMax/a.aggregationStep)
|
||||
to = cmp.Min(to, indexedMax)
|
||||
}
|
||||
accountSteps := a.accounts.MakeSteps(to)
|
||||
steps := make([]*AggregatorStep, len(accountSteps))
|
||||
for i, accountStep := range accountSteps {
|
||||
steps[i] = &AggregatorStep{
|
||||
@ -1301,11 +1310,11 @@ func (a *Aggregator22) MakeSteps() []*AggregatorStep {
|
||||
accounts: accountStep,
|
||||
}
|
||||
}
|
||||
storageSteps := a.storage.MakeSteps()
|
||||
storageSteps := a.storage.MakeSteps(to)
|
||||
for i, storageStep := range storageSteps {
|
||||
steps[i].storage = storageStep
|
||||
}
|
||||
codeSteps := a.code.MakeSteps()
|
||||
codeSteps := a.code.MakeSteps(to)
|
||||
for i, codeStep := range codeSteps {
|
||||
steps[i].code = codeStep
|
||||
}
|
||||
|
@ -1676,12 +1676,17 @@ type HistoryStep struct {
|
||||
historyFile ctxItem
|
||||
}
|
||||
|
||||
func (h *History) MakeSteps() []*HistoryStep {
|
||||
// MakeSteps [0, toTxNum)
|
||||
func (h *History) MakeSteps(toTxNum uint64) []*HistoryStep {
|
||||
var steps []*HistoryStep
|
||||
h.InvertedIndex.files.Ascend(func(item *filesItem) bool {
|
||||
if item.index == nil {
|
||||
return false
|
||||
}
|
||||
if item.startTxNum >= toTxNum {
|
||||
return true
|
||||
}
|
||||
|
||||
step := &HistoryStep{
|
||||
compressVals: h.compressVals,
|
||||
indexItem: item,
|
||||
@ -1700,6 +1705,9 @@ func (h *History) MakeSteps() []*HistoryStep {
|
||||
if item.index == nil {
|
||||
return false
|
||||
}
|
||||
if item.startTxNum >= toTxNum {
|
||||
return true
|
||||
}
|
||||
steps[i].historyItem = item
|
||||
steps[i].historyFile = ctxItem{
|
||||
startTxNum: item.startTxNum,
|
||||
|
@ -55,6 +55,16 @@ func (ii *InvertedIndex) endTxNumMinimax() uint64 {
|
||||
}
|
||||
return minimax
|
||||
}
|
||||
func (ii *InvertedIndex) endIndexedTxNumMinimax() uint64 {
|
||||
var max uint64
|
||||
ii.files.Ascend(func(item *filesItem) bool {
|
||||
if item.index != nil {
|
||||
max = cmp.Max(max, item.endTxNum)
|
||||
}
|
||||
return true
|
||||
})
|
||||
return max
|
||||
}
|
||||
|
||||
func (h *History) endTxNumMinimax() uint64 {
|
||||
minimax := h.InvertedIndex.endTxNumMinimax()
|
||||
@ -66,6 +76,17 @@ func (h *History) endTxNumMinimax() uint64 {
|
||||
}
|
||||
return minimax
|
||||
}
|
||||
func (h *History) endIndexedTxNumMinimax() uint64 {
|
||||
var max uint64
|
||||
h.files.Ascend(func(item *filesItem) bool {
|
||||
if item.index == nil {
|
||||
return false
|
||||
}
|
||||
max = cmp.Max(max, item.endTxNum)
|
||||
return true
|
||||
})
|
||||
return cmp.Min(max, h.InvertedIndex.endIndexedTxNumMinimax())
|
||||
}
|
||||
|
||||
type DomainRanges struct {
|
||||
valuesStartTxNum uint64
|
||||
|
Loading…
Reference in New Issue
Block a user