Move -pp/--print-port from NodetoolCommand to per-command Mixin#4617
Open
Mmuzaf wants to merge 1 commit intoapache:trunkfrom
Open
Move -pp/--print-port from NodetoolCommand to per-command Mixin#4617Mmuzaf wants to merge 1 commit intoapache:trunkfrom
Mmuzaf wants to merge 1 commit intoapache:trunkfrom
Conversation
3fdb8ad to
fdf9990
Compare
Patch by Maxim Muzafarov for CASSANDRA-20790
fdf9990 to
92e808f
Compare
smiklosovic
reviewed
Feb 23, 2026
| tableBuilder.add("sstables dropped from compaction", Long.toString(sstablesDroppedFromCompaction.getCount())); | ||
|
|
||
| NumberFormat formatter = new DecimalFormat("0.00"); | ||
| NumberFormat formatter = toDecimalFormatLocalized("0.00"); |
Contributor
There was a problem hiding this comment.
what does this have in common with the patch? Just dont see it ...
smiklosovic
reviewed
Feb 23, 2026
| private Collection<String> joiningNodes, leavingNodes, movingNodes, liveNodes, unreachableNodes; | ||
|
|
||
| @Mixin | ||
| private PrintPortMixin printPortMixin = new PrintPortMixin(); |
Contributor
There was a problem hiding this comment.
do you really need to do new ...? Is not this somehow "injected" automatically? I think that's the purpose of @Mixin no?
smiklosovic
reviewed
Feb 23, 2026
| * Both calls such as {@code ./nodetool --print-port status}, and | ||
| * {@code ./nodetool status --print-port} should work as expected. | ||
| */ | ||
| private static final Set<String> PRINT_PORT_COMMANDS = Set.of("status", "ring", "netstats", "gossipinfo", |
Contributor
There was a problem hiding this comment.
maybe COMMANDS_SUPPORTING_PRINT_PORT_OPTION is more descriptive and better
smiklosovic
reviewed
Feb 23, 2026
| if (args == null || args.length < 2) | ||
| return args; | ||
|
|
||
| Set<String> relocatable = Set.of("-pp", "--print-port"); |
Contributor
There was a problem hiding this comment.
maybe you could do something like this to reuse:
public class PrintPortMixin
{
private static final String PRINT_PORT_SHORT = "-pp";
private static final String PRINT_PORT_LONG = "--print-port";
public static final Set<String> OPTIONS = Set.of(PRINT_PORT_SHORT, PRINT_PORT_LONG);
@CommandLine.Option(names = { PRINT_PORT_SHORT, PRINT_PORT_LONG } ...
}
and then you would remove this relocatable and just reused further down where it is mentioned by PrintPortMixin.OPTIONS.
smiklosovic
reviewed
Feb 23, 2026
| public static Collection<Object[]> data() | ||
| { | ||
| return List.of( | ||
| new Object[]{ "status", DEAFULT_STRING_ARRAY }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Patch by Maxim Muzafarov for CASSANDRA-20790
Thanks for sending a pull request! Here are some tips if you're new here:
Commit messages should follow the following format:
The Cassandra Jira