diff --git a/storagenode/storagenodedb/bandwidthdb.go b/storagenode/storagenodedb/bandwidthdb.go index d6d305425..6112279fb 100644 --- a/storagenode/storagenodedb/bandwidthdb.go +++ b/storagenode/storagenodedb/bandwidthdb.go @@ -214,7 +214,6 @@ func (db *bandwidthDB) getSatelliteSummary(ctx context.Context, satelliteID stor if err != nil { return nil, ErrBandwidth.Wrap(err) } - defer func() { err = ErrBandwidth.Wrap(errs.Combine(err, rows.Close())) }() @@ -232,7 +231,7 @@ func (db *bandwidthDB) getSatelliteSummary(ctx context.Context, satelliteID stor filter(action, amount, usage) } - return usage, nil + return usage, ErrBandwidth.Wrap(rows.Err()) } // SummaryBySatellite returns summary of bandwidth usage grouping by satellite. @@ -382,7 +381,6 @@ func (db *bandwidthDB) getDailyUsageRollups(ctx context.Context, cond string, ar if err != nil { return nil, ErrBandwidth.Wrap(err) } - defer func() { err = ErrBandwidth.Wrap(errs.Combine(err, rows.Close())) }() @@ -433,7 +431,7 @@ func (db *bandwidthDB) getDailyUsageRollups(ctx context.Context, cond string, ar usageRollups = append(usageRollups, *usageRollupsByDate[d]) } - return usageRollups, nil + return usageRollups, ErrBandwidth.Wrap(rows.Err()) } func getBeginningOfMonth(now time.Time) time.Time { diff --git a/storagenode/storagenodedb/notifications.go b/storagenode/storagenodedb/notifications.go index 30a4d11b6..f15a69d54 100644 --- a/storagenode/storagenodedb/notifications.go +++ b/storagenode/storagenodedb/notifications.go @@ -151,7 +151,7 @@ func (db *notificationDB) List(ctx context.Context, cursor notifications.Cursor) page.CurrentPage = cursor.Page - return page, nil + return page, ErrNotificationsDB.Wrap(rows.Err()) } // Read updates specific notification in database as read. diff --git a/storagenode/storagenodedb/pieceexpiration.go b/storagenode/storagenodedb/pieceexpiration.go index 1108df44d..1b68478db 100644 --- a/storagenode/storagenodedb/pieceexpiration.go +++ b/storagenode/storagenodedb/pieceexpiration.go @@ -53,7 +53,7 @@ func (db *pieceExpirationDB) GetExpired(ctx context.Context, expiresBefore time. InPieceInfo: false, }) } - return expiredPieceIDs, nil + return expiredPieceIDs, rows.Err() } // SetExpiration sets an expiration time for the given piece ID on the given satellite diff --git a/storagenode/storagenodedb/pieceinfo.go b/storagenode/storagenodedb/pieceinfo.go index 0a9cb1b42..617acd851 100644 --- a/storagenode/storagenodedb/pieceinfo.go +++ b/storagenode/storagenodedb/pieceinfo.go @@ -81,7 +81,7 @@ func (db *v0PieceInfoDB) getAllPiecesOwnedBy(ctx context.Context, blobStore stor return nil, ErrPieceInfo.Wrap(err) } } - return pieceInfos, nil + return pieceInfos, rows.Err() } // WalkSatelliteV0Pieces executes walkFunc for each locally stored piece, stored with storage @@ -203,7 +203,7 @@ func (db *v0PieceInfoDB) GetExpired(ctx context.Context, expiredAt time.Time, li } infos = append(infos, info) } - return infos, nil + return infos, rows.Err() } type v0StoredPieceAccess struct { diff --git a/storagenode/storagenodedb/piecespaceused.go b/storagenode/storagenodedb/piecespaceused.go index 6a6797768..a7c163b25 100644 --- a/storagenode/storagenodedb/piecespaceused.go +++ b/storagenode/storagenodedb/piecespaceused.go @@ -156,7 +156,7 @@ func (db *pieceSpaceUsedDB) GetPieceTotalsForAllSatellites(ctx context.Context) } totalBySatellite[satelliteID] = total } - return totalBySatellite, nil + return totalBySatellite, rows.Err() } // UpdatePieceTotal updates the record for total spaced used with a new value diff --git a/storagenode/storagenodedb/reputation.go b/storagenode/storagenodedb/reputation.go index 8fdf9f141..c9e8847ae 100644 --- a/storagenode/storagenodedb/reputation.go +++ b/storagenode/storagenodedb/reputation.go @@ -168,5 +168,5 @@ func (db *reputationDB) All(ctx context.Context) (_ []reputation.Stats, err erro statsList = append(statsList, stats) } - return statsList, nil + return statsList, rows.Err() } diff --git a/storagenode/storagenodedb/satellites.go b/storagenode/storagenodedb/satellites.go index d7904a594..1b7d4ef42 100644 --- a/storagenode/storagenodedb/satellites.go +++ b/storagenode/storagenodedb/satellites.go @@ -41,7 +41,7 @@ func (db *satellitesDB) GetSatellite(ctx context.Context, satelliteID storj.Node return satellite, err } } - return satellite, nil + return satellite, rows.Err() } // InitiateGracefulExit updates the database to reflect the beginning of a graceful exit @@ -112,5 +112,5 @@ func (db *satellitesDB) ListGracefulExits(ctx context.Context) (exitList []satel exitList = append(exitList, exit) } - return exitList, nil + return exitList, rows.Err() } diff --git a/storagenode/storagenodedb/storageusage.go b/storagenode/storagenodedb/storageusage.go index 91aa7e027..3222b340a 100644 --- a/storagenode/storagenodedb/storageusage.go +++ b/storagenode/storagenodedb/storageusage.go @@ -64,10 +64,7 @@ func (db *storageUsageDB) GetDaily(ctx context.Context, satelliteID storj.NodeID if err != nil { return nil, err } - - defer func() { - err = errs.Combine(err, rows.Close()) - }() + defer func() { err = errs.Combine(err, rows.Close()) }() var stamps []storageusage.Stamp for rows.Next() { @@ -87,7 +84,7 @@ func (db *storageUsageDB) GetDaily(ctx context.Context, satelliteID storj.NodeID }) } - return stamps, nil + return stamps, rows.Err() } // GetDailyTotal returns daily storage usage stamps summed across all known satellites @@ -105,7 +102,6 @@ func (db *storageUsageDB) GetDailyTotal(ctx context.Context, from, to time.Time) if err != nil { return nil, err } - defer func() { err = errs.Combine(err, rows.Close()) }() @@ -126,7 +122,7 @@ func (db *storageUsageDB) GetDailyTotal(ctx context.Context, from, to time.Time) }) } - return stamps, nil + return stamps, rows.Err() } // Summary returns aggregated storage usage across all satellites.