From 7d55bf2cc1d026e8f34afddaada615cc6c3b5d0b Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Fri, 18 Nov 2022 13:20:54 +0300 Subject: [PATCH] core: log persisted storage item batches count during state reset --- pkg/core/blockchain.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index 03f8c3ddc..b2351231f 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -768,6 +768,7 @@ func (bc *Blockchain) resetStateInternal(height uint32, stage stateChangeStage) cnt int storageItmsCnt int contractIDsCnt int + batchCnt int ) trieStore.Seek(storage.SeekRange{Prefix: []byte{byte(oldStoragePrefix)}}, func(k, v []byte) bool { if seekErr != nil { @@ -780,7 +781,8 @@ func (bc *Blockchain) resetStateInternal(height uint32, stage stateChangeStage) seekErr = fmt.Errorf("failed to persist intermediate batch of contract storage items and IDs: %w", seekErr) return false } - bc.log.Info("intermediate batch of contract storage items and IDs is persisted", zap.Duration("took", time.Since(p)), zap.Int("keys", keys)) + batchCnt++ + bc.log.Info("intermediate batch of contract storage items and IDs is persisted", zap.Int("batch", batchCnt), zap.Duration("took", time.Since(p)), zap.Int("keys", keys)) p = time.Now() } // May safely omit KV copying. @@ -817,7 +819,8 @@ func (bc *Blockchain) resetStateInternal(height uint32, stage stateChangeStage) if err != nil { return fmt.Errorf("failed to persist contract storage items and IDs changes to the DB: %w", err) } - bc.log.Info("last batch of contract storage items and IDs is persisted", zap.Duration("took", time.Since(p)), zap.Int("keys", keys)) + batchCnt++ + bc.log.Info("last batch of contract storage items and IDs is persisted", zap.Int("batch", batchCnt), zap.Duration("took", time.Since(p)), zap.Int("keys", keys)) bc.log.Info("contract storage items and IDs are reset", zap.Duration("took", time.Since(pStorageStart)), zap.Int("keys", storageItmsCnt), zap.Int("ids", contractIDsCnt))