Skip to content

Commit

Permalink
Fix unpack cache reclaimer (#3605)
Browse files Browse the repository at this point in the history
PBENCH-1318

The reclaimer defaulted to 20%, which is inappropriate for an unpack reclaim
where we want to free just enough for the unpacked dataset size.

Also, to help diagnose, add the last referenced cache date to the reclaim log
message.
  • Loading branch information
dbutenhof committed Jan 26, 2024
1 parent 4a02f97 commit eb05b79
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/pbench/server/cache_manager.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections import deque
from dataclasses import dataclass
from datetime import datetime
from enum import auto, Enum
import errno
import fcntl
Expand Down Expand Up @@ -1524,7 +1525,7 @@ def delete(self, dataset_id: str):

self._clean_empties(tarball.controller_name)

def reclaim_cache(self, goal_pct: float = 20.0, goal_bytes: int = 0) -> bool:
def reclaim_cache(self, goal_pct: float = 0.0, goal_bytes: int = 0) -> bool:
"""Reclaim unused caches to free disk space.
The cache tree need not be fully discovered at this point; we can
Expand Down Expand Up @@ -1620,7 +1621,10 @@ def reached_goal() -> GoalCheck:
target = None
error = None
try:
self.logger.info("RECLAIM: removing cache for {}", name)
ts = datetime.fromtimestamp(candidate.last_ref)
self.logger.info(
"RECLAIM: removing cache for {} (referenced {})", name, ts
)
with LockManager(cache_d / "lock", exclusive=True, wait=False):
try:
if target:
Expand Down

0 comments on commit eb05b79

Please sign in to comment.