storagenode/storagenodedb: fixes to row handling
Change-Id: I3813310b48337428f13678a9fcba5c8a0e0b2b2a
This commit is contained in:
parent
7d79aab14e
commit
81d53b8097
@ -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 {
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user