Skip to content

Move -pp/--print-port from NodetoolCommand to per-command Mixin#4617

Open
Mmuzaf wants to merge 1 commit intoapache:trunkfrom
Mmuzaf:cassandra-20790
Open

Move -pp/--print-port from NodetoolCommand to per-command Mixin#4617
Mmuzaf wants to merge 1 commit intoapache:trunkfrom
Mmuzaf:cassandra-20790

Conversation

@Mmuzaf
Copy link
Contributor

@Mmuzaf Mmuzaf commented Feb 15, 2026

Patch by Maxim Muzafarov for CASSANDRA-20790

Thanks for sending a pull request! Here are some tips if you're new here:

  • Ensure you have added or run the appropriate tests for your PR.
  • Be sure to keep the PR description updated to reflect all changes.
  • Write your PR title to summarize what this PR proposes.
  • If possible, provide a concise example to reproduce the issue for a faster review.
  • Read our contributor guidelines
  • If you're making a documentation change, see our guide to documentation contribution

Commit messages should follow the following format:

<One sentence description, usually Jira title or CHANGES.txt summary>

<Optional lengthier description (context on patch)>

patch by <Authors>; reviewed by <Reviewers> for CASSANDRA-#####

Co-authored-by: Name1 <email1>
Co-authored-by: Name2 <email2>

The Cassandra Jira

@Mmuzaf Mmuzaf force-pushed the cassandra-20790 branch 2 times, most recently from 3fdb8ad to fdf9990 Compare February 15, 2026 16:09
Patch by Maxim Muzafarov for CASSANDRA-20790
tableBuilder.add("sstables dropped from compaction", Long.toString(sstablesDroppedFromCompaction.getCount()));

NumberFormat formatter = new DecimalFormat("0.00");
NumberFormat formatter = toDecimalFormatLocalized("0.00");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this have in common with the patch? Just dont see it ...

private Collection<String> joiningNodes, leavingNodes, movingNodes, liveNodes, unreachableNodes;

@Mixin
private PrintPortMixin printPortMixin = new PrintPortMixin();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you really need to do new ...? Is not this somehow "injected" automatically? I think that's the purpose of @Mixin no?

* 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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe COMMANDS_SUPPORTING_PRINT_PORT_OPTION is more descriptive and better

if (args == null || args.length < 2)
return args;

Set<String> relocatable = Set.of("-pp", "--print-port");
Copy link
Contributor

@smiklosovic smiklosovic Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

public static Collection<Object[]> data()
{
return List.of(
new Object[]{ "status", DEAFULT_STRING_ARRAY },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DEAFULT -> DEFAULT

Copy link
Contributor

@smiklosovic smiklosovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants