Skip to content

Commit

Permalink
fix(cdn): select item inside at least n storage_unit (#5847)
Browse files Browse the repository at this point in the history
  • Loading branch information
sguiheux committed Jun 15, 2021
1 parent 7f439a6 commit b746891
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion engine/cdn/cdn_gc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ func TestCleanSynchronizedItemWithDisabledStorage(t *testing.T) {

iusRedisAfter, err := storage.LoadItemUnitsByUnit(context.TODO(), s.Mapper, db, s.Units.LogsBuffer().ID(), &oneHundred)
require.NoError(t, err)
require.Equal(t, 2, len(iusRedisAfter))
require.Equal(t, 1, len(iusRedisAfter))

iusFS2After, err := storage.LoadItemUnitsByUnit(context.TODO(), s.Mapper, db, s.Units.Storages[0].ID(), &oneHundred)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion engine/cdn/storage/dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func LoadAllSynchronizedItemIDs(db gorp.SqlExecutor, bufferUnitID string, maxSto
FROM storage_unit_item
WHERE item_id = ANY (select item_id from inBuffer)
GROUP BY item_id
HAVING COUNT(unit_id) = $1
HAVING COUNT(unit_id) >= $1
`
if _, err := db.Select(&itemIDs, query, maxStorageCount, bufferUnitID); err != nil {
return nil, sdk.WrapError(err, "unable to get item ids")
Expand Down

0 comments on commit b746891

Please sign in to comment.