Skip to content

Commit

Permalink
Revert "core/rawdb: no need to run truncateFile for readonly mode (et…
Browse files Browse the repository at this point in the history
…hereum#28145)"

This reverts commit 8fc3449.
  • Loading branch information
devopsbo3 authored Nov 10, 2023
1 parent c43ff32 commit 1dc8156
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions core/rawdb/freezer_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,6 @@ func (t *freezerTable) repair() error {
}
// Ensure the index is a multiple of indexEntrySize bytes
if overflow := stat.Size() % indexEntrySize; overflow != 0 {
if t.readonly {
return fmt.Errorf("index file(path: %s, name: %s) size is not a multiple of %d", t.path, t.name, indexEntrySize)
}
truncateFreezerFile(t.index, stat.Size()-overflow) // New file can't trigger this path
}
// Retrieve the file sizes and prepare for truncation
Expand Down Expand Up @@ -273,9 +270,6 @@ func (t *freezerTable) repair() error {
// Keep truncating both files until they come in sync
contentExp = int64(lastIndex.offset)
for contentExp != contentSize {
if t.readonly {
return fmt.Errorf("freezer table(path: %s, name: %s, num: %d) is corrupted", t.path, t.name, lastIndex.filenum)
}
verbose = true
// Truncate the head file to the last offset pointer
if contentExp < contentSize {
Expand Down

0 comments on commit 1dc8156

Please sign in to comment.