Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes in import-db for rc/v1.6.0 #5522

Merged
merged 7 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -29,6 +29,11 @@ func (r *requester) SetDebugHandler(_ dataRetriever.DebugHandler) error {
return nil
}

// RequestDataFromHashArray returns nil as it is disabled
func (r *requester) RequestDataFromHashArray(_ [][]byte, _ uint32) error {
return nil
}

// IsInterfaceNil returns true if there is no value under the interface
func (r *requester) IsInterfaceNil() bool {
return r == nil
Expand Down
12 changes: 9 additions & 3 deletions state/snapshotsManager.go
Expand Up @@ -247,14 +247,14 @@ func (sm *snapshotsManager) snapshotState(
})
if err != nil {
log.Error("error waiting for storage epoch change", "err", err)
sm.earlySnapshotCompletion(stats)
sm.earlySnapshotCompletion(stats, trieStorageManager)
return
}

if !trieStorageManager.ShouldTakeSnapshot() {
log.Debug("skipping snapshot", "rootHash", rootHash, "epoch", epoch)

sm.earlySnapshotCompletion(stats)
sm.earlySnapshotCompletion(stats, trieStorageManager)
return
}

Expand All @@ -277,15 +277,21 @@ func (sm *snapshotsManager) snapshotState(
go sm.processSnapshotCompletion(stats, trieStorageManager, missingNodesChannel, iteratorChannels.ErrChan, rootHash, epoch)
}

func (sm *snapshotsManager) earlySnapshotCompletion(stats *snapshotStatistics) {
func (sm *snapshotsManager) earlySnapshotCompletion(stats *snapshotStatistics, trieStorageManager common.StorageManager) {
sm.mutex.Lock()
defer sm.mutex.Unlock()

stats.SnapshotFinished()
sm.isSnapshotInProgress.Reset()
trieStorageManager.ExitPruningBufferingMode()
}

func (sm *snapshotsManager) waitForStorageEpochChange(args storageEpochChangeWaitArgs) error {
if sm.processingMode == common.ImportDb {
log.Debug("no need to wait for storage epoch change as the node is running in import-db mode")
return nil
}

if args.SnapshotWaitTimeout < args.WaitTimeForSnapshotEpochCheck {
return fmt.Errorf("timeout (%s) must be greater than wait time between snapshot epoch check (%s)", args.SnapshotWaitTimeout, args.WaitTimeForSnapshotEpochCheck)
}
Expand Down