Skip to content

Commit

Permalink
database: skip undeletable file during prune
Browse files Browse the repository at this point in the history
  • Loading branch information
kcalvinalvin committed Jul 1, 2024
1 parent d881c68 commit b627ded
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions database/ffldb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -1632,9 +1632,12 @@ func (tx *transaction) writePendingAndCommit() error {
for _, fileNum := range tx.pendingDelFileNums {
err := tx.db.store.deleteFileFunc(fileNum)
if err != nil {
// Nothing we can do if we fail to delete blocks besides
// return an error.
return err
// Try again.
err := tx.db.store.deleteFileFunc(fileNum)
if err != nil {
// Nothing we can do if we fail to delete a file.
log.Warnf("Failed to delete file %d. %v", fileNum, err)
}
}
}

Expand Down Expand Up @@ -1779,7 +1782,8 @@ func (tx *transaction) PruneBlocks(targetSize uint64) ([]chainhash.Hash, error)
}
}

log.Tracef("Finished pruning. Database now at %d bytes", totalSize)
log.Tracef("Finished pruning. Database will be reduced to %d bytes "+
"after this transaction is committed", totalSize)

return deletedBlockHashes, nil
}
Expand Down

0 comments on commit b627ded

Please sign in to comment.