diff --git a/src/main/java/it/cavallium/rockserver/core/client/GrpcConnection.java b/src/main/java/it/cavallium/rockserver/core/client/GrpcConnection.java index 2a17c4a..2bbfa52 100644 --- a/src/main/java/it/cavallium/rockserver/core/client/GrpcConnection.java +++ b/src/main/java/it/cavallium/rockserver/core/client/GrpcConnection.java @@ -9,6 +9,7 @@ import com.google.protobuf.ByteString; import com.google.protobuf.UnsafeByteOperations; import io.grpc.ManagedChannel; import io.grpc.Status; +import io.grpc.Status.Code; import io.grpc.StatusRuntimeException; import io.grpc.netty.NettyChannelBuilder; import io.netty.channel.epoll.EpollDomainSocketChannel; @@ -580,7 +581,7 @@ public class GrpcConnection extends BaseConnection implements RocksDBAPI { private static Throwable mapGrpcStatusError(@NotNull Throwable t) { if (t instanceof StatusRuntimeException statusRuntimeException - && statusRuntimeException.getStatus() == Status.INTERNAL + && statusRuntimeException.getStatus().getCode() == Code.INTERNAL && statusRuntimeException.getStatus().getDescription() != null && statusRuntimeException.getStatus().getDescription().startsWith(grpcRocksDbErrorPrefixString)) { var desc = statusRuntimeException.getStatus().getDescription(); diff --git a/src/main/java/it/cavallium/rockserver/core/server/GrpcServer.java b/src/main/java/it/cavallium/rockserver/core/server/GrpcServer.java index 1b48d03..09686a9 100644 --- a/src/main/java/it/cavallium/rockserver/core/server/GrpcServer.java +++ b/src/main/java/it/cavallium/rockserver/core/server/GrpcServer.java @@ -301,6 +301,7 @@ public class GrpcServer extends Server { @Override public Mono putGetChanged(PutRequest request) { return executeSync(() -> { + if(true) throw new RocksDBRetryException(); try (var arena = Arena.ofConfined()) { var changed = api.put(arena, request.getTransactionOrUpdateId(), @@ -564,7 +565,7 @@ public class GrpcServer extends Server { @Override protected Throwable onErrorMap(Throwable throwable) { var ex = handleError(throwable).asException(); - if (ex.getStatus().getCode() == Code.INTERNAL && !(throwable instanceof RocksDBException)) { + if (ex.getStatus().getCode() == Code.INTERNAL && !(throwable.getCause() instanceof RocksDBException)) { LOG.error("Unexpected internal error during request", ex); } return ex;