From 3e463cfb4f7103d976ca2d84bb4baeee9438d067 Mon Sep 17 00:00:00 2001 From: Chris Schinnerl Date: Thu, 15 Feb 2024 16:04:48 +0100 Subject: [PATCH] stores: use sum over total shards --- stores/metadata.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stores/metadata.go b/stores/metadata.go index c2e07ed00..aae62073d 100644 --- a/stores/metadata.go +++ b/stores/metadata.go @@ -641,8 +641,9 @@ func (s *SQLStore) ObjectsStats(ctx context.Context, opts api.ObjectsStatsOpts) var totalSectors int64 err = s.db. - Model(&dbSector{}). - Count(&totalSectors).Error + Model(&dbSlab{}). + Select("COALESCE(SUM(total_shards), 0)"). + Scan(&totalSectors).Error if err != nil { return api.ObjectsStatsResponse{}, err }