Skip to content

Commit b746891

Browse files
authored
fix(cdn): select item inside at least n storage_unit (#5847)
1 parent 7f439a6 commit b746891

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

engine/cdn/cdn_gc_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ func TestCleanSynchronizedItemWithDisabledStorage(t *testing.T) {
324324

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

329329
iusFS2After, err := storage.LoadItemUnitsByUnit(context.TODO(), s.Mapper, db, s.Units.Storages[0].ID(), &oneHundred)
330330
require.NoError(t, err)

engine/cdn/storage/dao.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func LoadAllSynchronizedItemIDs(db gorp.SqlExecutor, bufferUnitID string, maxSto
149149
FROM storage_unit_item
150150
WHERE item_id = ANY (select item_id from inBuffer)
151151
GROUP BY item_id
152-
HAVING COUNT(unit_id) = $1
152+
HAVING COUNT(unit_id) >= $1
153153
`
154154
if _, err := db.Select(&itemIDs, query, maxStorageCount, bufferUnitID); err != nil {
155155
return nil, sdk.WrapError(err, "unable to get item ids")

0 commit comments

Comments
 (0)