Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pool: separate cases for disk error and no space available #7731

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading