Skip to content

Commit

Permalink
stores: fix RefreshHealth for MySQL
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisSchinnerl committed Nov 29, 2023
1 parent cc0082f commit a376213
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion stores/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -1941,9 +1941,16 @@ LIMIT ?
rowsAffected = res.RowsAffected

// Update the health of the objects associated with the updated slabs.
return tx.Exec(`UPDATE objects SET health = src.health FROM src
if isSQLite(s.db) {
return tx.Exec(`UPDATE objects SET health = src.health FROM src
INNER JOIN slices ON slices.db_slab_id = src.id
WHERE slices.db_object_id = objects.id`).Error
} else {
return tx.Exec(`UPDATE objects
INNER JOIN slices sli ON sli.db_object_id = objects.id
INNER JOIN src s ON s.id = sli.db_slab_id
SET objects.health = s.health`).Error
}
})
if err != nil {
return err
Expand Down

0 comments on commit a376213

Please sign in to comment.