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

core/freezer - retry sync write to disk #1439

Merged
merged 5 commits into from
Jun 23, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion core/rawdb/freezer.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,17 +259,28 @@ func (f *freezer) TruncateAncients(items uint64) error {

// Sync flushes all data tables to disk.
func (f *freezer) Sync() error {
return f.SyncRetry(1)
}

// SyncRetry
// Quorum
// add retry to sync
func (f *freezer) SyncRetry(retry int8) error {
var errs []error
for _, table := range f.tables {
if err := table.Sync(); err != nil {
errs = append(errs, err)
}
}
if errs != nil {
if errs != nil && retry < 10 {
return fmt.Errorf("%v", errs)
} else if errs != nil {
log.Info("RETRY %i %v", retry, errs)
return f.SyncRetry(retry+1)
antonydenyer marked this conversation as resolved.
Show resolved Hide resolved
}
return nil
}
// Quorum
antonydenyer marked this conversation as resolved.
Show resolved Hide resolved

// freeze is a background thread that periodically checks the blockchain for any
// import progress and moves ancient data from the fast database into the freezer.
Expand Down