Upgrade commons cli to 1.5.0

Patch by Timothy Tu; reviewed by bereng and brandonwilliams for
CASSANDRA-18659
This commit is contained in:
timothytu12 2023-07-17 12:45:47 -04:00 committed by Brandon Williams
parent b2f08da641
commit 00e5431d64
11 changed files with 43 additions and 31 deletions

View File

@ -306,7 +306,7 @@
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.1</version>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>

View File

@ -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)

View File

@ -18,6 +18,7 @@ sstablemetadata <options> <sstable filename(s)>
|===
|--colors |Use ANSI color sequences
|--gc_grace_seconds <arg> |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 <arg> |Time unit that cell timestamps are written with
|--unicode |Use unicode to draw histograms and progress bars

View File

@ -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<ValuedByteBuffer> 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);

View File

@ -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 <arg> 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 <arg> 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);
}

View File

@ -59,9 +59,11 @@ public class HashPasswordTest extends CQLTester
" variable as the password\n" +
" -h,--help Display this help message\n" +
" -i,--input <arg> 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 <arg> Argument is the plain text password\n" +
" -r,--logrounds <arg> Number of hash rounds (default: 10).\n";
assertEquals(help, tool.getStdout());

View File

@ -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 <sstable file path> <options>\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" +

View File

@ -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 <options> <sstable...> [-c] [-g <arg>] [-s] [-t <arg>] [-u]\n" +
"usage: sstablemetadata <options> <sstable...> [-c] [-g <arg>] [-h] [-s] [-t <arg>] [-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 <arg> 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 <arg> 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 <arg> Time unit that cell timestamps are written with\n" +
" -u,--unicode Use unicode to draw histograms and progress bars\n\n"
, tool.getCleanedStderr());

View File

@ -130,7 +130,6 @@ public class SSTablePartitionsTest extends OfflineToolUtils
ToolResult tool = ToolRunner.invokeClass(SSTablePartitions.class);
Assertions.assertThat(tool.getStdout())
.isEqualTo("usage: sstablepartitions <options> <sstable files or directories>\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 <arg> 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 <arg> timestamp (seconds since epoch, unit time)\n" +
" for TTL expired calculation\n" +
" -w,--min-rows <arg> partition row count threshold\n" +
" -x,--exclude-key <arg> 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");
}
/**

View File

@ -50,22 +50,22 @@ public class StandaloneScrubberTest extends OfflineToolUtils
" --debug display stack traces\n" +
" -e,--header-fix <arg> 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);

View File

@ -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 <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 <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);
}