diff --git a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/filedistribution/FileDistributionRpcServer.java b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/filedistribution/FileDistributionRpcServer.java index 6a707844bdb8..dbd1c75136ca 100644 --- a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/filedistribution/FileDistributionRpcServer.java +++ b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/filedistribution/FileDistributionRpcServer.java @@ -77,7 +77,7 @@ private void declareMethods() { private static final int baseErrorCode = 0x10000; private static final int baseFileProviderErrorCode = baseErrorCode + 0x1000; - private static final int fileReferenceDoesNotExists = baseFileProviderErrorCode; + private static final int fileReferenceNotFound = baseFileProviderErrorCode; private void getFile(Request req) { req.detach(); @@ -112,8 +112,8 @@ private void downloadFile(Request req) { req.returnValues().add(new StringValue(file.get().getAbsolutePath())); log.log(Level.FINE, () -> "File reference '" + fileReference.value() + "' available at " + file.get()); } else { - log.log(Level.INFO, "File reference '" + fileReference.value() + "' not found, returning error"); - req.setError(fileReferenceDoesNotExists, "File reference '" + fileReference.value() + "' not found"); + log.log(Level.INFO, "File reference '" + fileReference.value() + "' not found"); + req.setError(fileReferenceNotFound, "File reference '" + fileReference.value() + "' not found"); } req.returnRequest(); diff --git a/fileacquirer/src/main/java/com/yahoo/filedistribution/fileacquirer/FileAcquirerImpl.java b/fileacquirer/src/main/java/com/yahoo/filedistribution/fileacquirer/FileAcquirerImpl.java index ddddcfc2170f..e28a9e9c5d22 100644 --- a/fileacquirer/src/main/java/com/yahoo/filedistribution/fileacquirer/FileAcquirerImpl.java +++ b/fileacquirer/src/main/java/com/yahoo/filedistribution/fileacquirer/FileAcquirerImpl.java @@ -2,7 +2,6 @@ package com.yahoo.filedistribution.fileacquirer; import com.yahoo.config.FileReference; -import com.yahoo.jrt.ErrorCode; import com.yahoo.jrt.Request; import com.yahoo.jrt.Spec; import com.yahoo.jrt.StringValue; @@ -19,6 +18,12 @@ import java.util.logging.Level; import java.util.logging.Logger; +import static com.yahoo.filedistribution.fileacquirer.FileAcquirerImpl.FileDistributionErrorCode.fileReferenceNotFound; +import static com.yahoo.jrt.ErrorCode.ABORT; +import static com.yahoo.jrt.ErrorCode.CONNECTION; +import static com.yahoo.jrt.ErrorCode.GENERAL_ERROR; +import static com.yahoo.jrt.ErrorCode.OVERLOAD; +import static com.yahoo.jrt.ErrorCode.TIMEOUT; import static com.yahoo.net.HostName.getLocalhost; /** @@ -36,7 +41,7 @@ static final class FileDistributionErrorCode { public static final int baseErrorCode = 0x10000; public static final int baseFileProviderErrorCode = baseErrorCode + 0x1000; - public static final int fileReferenceDoesNotExists = baseFileProviderErrorCode; + public static final int fileReferenceNotFound = baseFileProviderErrorCode; } @@ -113,7 +118,7 @@ public Target getTarget(Timer timer) throws InterruptedException { private boolean temporaryError(int errorCode) { return switch (errorCode) { - case ErrorCode.ABORT, ErrorCode.CONNECTION, ErrorCode.GENERAL_ERROR, ErrorCode.OVERLOAD, ErrorCode.TIMEOUT -> true; + case ABORT, CONNECTION, GENERAL_ERROR, OVERLOAD, TIMEOUT, fileReferenceNotFound -> true; default -> false; }; } @@ -152,10 +157,7 @@ public File waitFor(FileReference fileReference, long timeout, TimeUnit timeUnit log.log(Level.INFO, "Retrying waitFor for " + fileReference + ": " + request.errorCode() + " -- " + request.errorMessage()); Thread.sleep(1000); } else { - if (request.errorCode() == FileDistributionErrorCode.fileReferenceDoesNotExists) - throw new FileReferenceDoesNotExistException(fileReference.value()); - else - throw new RuntimeException("Wait for " + fileReference + " failed: " + request.errorMessage() + " (" + request.errorCode() + ")"); + throw new RuntimeException("Wait for " + fileReference + " failed: " + request.errorMessage() + " (" + request.errorCode() + ")"); } } while ( timer.isTimeLeft() );