diff --git a/.build/parent-pom-template.xml b/.build/parent-pom-template.xml
index 3eaa9ba3af..a57739f963 100644
--- a/.build/parent-pom-template.xml
+++ b/.build/parent-pom-template.xml
@@ -306,7 +306,7 @@
commons-cli
commons-cli
- 1.1
+ 1.5.0
commons-codec
diff --git a/CHANGES.txt b/CHANGES.txt
index 996c938f00..178ed2b5ae 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
5.0
+ * Upgrade commons cli to 1.5.0 (CASSANDRA-18659)
* Disable the deprecated keyspace/table thresholds and convert them to guardrails (CASSANDRA-18617)
* Deprecate CloudstackSnitch and remove duplicate code in snitches (CASSANDRA-18438)
* Add support for vectors in UDFs (CASSANDRA-18613)
diff --git a/doc/modules/cassandra/pages/managing/tools/sstable/sstablemetadata.adoc b/doc/modules/cassandra/pages/managing/tools/sstable/sstablemetadata.adoc
index 6eab727348..03cd3cd81d 100644
--- a/doc/modules/cassandra/pages/managing/tools/sstable/sstablemetadata.adoc
+++ b/doc/modules/cassandra/pages/managing/tools/sstable/sstablemetadata.adoc
@@ -18,6 +18,7 @@ sstablemetadata
|===
|--colors |Use ANSI color sequences
|--gc_grace_seconds |The gc_grace_seconds to use when calculating
+|--help |Help
|--scan |Full sstable scan for additional details. Only available in 3.0+ sstables. Defaults: false
|--timestamp_unit |Time unit that cell timestamps are written with
|--unicode |Use unicode to draw histograms and progress bars
diff --git a/src/java/org/apache/cassandra/tools/SSTableMetadataViewer.java b/src/java/org/apache/cassandra/tools/SSTableMetadataViewer.java
index 2f3e39be8b..aa5cfbff25 100644
--- a/src/java/org/apache/cassandra/tools/SSTableMetadataViewer.java
+++ b/src/java/org/apache/cassandra/tools/SSTableMetadataViewer.java
@@ -83,6 +83,7 @@ public class SSTableMetadataViewer
private static final String GCGS_KEY = "g";
private static final String TIMESTAMP_UNIT = "t";
private static final String SCAN = "s";
+ private static final String HELP = "h";
private static final Comparator VCOMP = Comparator.comparingLong(ValuedByteBuffer::getValue).reversed();
static
@@ -517,6 +518,10 @@ public class SSTableMetadataViewer
tsUnit.setOptionalArg(true);
options.addOption(tsUnit);
+ Option help = new Option(HELP, "help", false, "Help");
+ help.setOptionalArg(true);
+ options.addOption(help);
+
Option scanEnabled = new Option(SCAN, "scan", false,
"Full sstable scan for additional details. Only available in 3.0+ sstables. Defaults: false");
scanEnabled.setOptionalArg(true);
diff --git a/test/unit/org/apache/cassandra/tools/AuditLogViewerTest.java b/test/unit/org/apache/cassandra/tools/AuditLogViewerTest.java
index 514857efc2..76ed9ba04b 100644
--- a/test/unit/org/apache/cassandra/tools/AuditLogViewerTest.java
+++ b/test/unit/org/apache/cassandra/tools/AuditLogViewerTest.java
@@ -96,9 +96,9 @@ public class AuditLogViewerTest
" indefinitely waiting for more records\n" +
" -h,--help display this help message\n" +
" -i,--ignore Silently ignore unsupported records\n" +
- " -r,--roll_cycle How often to roll the log file was rolled. May be\n" +
- " necessary for Chronicle to correctly parse file names. (MINUTELY, HOURLY,\n" +
- " DAILY). Default HOURLY.\n";
+ " -r,--roll_cycle How often to roll the log file was rolled. May be\n" +
+ " necessary for Chronicle to correctly parse file\n" +
+ " names. (MINUTELY, HOURLY, DAILY). Default HOURLY.\n";
Assertions.assertThat(tool.getStdout()).isEqualTo(help);
}
diff --git a/test/unit/org/apache/cassandra/tools/HashPasswordTest.java b/test/unit/org/apache/cassandra/tools/HashPasswordTest.java
index f84bd8b6d1..3c2b78b71d 100644
--- a/test/unit/org/apache/cassandra/tools/HashPasswordTest.java
+++ b/test/unit/org/apache/cassandra/tools/HashPasswordTest.java
@@ -59,9 +59,11 @@ public class HashPasswordTest extends CQLTester
" variable as the password\n" +
" -h,--help Display this help message\n" +
" -i,--input Input is a file (or - for stdin) to read the\n" +
- " password from. Make sure that the whole input including newlines is\n" +
- " considered. For example, the shell command 'echo -n foobar | hash_password\n" +
- " -i -' will work as intended and just hash 'foobar'.\n" +
+ " password from. Make sure that the whole\n" +
+ " input including newlines is considered. For\n" +
+ " example, the shell command 'echo -n foobar |\n" +
+ " hash_password -i -' will work as intended\n" +
+ " and just hash 'foobar'.\n" +
" -p,--plain Argument is the plain text password\n" +
" -r,--logrounds Number of hash rounds (default: 10).\n";
assertEquals(help, tool.getStdout());
diff --git a/test/unit/org/apache/cassandra/tools/SSTableExportTest.java b/test/unit/org/apache/cassandra/tools/SSTableExportTest.java
index 3a4ead493b..2a29664a9a 100644
--- a/test/unit/org/apache/cassandra/tools/SSTableExportTest.java
+++ b/test/unit/org/apache/cassandra/tools/SSTableExportTest.java
@@ -58,7 +58,6 @@ public class SSTableExportTest extends OfflineToolUtils
// If you added, modified options or help, please update docs if necessary
ToolResult tool = ToolRunner.invokeClass(SSTableExport.class);
String help = "usage: sstabledump \n" +
- " \n" +
"Dump contents of given SSTable to standard output in JSON format.\n" +
" -d CQL row per line internal representation\n" +
" -e enumerate partition keys only\n" +
diff --git a/test/unit/org/apache/cassandra/tools/SSTableMetadataViewerTest.java b/test/unit/org/apache/cassandra/tools/SSTableMetadataViewerTest.java
index 6728fdf391..1dd4e78d8f 100644
--- a/test/unit/org/apache/cassandra/tools/SSTableMetadataViewerTest.java
+++ b/test/unit/org/apache/cassandra/tools/SSTableMetadataViewerTest.java
@@ -69,13 +69,14 @@ public class SSTableMetadataViewerTest extends OfflineToolUtils
// If you added, modified options or help, please update docs if necessary
ToolResult tool = ToolRunner.invokeClass(SSTableMetadataViewer.class, "-h");
assertEquals("You must supply at least one sstable\n" +
- "usage: sstablemetadata [-c] [-g ] [-s] [-t ] [-u]\n" +
+ "usage: sstablemetadata [-c] [-g ] [-h] [-s] [-t ] [-u]\n" +
"\n" +
"Dump information about SSTable[s] for Apache Cassandra 3.x\n" +
"Options:\n" +
" -c,--colors Use ANSI color sequences\n" +
- " -g,--gc_grace_seconds Time to use when calculating droppable tombstones\n" +
- " -s,--scan Full sstable scan for additional details. Only available in 3.0+ sstables. Defaults: false\n" +
+ " -g,--gc_grace_seconds Time to use when calculating droppable tombstones\n" +
+ " -h,--help Help\n" +
+ " -s,--scan Full sstable scan for additional details. Only available in 3.0+ sstables. Defaults: false\n" +
" -t,--timestamp_unit Time unit that cell timestamps are written with\n" +
" -u,--unicode Use unicode to draw histograms and progress bars\n\n"
, tool.getCleanedStderr());
diff --git a/test/unit/org/apache/cassandra/tools/SSTablePartitionsTest.java b/test/unit/org/apache/cassandra/tools/SSTablePartitionsTest.java
index 247fa8a1e6..d5bc8a59d9 100644
--- a/test/unit/org/apache/cassandra/tools/SSTablePartitionsTest.java
+++ b/test/unit/org/apache/cassandra/tools/SSTablePartitionsTest.java
@@ -130,7 +130,6 @@ public class SSTablePartitionsTest extends OfflineToolUtils
ToolResult tool = ToolRunner.invokeClass(SSTablePartitions.class);
Assertions.assertThat(tool.getStdout())
.isEqualTo("usage: sstablepartitions \n" +
- " \n" +
"Print partition statistics of one or more sstables.\n" +
" -b,--backups include backups present in data\n" +
" directories (recursive scans)\n" +
@@ -142,16 +141,18 @@ public class SSTablePartitionsTest extends OfflineToolUtils
" -s,--snapshots include snapshots present in data\n" +
" directories (recursive scans)\n" +
" -t,--min-size partition size threshold, expressed as\n" +
- " either the number of bytes or a size with unit of the form 10KiB, 20MiB,\n" +
- " 30GiB, etc.\n" +
+ " either the number of bytes or a size with\n" +
+ " unit of the form 10KiB, 20MiB, 30GiB, etc.\n" +
" -u,--current-timestamp timestamp (seconds since epoch, unit time)\n" +
" for TTL expired calculation\n" +
" -w,--min-rows partition row count threshold\n" +
" -x,--exclude-key Excluded partition key(s) from partition\n" +
- " detailed row/cell/tombstone information (irrelevant, if --partitions-only\n" +
- " is given)\n" +
+ " detailed row/cell/tombstone information\n" +
+ " (irrelevant, if --partitions-only is\n" +
+ " given)\n" +
" -y,--partitions-only Do not process per-partition detailed\n" +
- " row/cell/tombstone information, only brief information\n");
+ " row/cell/tombstone information, only brief\n" +
+ " information\n");
}
/**
diff --git a/test/unit/org/apache/cassandra/tools/StandaloneScrubberTest.java b/test/unit/org/apache/cassandra/tools/StandaloneScrubberTest.java
index 062f7fa992..bf8e876a5f 100644
--- a/test/unit/org/apache/cassandra/tools/StandaloneScrubberTest.java
+++ b/test/unit/org/apache/cassandra/tools/StandaloneScrubberTest.java
@@ -50,22 +50,22 @@ public class StandaloneScrubberTest extends OfflineToolUtils
" --debug display stack traces\n" +
" -e,--header-fix Option whether and how to perform a check of the sstable serialization-headers and fix\n" +
" known, fixable issues.\n" +
- " Possible argument values:\n" +
- " - validate-only: validate the serialization-headers, but do not fix those. Do not continue with scrub - i.e. only\n" +
- " validate the header (dry-run of fix-only).\n" +
- " - validate: (default) validate the serialization-headers, but do not fix those and only continue with scrub if no error\n" +
- " were detected.\n" +
- " - fix-only: validate and fix the serialization-headers, don't continue with scrub.\n" +
- " - fix: validate and fix the serialization-headers, do not fix and do not continue with scrub if the serialization-header\n" +
- " check encountered errors.\n" +
+ " Possible argument values:\n" +
+ " - validate-only: validate the serialization-headers, but do not fix those. Do not\n" +
+ " continue with scrub - i.e. only validate the header (dry-run of fix-only).\n" +
+ " - validate: (default) validate the serialization-headers, but do not fix those and only\n" +
+ " continue with scrub if no error were detected.\n" +
+ " - fix-only: validate and fix the serialization-headers, don't continue with scrub.\n" +
+ " - fix: validate and fix the serialization-headers, do not fix and do not continue with\n" +
+ " scrub if the serialization-header check encountered errors.\n" +
" - off: don't perform the serialization-header checks.\n" +
" -h,--help display this help message\n" +
" -m,--manifest-check only check and repair the leveled manifest, without actually scrubbing the sstables\n" +
" -n,--no-validate do not validate columns using column validator\n" +
- " -r,--reinsert-overflowed-ttl Rewrites rows with overflowed expiration date affected by CASSANDRA-14092 with the\n" +
- " maximum supported expiration date of 2038-01-19T03:14:06+00:00. The rows are rewritten with the original timestamp\n" +
- " incremented by one millisecond to override/supersede any potential tombstone that may have been generated during\n" +
- " compaction of the affected rows.\n" +
+ " -r,--reinsert-overflowed-ttl Rewrites rows with overflowed expiration date affected by CASSANDRA-14092 with the\n" +
+ " maximum supported expiration date of 2038-01-19T03:14:06+00:00. The rows are rewritten\n" +
+ " with the original timestamp incremented by one millisecond to override/supersede any\n" +
+ " potential tombstone that may have been generated during compaction of the affected rows.\n" +
" -s,--skip-corrupted skip corrupt rows in counter tables\n" +
" -v,--verbose verbose output\n";
Assertions.assertThat(tool.getStdout()).isEqualTo(help);
diff --git a/test/unit/org/apache/cassandra/tools/StandaloneVerifierTest.java b/test/unit/org/apache/cassandra/tools/StandaloneVerifierTest.java
index f94a5d6b3b..44b294b2ad 100644
--- a/test/unit/org/apache/cassandra/tools/StandaloneVerifierTest.java
+++ b/test/unit/org/apache/cassandra/tools/StandaloneVerifierTest.java
@@ -62,9 +62,11 @@ public class StandaloneVerifierTest extends OfflineToolUtils
" -h,--help display this help message\n" +
" -q,--quick do a quick check, don't read all data\n" +
" -r,--mutate_repair_status don't mutate repair status\n" +
- " -t,--token_range long token range of the format left,right.\n" +
- " This may be provided multiple times to define multiple different ranges\n" +
+ " -t,--token_range long token range of the format left,right.\n" +
+ " This may be provided multiple times to define\n" +
+ " multiple different ranges\n" +
" -v,--verbose verbose output\n";
+
Assertions.assertThat(tool.getStdout()).isEqualTo(help);
}