Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
spacemanager: Fix S2 usecase.CheckGarbageSpaceCollector regression
S2 insists that a space expires immediately as soon as its lifetime
has passed. This conflicts with the lazy expiration implemented by
the spacemanager. The SRM used to have a workaround for this, but
that workaround was recently removed.

This patch adds a check to space manager that will report the state
as expired once the lifetime has been exceeded.

Target: trunk
Request: 2.7
Require-notes: no
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/6227/
  • Loading branch information
gbehrmann committed Nov 11, 2013
1 parent 59440b0 commit 6a0fc40
Showing 1 changed file with 14 additions and 2 deletions.
Expand Up @@ -4755,14 +4755,26 @@ public void getSpaceMetaData(GetSpaceMetaData gsmd) throws Exception{
}
Space[] spaces = new Space[tokens.length];
for(int i=0;i<spaces.length; ++i){

Space space = null;
try {
spaces[i] = getSpace(tokens[i]);
space = getSpace(tokens[i]);
// Expiration of space reservations is a background activity and is not immediate.
// S2 tests however expect the state to be accurate at any point, hence we report
// the state as EXPIRED even when the actual state has not been updated in the
// database yet. See usecase.CheckGarbageSpaceCollector (S2).
if (space.getState().equals(SpaceState.RESERVED)) {
long expirationTime = space.getExpirationTime();
if (expirationTime > -1 && expirationTime - System.currentTimeMillis() <= 0) {
space.setState(SpaceState.EXPIRED);
}
}
}
catch(Exception e) {
logger.error("failed to find space {}: {}",
tokens[i], e.getMessage());
spaces[i]= null;
}
spaces[i] = space;
}
gsmd.setSpaces(spaces);
}
Expand Down

0 comments on commit 6a0fc40

Please sign in to comment.