From bfbf240c1d21b73dd4792d1be98eae1f3bc28d86 Mon Sep 17 00:00:00 2001 From: sahakya Date: Fri, 29 Nov 2024 14:20:33 +0100 Subject: [PATCH] pool: separate cases for disk error and no space available Motivation when there are no avvailable space on a pool, the pool will go to DISABLED mode and no data could be read anymore. This is wrong we still want to be able to read data from the file. Modification this is a temp change, trying to get the info from the eroor message, sice therer is no a specific error code, and then based on that info separate two cases DISABLED AND READONLY Acked-by: Tigran Mkrtchyan Target: master. 10.2, 10.1, 10.0, 9.2 Require-book: no Require-notes: yes Commited:master@862963e --- .../util/DiskErrorCacheException.java | 14 +++++++++++ .../pool/classic/MoverRequestScheduler.java | 24 +++++++++++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/modules/dcache-vehicles/src/main/java/diskCacheV111/util/DiskErrorCacheException.java b/modules/dcache-vehicles/src/main/java/diskCacheV111/util/DiskErrorCacheException.java index 2545d2452fe..5429cb86c9a 100644 --- a/modules/dcache-vehicles/src/main/java/diskCacheV111/util/DiskErrorCacheException.java +++ b/modules/dcache-vehicles/src/main/java/diskCacheV111/util/DiskErrorCacheException.java @@ -14,8 +14,13 @@ */ public class DiskErrorCacheException extends CacheException { + private static final long serialVersionUID = -5386946146340646052L; + public enum FileStoreState { + READ_ONLY, FAILED + } + public DiskErrorCacheException(String msg) { super(CacheException.ERROR_IO_DISK, msg); } @@ -23,4 +28,13 @@ public DiskErrorCacheException(String msg) { public DiskErrorCacheException(String message, Throwable cause) { super(CacheException.ERROR_IO_DISK, message, cause); } + + public FileStoreState checkStatus(String message) { + if (message.contains("No space available.")) { + return FileStoreState.READ_ONLY; + } else { + return FileStoreState.FAILED; + } + } + } diff --git a/modules/dcache/src/main/java/org/dcache/pool/classic/MoverRequestScheduler.java b/modules/dcache/src/main/java/org/dcache/pool/classic/MoverRequestScheduler.java index 7504d09c647..dde02e9cd52 100644 --- a/modules/dcache/src/main/java/org/dcache/pool/classic/MoverRequestScheduler.java +++ b/modules/dcache/src/main/java/org/dcache/pool/classic/MoverRequestScheduler.java @@ -513,8 +513,19 @@ public void failed(Throwable exc, Void attachment) { .setTransferStatus(CacheException.DEFAULT_ERROR_CODE, "Transfer was killed"); } else if (exc instanceof DiskErrorCacheException) { + FaultAction faultAction = null; + //TODO this is done because the FileStoreState is in another module + // to be improved + switch (((DiskErrorCacheException) exc).checkStatus(exc.getMessage())){ + case READ_ONLY: + faultAction = FaultAction.READONLY; + break; + default: + faultAction = FaultAction.DISABLED; + break; + } FaultEvent faultEvent = new FaultEvent("transfer", - FaultAction.DISABLED, exc.getMessage(), exc); + faultAction, exc.getMessage(), exc); _faultListeners.forEach(l -> l.faultOccurred(faultEvent)); } postprocess(); @@ -532,9 +543,18 @@ public void completed(Void result, Void attachment) { @Override public void failed(Throwable exc, Void attachment) { if (exc instanceof DiskErrorCacheException) { + FaultAction faultAction = null; + switch (((DiskErrorCacheException) exc).checkStatus(exc.getMessage())){ + case READ_ONLY: + faultAction = FaultAction.READONLY; + break; + default: + faultAction = FaultAction.DISABLED; + break; + } FaultEvent faultEvent = new FaultEvent( "post-processing", - FaultAction.DISABLED, + faultAction, exc.getMessage(), exc); _faultListeners.forEach( l -> l.faultOccurred(faultEvent));