Skip to content

Commit

Permalink
pool: separate cases for disk error and no space available
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mksahakyan committed Dec 19, 2024
1 parent abe4bd9 commit bfbf240
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,27 @@
*/
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);
}

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;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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));
Expand Down

0 comments on commit bfbf240

Please sign in to comment.