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 2017/06/02 13:53:35 UTC
[2/6] cassandra git commit: nodetool scrub/cleanup/upgradesstables
exit code
nodetool scrub/cleanup/upgradesstables exit code
Patch by marcuse; reviewed by Jeff Jirsa for CASSANDRA-13542
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6bf5cf7f
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6bf5cf7f
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6bf5cf7f
Branch: refs/heads/cassandra-3.11
Commit: 6bf5cf7f090eef853c02711bf4079b0f16748088
Parents: e22cb27
Author: Marcus Eriksson <ma...@apache.org>
Authored: Mon May 22 08:46:17 2017 +0200
Committer: Marcus Eriksson <ma...@apache.org>
Committed: Fri Jun 2 15:49:17 2017 +0200
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../db/compaction/CompactionManager.java | 12 ++++-
.../org/apache/cassandra/tools/NodeProbe.java | 48 +++++++++++++++-----
3 files changed, 47 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bf5cf7f/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 4232084..8ab8422 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
3.0.14
+ * nodetool scrub/cleanup/upgradesstables exit code is wrong (CASSANDRA-13542)
* Fix the reported number of sstable data files accessed per read (CASSANDRA-13120)
* Fix schema digest mismatch during rolling upgrades from versions before 3.0.12 (CASSANDRA-13559)
* Upgrade JNA version to 4.4.0 (CASSANDRA-13072)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bf5cf7f/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
index 8d470d5..e0fe4ec 100644
--- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
@@ -287,7 +287,10 @@ public class CompactionManager implements CompactionManagerMBean
List<LifecycleTransaction> transactions = new ArrayList<>();
try (LifecycleTransaction compacting = cfs.markAllCompacting(operationType))
{
- Iterable<SSTableReader> sstables = compacting != null ? Lists.newArrayList(operation.filterSSTables(compacting)) : Collections.<SSTableReader>emptyList();
+ if (compacting == null)
+ return AllSSTableOpStatus.UNABLE_TO_CANCEL;
+
+ Iterable<SSTableReader> sstables = Lists.newArrayList(operation.filterSSTables(compacting));
if (Iterables.isEmpty(sstables))
{
logger.info("No sstables for {}.{}", cfs.keyspace.getName(), cfs.name);
@@ -339,7 +342,12 @@ public class CompactionManager implements CompactionManagerMBean
void execute(LifecycleTransaction input) throws IOException;
}
- public enum AllSSTableOpStatus { ABORTED(1), SUCCESSFUL(0);
+ public enum AllSSTableOpStatus
+ {
+ SUCCESSFUL(0),
+ ABORTED(1),
+ UNABLE_TO_CANCEL(2);
+
public final int statusCode;
AllSSTableOpStatus(int statusCode)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bf5cf7f/src/java/org/apache/cassandra/tools/NodeProbe.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/NodeProbe.java b/src/java/org/apache/cassandra/tools/NodeProbe.java
index 394ce6e..5ffdf3b 100644
--- a/src/java/org/apache/cassandra/tools/NodeProbe.java
+++ b/src/java/org/apache/cassandra/tools/NodeProbe.java
@@ -275,29 +275,47 @@ public class NodeProbe implements AutoCloseable
public void forceKeyspaceCleanup(PrintStream out, int jobs, String keyspaceName, String... tableNames) throws IOException, ExecutionException, InterruptedException
{
checkJobs(out, jobs);
- if (forceKeyspaceCleanup(jobs, keyspaceName, tableNames) != 0)
+ switch (forceKeyspaceCleanup(jobs, keyspaceName, tableNames))
{
- failed = true;
- out.println("Aborted cleaning up at least one table in keyspace "+keyspaceName+", check server logs for more information.");
+ case 1:
+ failed = true;
+ out.println("Aborted cleaning up at least one table in keyspace "+keyspaceName+", check server logs for more information.");
+ break;
+ case 2:
+ failed = true;
+ out.println("Failed marking some sstables compacting in keyspace "+keyspaceName+", check server logs for more information");
+ break;
}
}
public void scrub(PrintStream out, boolean disableSnapshot, boolean skipCorrupted, boolean checkData, int jobs, String keyspaceName, String... tables) throws IOException, ExecutionException, InterruptedException
{
checkJobs(out, jobs);
- if (scrub(disableSnapshot, skipCorrupted, checkData, jobs, keyspaceName, tables) != 0)
+ switch (scrub(disableSnapshot, skipCorrupted, checkData, jobs, keyspaceName, tables))
{
- failed = true;
- out.println("Aborted scrubbing at least one table in keyspace "+keyspaceName+", check server logs for more information.");
+ case 1:
+ failed = true;
+ out.println("Aborted scrubbing at least one table in keyspace "+keyspaceName+", check server logs for more information.");
+ break;
+ case 2:
+ failed = true;
+ out.println("Failed marking some sstables compacting in keyspace "+keyspaceName+", check server logs for more information");
+ break;
}
}
public void verify(PrintStream out, boolean extendedVerify, String keyspaceName, String... tableNames) throws IOException, ExecutionException, InterruptedException
{
- if (verify(extendedVerify, keyspaceName, tableNames) != 0)
+ switch (verify(extendedVerify, keyspaceName, tableNames))
{
- failed = true;
- out.println("Aborted verifying at least one table in keyspace "+keyspaceName+", check server logs for more information.");
+ case 1:
+ failed = true;
+ out.println("Aborted verifying at least one table in keyspace "+keyspaceName+", check server logs for more information.");
+ break;
+ case 2:
+ failed = true;
+ out.println("Failed marking some sstables compacting in keyspace "+keyspaceName+", check server logs for more information");
+ break;
}
}
@@ -305,10 +323,16 @@ public class NodeProbe implements AutoCloseable
public void upgradeSSTables(PrintStream out, String keyspaceName, boolean excludeCurrentVersion, int jobs, String... tableNames) throws IOException, ExecutionException, InterruptedException
{
checkJobs(out, jobs);
- if (upgradeSSTables(keyspaceName, excludeCurrentVersion, jobs, tableNames) != 0)
+ switch (upgradeSSTables(keyspaceName, excludeCurrentVersion, jobs, tableNames))
{
- failed = true;
- out.println("Aborted upgrading sstables for atleast one table in keyspace "+keyspaceName+", check server logs for more information.");
+ case 1:
+ failed = true;
+ out.println("Aborted upgrading sstables for atleast one table in keyspace "+keyspaceName+", check server logs for more information.");
+ break;
+ case 2:
+ failed = true;
+ out.println("Failed marking some sstables compacting in keyspace "+keyspaceName+", check server logs for more information");
+ break;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org