This commit is contained in:
2024-06-23 19:00:18 +02:00
parent 1a75fb7f42
commit 9e916daea0
6 changed files with 11 additions and 9 deletions

View File

@@ -268,7 +268,7 @@ public class DhfsFuse extends FuseStubFS {
try {
found = fileService.readDir(path);
} catch (StatusRuntimeException e) {
if (e.getStatus().equals(Status.NOT_FOUND))
if (e.getStatus().getCode().equals(Status.NOT_FOUND.getCode()))
return -ErrorCodes.ENOENT();
else throw e;
}

View File

@@ -129,8 +129,9 @@ public class JObjectManagerImpl implements JObjectManager {
try {
readMd = objectPersistentStore.readObject("meta_" + name);
} catch (StatusRuntimeException ex) {
if (!ex.getStatus().equals(Status.NOT_FOUND)) throw ex;
return Optional.empty();
if (ex.getStatus().getCode().equals(Status.NOT_FOUND.getCode()))
return Optional.empty();
throw ex;
}
var meta = SerializationHelper.deserialize(readMd);
if (!(meta instanceof ObjectMetadata))

View File

@@ -4,10 +4,11 @@ import com.google.protobuf.ByteString;
import com.usatiuk.dhfs.objects.repository.distributed.*;
import com.usatiuk.dhfs.storage.objects.jrepository.JObject;
import com.usatiuk.dhfs.storage.objects.jrepository.JObjectManager;
import io.grpc.Status;
import io.grpc.StatusRuntimeException;
import io.quarkus.logging.Log;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import org.apache.commons.lang3.NotImplementedException;
import org.apache.commons.lang3.tuple.Pair;
import java.util.List;
@@ -57,7 +58,7 @@ public class RemoteObjectServiceClient {
if (outdated) {
Log.error("Race when trying to fetch");
throw new NotImplementedException();
throw new StatusRuntimeException(Status.ABORTED.withDescription("Race when trying to fetch"));
}
return reply.getObject().getContent();
});

View File

@@ -40,9 +40,9 @@ public class RpcClientFactory {
try {
return withObjSyncClient(hostinfo.getAddr(), hostinfo.getPort(), Optional.empty(), fn);
} catch (StatusRuntimeException e) {
if (e.getStatus().equals(Status.ABORTED)) {
if (e.getStatus().getCode().equals(Status.ABORTED.getCode())) {
continue;
} else if (e.getStatus().equals(Status.UNAVAILABLE)) {
} else if (e.getStatus().getCode().equals(Status.UNAVAILABLE.getCode())) {
Log.info("Host " + target + " is unreachable: " + e.getMessage());
remoteHostManager.handleConnectionError(target);
} else throw e;

View File

@@ -43,7 +43,7 @@ public class DhfsFuseIT {
.copy("/app", "/app")
.cmd("java", "-Xmx128M", "--add-exports", "java.base/sun.nio.ch=ALL-UNNAMED",
"-Ddhfs.objects.distributed.peerdiscovery.interval=100",
"-Ddhfs.objects.distributed.invalidation.delay=300", "-jar", "/app/quarkus-run.jar")
"-Ddhfs.objects.distributed.invalidation.delay=100", "-jar", "/app/quarkus-run.jar")
.build())
.withFileFromPath("/app", Paths.get(buildPath, "quarkus-app"));
container1 = new GenericContainer<>(image)

View File

@@ -45,7 +45,7 @@ public class DhfsFusex3IT {
.copy("/app", "/app")
.cmd("java", "-Xmx128M", "--add-exports", "java.base/sun.nio.ch=ALL-UNNAMED",
"-Ddhfs.objects.distributed.peerdiscovery.interval=100",
"-Ddhfs.objects.distributed.invalidation.delay=300", "-jar", "/app/quarkus-run.jar")
"-Ddhfs.objects.distributed.invalidation.delay=100", "-jar", "/app/quarkus-run.jar")
.build())
.withFileFromPath("/app", Paths.get(buildPath, "quarkus-app"));
container1 = new GenericContainer<>(image)