Skip to content

Commit

Permalink
dcache-qos: remove entry from rule engine table if file not found or …
Browse files Browse the repository at this point in the history
…other namespace exception

Motivation:

Code is not catching exception thrown on call to namespace
leaving entries in the file qos table which should be removed.

Modification:

Wrap call in try - catch block.  Handle Timeout exception
differently (do not remove).

Result:

Entries are properly removed if namespace check fails.

Target:  master
Requires-notes: no (unreleased)
Patch: https://rb.dcache.org/r/14105/
Acked-by: Lea
  • Loading branch information
alrossi committed Sep 27, 2023
1 parent 34b4115 commit bf9bb6c
Showing 1 changed file with 16 additions and 4 deletions.
Expand Up @@ -72,6 +72,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
import diskCacheV111.util.CacheException;
import diskCacheV111.util.PnfsHandler;
import diskCacheV111.util.PnfsId;
import diskCacheV111.util.TimeoutCacheException;
import diskCacheV111.vehicles.Message;
import dmg.cells.nucleus.CellInfoProvider;
import dmg.cells.nucleus.NoRouteToCellException;
Expand Down Expand Up @@ -437,9 +438,21 @@ public void fileQoSActionCompleted(PnfsId pnfsId, QoSAction action, Serializable
private void fileQoSStatusChanged(FileQoSUpdate update) throws QoSException {
PnfsId pnfsId = update.getPnfsId();
QoSMessageType messageType = update.getMessageType();
FileQoSRequirements requirements = requirementsListener.fileQoSRequirementsRequested(update);
FileQoSRequirements requirements = null;

// null requirements here means file deletion
try {
requirements = requirementsListener.fileQoSRequirementsRequested(update);
} catch (QoSException e) {
if (e.getCause() instanceof TimeoutCacheException) {
LOGGER.warn("namespace currently busy or unavailable; "
+ "could not change status for {}.", pnfsId);
return;
}
}

/*
* null requirements here means fatal exception or deletion of file
*/
if (requirements == null) {
engineDao.delete(pnfsId);
return;
Expand Down Expand Up @@ -592,8 +605,7 @@ private void updateQosOnNamespace(PnfsId pnfsId, FileAttributes attributes)
}

/*
* Maintains the two state tables. Temporary states have a state index and expiration;
* the permanent states carry only the pnfsid. The latter are accessed by the scanner.
* Maintains the state table. Temporary states have a state index and expiration.
*/
private void updateQoSTransition(PnfsId pnfsId, FileAttributes fileAttributes)
throws QoSException {
Expand Down

0 comments on commit bf9bb6c

Please sign in to comment.