Skip to content

Commit

Permalink
Merge pull request #5836 from cserf/patch-5816-Reaper_not_processing_…
Browse files Browse the repository at this point in the history
…all_Epoch_tombstone_replicas_when_no_space_is_needed

 Reaper not processing all Epoch tombstone replicas when no space is needed : Closes #5816
  • Loading branch information
bari12 committed Sep 5, 2022
2 parents 331869f + 88907ad commit b78a9e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/rucio/core/replica.py
Original file line number Diff line number Diff line change
Expand Up @@ -2715,15 +2715,15 @@ def list_and_mark_unlocked_replicas(limit, bytes_=None, rse_id=None, delay_secon
)

for scope, name, path, bytes_, tombstone, state, datatype in session.execute(stmt):
if len(rows) >= limit or (needed_space is not None and total_bytes > needed_space):
if len(rows) >= limit or (not only_delete_obsolete and needed_space is not None and total_bytes > needed_space):
break
if state != ReplicaState.UNAVAILABLE:
total_bytes += bytes_

rows.append({'scope': scope, 'name': name, 'path': path,
'bytes': bytes_, 'tombstone': tombstone,
'state': state, 'datatype': datatype})
if len(rows) >= limit or (needed_space is not None and total_bytes > needed_space):
if len(rows) >= limit or (not only_delete_obsolete and needed_space is not None and total_bytes > needed_space):
break

if rows:
Expand Down Expand Up @@ -2800,7 +2800,7 @@ def list_and_mark_unlocked_replicas_no_temp_table(limit, bytes_=None, rse_id=Non
if tombstone != OBSOLETE and only_delete_obsolete:
break

if needed_space is not None and total_bytes > needed_space:
if not only_delete_obsolete and needed_space is not None and total_bytes > needed_space:
break

if state != ReplicaState.UNAVAILABLE:
Expand All @@ -2827,7 +2827,7 @@ def list_and_mark_unlocked_replicas_no_temp_table(limit, bytes_=None, rse_id=Non
if tombstone != OBSOLETE and only_delete_obsolete:
break

if needed_space is not None and total_bytes > needed_space:
if not only_delete_obsolete and needed_space is not None and total_bytes > needed_space:
break

if state != ReplicaState.UNAVAILABLE:
Expand Down
1 change: 0 additions & 1 deletion lib/rucio/tests/test_reaper.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ def test_archive_of_deleted_dids(vo, did_factory, root_account, core_config_mock
rse_core.set_rse_limits(rse_id=rse_id, name='MinFreeSpace', value=50 * file_size)
assert len(list(replica_core.list_replicas(dids=dids, rse_expression=rse_name))) == nb_files

# Check first if the reaper does not delete anything if no space is needed
reaper_cache_region.invalidate()
rse_core.set_rse_usage(rse_id=rse_id, source='storage', used=nb_files * file_size, free=323000000000)
reaper(once=True, rses=[], include_rses=rse_name, exclude_rses=None, greedy=True)
Expand Down

0 comments on commit b78a9e8

Please sign in to comment.