Skip to content
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
8 changes: 5 additions & 3 deletions core/rawdb/freezer_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,10 @@ func (t *freezerTable) repair() error {
}
}
// Ensure the index is a multiple of indexEntrySize bytes
if overflow := stat.Size() % indexEntrySize; overflow != 0 {
truncateFreezerFile(t.index, stat.Size()-overflow) // New file can't trigger this path
if !t.readonly {
if overflow := stat.Size() % indexEntrySize; overflow != 0 {
truncateFreezerFile(t.index, stat.Size()-overflow) // New file can't trigger this path
}
}
// Retrieve the file sizes and prepare for truncation
if stat, err = t.index.Stat(); err != nil {
Expand Down Expand Up @@ -269,7 +271,7 @@ func (t *freezerTable) repair() error {

// Keep truncating both files until they come in sync
contentExp = int64(lastIndex.offset)
for contentExp != contentSize {
for !t.readonly && contentExp != contentSize {
verbose = true
// Truncate the head file to the last offset pointer
if contentExp < contentSize {
Expand Down