You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ma...@apache.org on 2022/10/28 22:44:16 UTC
[cassandra] branch trunk updated: track and handle errors during nodetool bootstrap resume properly
This is an automated email from the ASF dual-hosted git repository.
maedhroz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/trunk by this push:
new 8ec04361b9 track and handle errors during nodetool bootstrap resume properly
8ec04361b9 is described below
commit 8ec04361b9e098430023e4776baf1941be958475
Author: Leonard Ma <lm...@gmail.com>
AuthorDate: Fri Oct 28 13:33:20 2022 -0700
track and handle errors during nodetool bootstrap resume properly
patch by Leonard Ma; reviewed by Caleb Rackliffe and Aleksey Yeschenko for CASSANDRA-16491
---
CHANGES.txt | 1 +
src/java/org/apache/cassandra/tools/BootstrapMonitor.java | 13 ++++++++++++-
src/java/org/apache/cassandra/tools/NodeProbe.java | 2 ++
.../distributed/test/BootstrapBinaryDisabledTest.java | 1 +
4 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/CHANGES.txt b/CHANGES.txt
index 1db667c8a4..f557500753 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
4.2
+ * Nodetool bootstrap resume will now return an error if the operation fails (CASSANDRA-16491)
* Disable resumable bootstrap by default (CASSANDRA-17679)
* Include Git SHA in --verbose flag for nodetool version (CASSANDRA-17753)
* Update Byteman to 4.0.20 and Jacoco to 0.8.8 (CASSANDRA-16413)
diff --git a/src/java/org/apache/cassandra/tools/BootstrapMonitor.java b/src/java/org/apache/cassandra/tools/BootstrapMonitor.java
index 4d5863806f..12da56d31b 100644
--- a/src/java/org/apache/cassandra/tools/BootstrapMonitor.java
+++ b/src/java/org/apache/cassandra/tools/BootstrapMonitor.java
@@ -34,6 +34,7 @@ public class BootstrapMonitor extends JMXNotificationProgressListener
private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
private final PrintStream out;
private final Condition condition = newOneTimeCondition();
+ private volatile Exception error;
public BootstrapMonitor(PrintStream out)
{
@@ -66,7 +67,7 @@ public class BootstrapMonitor extends JMXNotificationProgressListener
@Override
public void handleConnectionFailed(long timestamp, String message)
{
- Exception error = new IOException(String.format("[%s] JMX connection closed. (%s)",
+ error = new IOException(String.format("[%s] JMX connection closed. (%s)",
format.format(timestamp), message));
out.println(error.getMessage());
condition.signalAll();
@@ -82,9 +83,19 @@ public class BootstrapMonitor extends JMXNotificationProgressListener
message = message + " (progress: " + (int)event.getProgressPercentage() + "%)";
}
out.println(message);
+ if (type == ProgressEventType.ERROR)
+ {
+ error = new RuntimeException(String.format("Bootstrap resume has failed with error: %s", message));
+ condition.signalAll();
+ }
if (type == ProgressEventType.COMPLETE)
{
condition.signalAll();
}
}
+
+ public Exception getError()
+ {
+ return error;
+ }
}
diff --git a/src/java/org/apache/cassandra/tools/NodeProbe.java b/src/java/org/apache/cassandra/tools/NodeProbe.java
index 6526fb21d3..7abede2ca8 100644
--- a/src/java/org/apache/cassandra/tools/NodeProbe.java
+++ b/src/java/org/apache/cassandra/tools/NodeProbe.java
@@ -2005,6 +2005,8 @@ public class NodeProbe implements AutoCloseable
{
out.println("Resuming bootstrap");
monitor.awaitCompletion();
+ if (monitor.getError() != null)
+ throw monitor.getError();
}
else
{
diff --git a/test/distributed/org/apache/cassandra/distributed/test/BootstrapBinaryDisabledTest.java b/test/distributed/org/apache/cassandra/distributed/test/BootstrapBinaryDisabledTest.java
index c7140badd2..60bc60c9c4 100644
--- a/test/distributed/org/apache/cassandra/distributed/test/BootstrapBinaryDisabledTest.java
+++ b/test/distributed/org/apache/cassandra/distributed/test/BootstrapBinaryDisabledTest.java
@@ -131,6 +131,7 @@ public class BootstrapBinaryDisabledTest extends TestBaseImpl
.failure()
.errorContains("Cannot join the ring until bootstrap completes");
+ node.nodetoolResult("bootstrap", "resume").asserts().failure();
RewriteEnabled.disable();
node.nodetoolResult("bootstrap", "resume").asserts().success();
if (isWriteSurvey)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org