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/rawdb: fix cornercase shutdown behaviour in freezer #26485

Merged
merged 8 commits into from
Jan 16, 2023
Prev Previous commit
Next Next commit
core/rawdb: avoid sync on readonly files
  • Loading branch information
holiman committed Jan 13, 2023
commit 33b075ca3245474b66692d028cfc3a6a50c265e0
8 changes: 6 additions & 2 deletions core/rawdb/freezer_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,12 @@ func (t *freezerTable) Close() error {

var errs []error
syncClose := func(f *os.File) {
if err := f.Sync(); err != nil {
errs = append(errs, err)
if !t.readonly {
// Trying to fsync a file opened in rdonly causes "Access denied"
// error on Windows.
if err := f.Sync(); err != nil {
errs = append(errs, err)
}
}
if err := f.Close(); err != nil {
errs = append(errs, err)
Expand Down