From 27a814e7a354d42c97ad53c0d7f4f889d366fee4 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Tue, 1 Nov 2022 10:34:50 +0700 Subject: [PATCH] e3_seq_exec (#719) --- state/aggregator22.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/state/aggregator22.go b/state/aggregator22.go index 597b0f57d..0c9a617d7 100644 --- a/state/aggregator22.go +++ b/state/aggregator22.go @@ -973,16 +973,18 @@ func (a *Aggregator22) BuildFilesInBackground(db kv.RoDB) error { toTxNum := (step + 1) * a.aggregationStep hasData := false - // check if db has enough data (maybe we didn't commit them yet) - lastInDB := lastIdInDB(db, a.accounts.indexKeysTable) - hasData = lastInDB >= toTxNum - if !hasData { - return nil - } a.working.Store(true) go func() { defer a.working.Store(false) + + // check if db has enough data (maybe we didn't commit them yet) + lastInDB := lastIdInDB(db, a.accounts.indexKeysTable) + hasData = lastInDB >= toTxNum + if !hasData { + return + } + // trying to create as much small-step-files as possible: // - to reduce amount of small merges // - to remove old data from db as early as possible