mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 17:44:29 +00:00
e3: cancel background build (#782)
This commit is contained in:
parent
67815f5faa
commit
9a8477f65c
@ -1014,7 +1014,7 @@ func (a *Aggregator22) deleteFiles(outs SelectedStaticFiles22) error {
|
|||||||
// we can set it to 0, because no re-org on this blocks are possible
|
// we can set it to 0, because no re-org on this blocks are possible
|
||||||
func (a *Aggregator22) KeepInDB(v uint64) { a.keepInDB = v }
|
func (a *Aggregator22) KeepInDB(v uint64) { a.keepInDB = v }
|
||||||
|
|
||||||
func (a *Aggregator22) BuildFilesInBackground(db kv.RoDB) error {
|
func (a *Aggregator22) BuildFilesInBackground(ctx context.Context, db kv.RoDB) error {
|
||||||
if (a.txNum.Load() + 1) <= a.maxTxNum.Load()+a.aggregationStep+a.keepInDB { // Leave one step worth in the DB
|
if (a.txNum.Load() + 1) <= a.maxTxNum.Load()+a.aggregationStep+a.keepInDB { // Leave one step worth in the DB
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -1043,7 +1043,7 @@ func (a *Aggregator22) BuildFilesInBackground(db kv.RoDB) error {
|
|||||||
// - to remove old data from db as early as possible
|
// - to remove old data from db as early as possible
|
||||||
// - during files build, may happen commit of new data. on each loop step getting latest id in db
|
// - during files build, may happen commit of new data. on each loop step getting latest id in db
|
||||||
for step < lastIdInDB(db, a.accounts.indexKeysTable)/a.aggregationStep {
|
for step < lastIdInDB(db, a.accounts.indexKeysTable)/a.aggregationStep {
|
||||||
if err := a.buildFilesInBackground(context.Background(), step, db); err != nil {
|
if err := a.buildFilesInBackground(ctx, step, db); err != nil {
|
||||||
log.Warn("buildFilesInBackground", "err", err)
|
log.Warn("buildFilesInBackground", "err", err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -1056,7 +1056,7 @@ func (a *Aggregator22) BuildFilesInBackground(db kv.RoDB) error {
|
|||||||
defer a.workingMerge.Store(true)
|
defer a.workingMerge.Store(true)
|
||||||
go func() {
|
go func() {
|
||||||
defer a.workingMerge.Store(false)
|
defer a.workingMerge.Store(false)
|
||||||
if err := a.MergeLoop(context.Background(), 1); err != nil {
|
if err := a.MergeLoop(ctx, 1); err != nil {
|
||||||
log.Warn("merge", "err", err)
|
log.Warn("merge", "err", err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Loading…
Reference in New Issue
Block a user