core: log persisted storage item batches count during state reset
This commit is contained in:
parent
f52451e582
commit
7d55bf2cc1
1 changed files with 5 additions and 2 deletions
|
@ -768,6 +768,7 @@ func (bc *Blockchain) resetStateInternal(height uint32, stage stateChangeStage)
|
||||||
cnt int
|
cnt int
|
||||||
storageItmsCnt int
|
storageItmsCnt int
|
||||||
contractIDsCnt int
|
contractIDsCnt int
|
||||||
|
batchCnt int
|
||||||
)
|
)
|
||||||
trieStore.Seek(storage.SeekRange{Prefix: []byte{byte(oldStoragePrefix)}}, func(k, v []byte) bool {
|
trieStore.Seek(storage.SeekRange{Prefix: []byte{byte(oldStoragePrefix)}}, func(k, v []byte) bool {
|
||||||
if seekErr != nil {
|
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)
|
seekErr = fmt.Errorf("failed to persist intermediate batch of contract storage items and IDs: %w", seekErr)
|
||||||
return false
|
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()
|
p = time.Now()
|
||||||
}
|
}
|
||||||
// May safely omit KV copying.
|
// May safely omit KV copying.
|
||||||
|
@ -817,7 +819,8 @@ func (bc *Blockchain) resetStateInternal(height uint32, stage stateChangeStage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to persist contract storage items and IDs changes to the DB: %w", err)
|
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)),
|
bc.log.Info("contract storage items and IDs are reset", zap.Duration("took", time.Since(pStorageStart)),
|
||||||
zap.Int("keys", storageItmsCnt),
|
zap.Int("keys", storageItmsCnt),
|
||||||
zap.Int("ids", contractIDsCnt))
|
zap.Int("ids", contractIDsCnt))
|
||||||
|
|
Loading…
Reference in a new issue