You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by br...@apache.org on 2021/02/19 21:31:33 UTC
[cassandra] branch trunk updated: Nodetool status to display all
available info even when bootstrapping
This is an automated email from the ASF dual-hosted git repository.
brandonwilliams 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 5ed5e84 Nodetool status to display all available info even when bootstrapping
5ed5e84 is described below
commit 5ed5e84613ef0e9664a774493db7d2604e3596e0
Author: Bereng <be...@gmail.com>
AuthorDate: Fri Feb 19 10:55:28 2021 +0100
Nodetool status to display all available info even when bootstrapping
Patch by Berenguer Blasi, reviewed by brandonwilliams for
CASSANDRA-16412
---
.../apache/cassandra/service/StorageService.java | 2 +-
.../cassandra/tools/nodetool/StatusTest.java | 28 ++++++++++++++++++++++
2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java
index 4328a6a..a8ec34d 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -5139,7 +5139,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
Keyspace keyspaceInstance = Schema.instance.getKeyspaceInstance(keyspace);
if (keyspaceInstance == null)
- throw new IllegalArgumentException("The node does not have " + keyspace + " yet, probably still bootstrapping");
+ throw new IllegalStateException("The node does not have " + keyspace + " yet, probably still bootstrapping. Effective ownership information is meaningless.");
strategy = keyspaceInstance.getReplicationStrategy();
}
diff --git a/test/unit/org/apache/cassandra/tools/nodetool/StatusTest.java b/test/unit/org/apache/cassandra/tools/nodetool/StatusTest.java
index a7f939c..f7bc937 100644
--- a/test/unit/org/apache/cassandra/tools/nodetool/StatusTest.java
+++ b/test/unit/org/apache/cassandra/tools/nodetool/StatusTest.java
@@ -25,6 +25,7 @@ import org.junit.runner.RunWith;
import org.apache.cassandra.OrderedJUnit4ClassRunner;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.locator.SimpleSnitch;
+import org.apache.cassandra.schema.SchemaConstants;
import org.apache.cassandra.service.StorageService;
import org.apache.cassandra.tools.ToolRunner;
import org.apache.cassandra.utils.FBUtilities;
@@ -66,6 +67,33 @@ public class StatusTest extends CQLTester
"-pp", "status", "-r");
}
+ /**
+ * Validate output, making sure even when bootstrapping any available info is displayed (c16412)
+ */
+ @Test
+ public void testOutputWhileBootstrapping()
+ {
+ // Deleting these tables will simulate we're bootstrapping
+ schemaChange("DROP KEYSPACE " + SchemaConstants.TRACE_KEYSPACE_NAME);
+ schemaChange("DROP KEYSPACE " + CQLTester.KEYSPACE);
+ schemaChange("DROP KEYSPACE " + CQLTester.KEYSPACE_PER_TEST);
+
+ ToolRunner.ToolResult nodetool = ToolRunner.invokeNodetool("status");
+ nodetool.assertOnCleanExit();
+ String[] lines = nodetool.getStdout().split("\\R");
+
+ String hostStatus = lines[lines.length-3].trim();
+ assertThat(hostStatus, startsWith("UN"));
+ assertThat(hostStatus, containsString(FBUtilities.getJustLocalAddress().getHostAddress()));
+ assertThat(hostStatus, matchesPattern(".*\\d+\\.\\d+ KiB.*"));
+ assertThat(hostStatus, containsString(localHostId));
+ assertThat(hostStatus, containsString(token));
+ assertThat(hostStatus, endsWith(SimpleSnitch.RACK_NAME));
+
+ String bootstrappingWarn = lines[lines.length-1].trim();;
+ assertThat(bootstrappingWarn, containsString("probably still bootstrapping. Effective ownership information is meaningless."));
+ }
+
private void validateStatusOutput(String hostForm, String... args)
{
ToolRunner.ToolResult nodetool = ToolRunner.invokeNodetool(args);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org