Skip to content

Commit

Permalink
sqlite: only add to pruned if record was deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Feb 16, 2024
1 parent d64c75c commit 5cf05b7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions persist/sqlite/sectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,11 @@ func pruneSectors(tx txn, ids []int64) (pruned []types.Hash256, err error) {

var root types.Hash256
err = deleteSectorStmt.QueryRow(id).Scan((*sqlHash256)(&root))
if err != nil && !errors.Is(err, sql.ErrNoRows) { // ignore rows not found
if err == nil {
pruned = append(pruned, root)
} else if err != nil && !errors.Is(err, sql.ErrNoRows) { // ignore rows not found
return nil, fmt.Errorf("failed to delete sector: %w", err)
}
pruned = append(pruned, root)
}

// decrement the usage of all changed volumes
Expand Down

0 comments on commit 5cf05b7

Please sign in to comment.