This is an automated email from the ASF dual-hosted git repository.
rpuch pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new cf63f01f0f IGNITE-23337 Increase CLI timeout in
ItCmgDisasterRecoveryTest (#4490)
cf63f01f0f is described below
commit cf63f01f0f49612c57657b1428e6ab19b2831f94
Author: Roman Puchkovskiy <[email protected]>
AuthorDate: Wed Oct 2 18:38:14 2024 +0400
IGNITE-23337 Increase CLI timeout in ItCmgDisasterRecoveryTest (#4490)
Also, more information is included in thrown exceptions
---
.../ignite/internal/app/IgniteServerImpl.java | 9 +++---
.../system/SystemDisasterRecoveryClient.java | 32 +++++++++++++++++++---
2 files changed, 32 insertions(+), 9 deletions(-)
diff --git
a/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteServerImpl.java
b/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteServerImpl.java
index 8cc73dfca0..058282e298 100644
---
a/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteServerImpl.java
+++
b/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteServerImpl.java
@@ -53,7 +53,6 @@ import org.apache.ignite.lang.ErrorGroups.Common;
import org.apache.ignite.lang.IgniteException;
import org.apache.ignite.lang.NodeNotStartedException;
import org.apache.ignite.lang.NodeStartException;
-import org.apache.ignite.tx.TransactionException;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
@@ -178,12 +177,12 @@ public class IgniteServerImpl implements IgniteServer {
if (joinFuture == null || !joinFuture.isDone()) {
throw new ClusterNotInitializedException();
}
- if (joinFuture.isCompletedExceptionally()) {
- throw new ClusterInitFailureException("Cluster initialization
failed.");
- }
if (joinFuture.isCancelled()) {
throw new ClusterInitFailureException("Cluster initialization
cancelled.");
}
+ if (joinFuture.isCompletedExceptionally()) {
+ throw new ClusterInitFailureException("Cluster initialization
failed.", joinFuture.handle((res, ex) -> ex).join());
+ }
}
@Override
@@ -446,7 +445,7 @@ public class IgniteServerImpl implements IgniteServer {
Throwable copy = copyExceptionWithCause(exception);
if (copy == null) {
- return new TransactionException(INTERNAL_ERR, "Cannot make a
proper copy of " + exception.getCause().getClass(), exception);
+ return new IgniteException(INTERNAL_ERR, "Cannot make a proper
copy of " + exception.getCause().getClass(), exception);
}
return copy;
diff --git
a/modules/system-disaster-recovery/src/integrationTest/java/org/apache/ignite/internal/disaster/system/SystemDisasterRecoveryClient.java
b/modules/system-disaster-recovery/src/integrationTest/java/org/apache/ignite/internal/disaster/system/SystemDisasterRecoveryClient.java
index 90fc69da66..3041882eb5 100644
---
a/modules/system-disaster-recovery/src/integrationTest/java/org/apache/ignite/internal/disaster/system/SystemDisasterRecoveryClient.java
+++
b/modules/system-disaster-recovery/src/integrationTest/java/org/apache/ignite/internal/disaster/system/SystemDisasterRecoveryClient.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.disaster.system;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.concurrent.TimeUnit.SECONDS;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
@@ -65,8 +66,9 @@ class SystemDisasterRecoveryClient {
try {
Process process = processBuilder.start();
- if (!process.waitFor(10, SECONDS)) {
- throw new RuntimeException("Process did not finish in 10
seconds");
+ if (!process.waitFor(30, SECONDS)) {
+ throw new RuntimeException("Process did not finish in time,
stdout so far '" + stdoutString(process, false)
+ + "', stderr so far '" + stderrString(process, false)
+ "'");
}
if (process.exitValue() != 0) {
throw new RuntimeException("Return code " + process.exitValue()
@@ -81,21 +83,43 @@ class SystemDisasterRecoveryClient {
}
private static String stdoutString(Process process) {
+ return stdoutString(process, true);
+ }
+
+ private static String stdoutString(Process process, boolean readFully) {
try (InputStream stdout = process.getInputStream()) {
- return new String(stdout.readAllBytes(), UTF_8);
+ return new String(streamContent(stdout, readFully), UTF_8);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
private static String stderrString(Process process) {
+ return stderrString(process, true);
+ }
+
+ private static String stderrString(Process process, boolean readFully) {
try (InputStream stderr = process.getErrorStream()) {
- return new String(stderr.readAllBytes(), UTF_8);
+ return new String(streamContent(stderr, readFully), UTF_8);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
+ private static byte[] streamContent(InputStream is, boolean readFully)
throws IOException {
+ if (readFully) {
+ return is.readAllBytes();
+ } else {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ while (is.available() > 0) {
+ baos.write(is.read());
+ }
+
+ return baos.toByteArray();
+ }
+ }
+
void initiateMigration(String oldHttpHost, int oldHttpPort, String
newHttpHost, int newHttpPort) throws InterruptedException {
LOG.info("Initiating migration, old {}:{}, new {}:{}", oldHttpHost,
oldHttpPort, newHttpHost, newHttpPort);