Skip to content

HBASE-30552 WALPerformanceEvaluation usage text does not match its argument parsing - #8905

Open
arvindKandpal-ksolves wants to merge 2 commits into
apache:masterfrom
arvindKandpal-ksolves:HBASE-30552
Open

arvindKandpal-ksolves wants to merge 2 commits into
apache:masterfrom
arvindKandpal-ksolves:HBASE-30552

Conversation

@arvindKandpal-ksolves

Copy link
Copy Markdown
Contributor

The usage text of WALPerformanceEvaluation does not match how the tool parses its arguments.

Changes:

  • -traceFreq: also skip its value, so commands that still pass "-traceFreq " work again (broken since HBASE-25373). Usage now says it is not supported any more.
  • Usage: "-h|-help" changed to "-h|--help", which is what the parser accepts.
  • Usage: add the missing "-compress" option.
  • An option given without its value now prints the usage instead of throwing ArrayIndexOutOfBoundsException.
  • TestFSHLogProviderWithConcurrentWrites: add a test that runs the tool with "-traceFreq 0.5".

Testing:

  • New test fails without the fix and passes with it.
  • TestFSHLogProviderWithConcurrentWrites and TestBoundedRegionGroupingStrategyUsingWPETool pass; spotless passes.
  • Manual runs on the local filesystem: "-traceFreq 0.5", "--help", "-threads" with no value and "-compress" all behave as described above.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

A moderate active issue remains because a trailing or value-less -traceFreq is accepted instead of being rejected with usage, so the change does not yet satisfy its documented argument-handling behavior.

1 open issue
What changed in this PR

Updates WALPerformanceEvaluation command-line parsing and usage text while preserving compatibility with legacy -traceFreq arguments.

Changes:

  • Consume and ignore the value following -traceFreq.
  • Align help and compression options in the usage output.
  • Print usage when required option values are missing.
  • Add regression coverage for -traceFreq 0.5.
File Description
hbase-diagnostics/​src/​test/​java/​org/​apache/​hadoop/​hbase/​wal/​TestFSHLogProviderWithConcurrentWrites.java Adds regression coverage for WALPerformanceEvaluation commands using the legacy -traceFreq option.
hbase-diagnostics/​src/​main/​java/​org/​apache/​hadoop/​hbase/​wal/​WALPerformanceEvaluation.java Updates argument parsing, missing-value handling, and command-line usage text.

Review effort: Lite

Comment on lines +236 to +238
if (i + 1 < args.length && !args[i + 1].startsWith("-")) {
i++;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@liuxiaocs7 Thanks for the review. This is intended, so I kept the code as is.

-traceFreq has no effect since HBASE-25373, and since then a trailing -traceFreq without a value has been accepted with only a warning. This change keeps that, and only also skips a value when one is given, so older commands like "-traceFreq 0.5" work again. Rejecting a missing value for an option that is ignored would break commands that work today.

The "prints usage when a value is missing" part of the description applies to options that actually read a value, such as -threads or -roll.

@liuxiaocs7

Copy link
Copy Markdown
Member

Thanks for clarifying. I agree that a bare -traceFreq should still work. Could we show it as -traceFreq [<N>] in the help and only consume the next token if it’s numeric? Right now -traceFreq -1 is rejected, but -traceFreq typo is silently accepted?

@arvindKandpal-ksolves

Copy link
Copy Markdown
Contributor Author

@liuxiaocs7 Thanks, done. The help now shows "-traceFreq []", and the next token is skipped only if it is numeric (NumberUtils.isParsable). So "-traceFreq -1" and a bare "-traceFreq" work, and "-traceFreq typo" now fails with usage. The test covers "-traceFreq 0.5", "-traceFreq -1" and a bare "-traceFreq". Also fixed a typo in the -roll usage line ("way" -> "WAL").

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.

3 participants