Skip to content

docs(cli): document all 106 CLI commands - #19799

Open
rangareddy wants to merge 1 commit into
apache:asf-sitefrom
rangareddy:docs-15376-cli-commands
Open

docs(cli): document all 106 CLI commands#19799
rangareddy wants to merge 1 commit into
apache:asf-sitefrom
rangareddy:docs-15376-cli-commands

Conversation

@rangareddy

@rangareddy rangareddy commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Describe the issue this Pull Request addresses

Closes #15376 (JIRA: HUDI-4689, epic
HUDI-1388), "Add documentation for all CLI commands".

hudi-cli exposes 106 commands across 26 command classes. website/docs/cli.md had two gaps:

  1. 20 commands were absent from the page entirely - not documented, and not even listed, so a reader could not
    discover they exist. The whole locks audit family, both timeline commands and both diff commands were among
    them.
  2. 56 more appeared only as a one-line entry in the embedded help output, with their options documented
    nowhere on the page.

Summary and Changelog

One file, website/docs/cli.md.

1. The help listing now carries all 106 commands. Entries were inserted at their alphabetical positions
rather than the block being regenerated, so the diff stays reviewable.

2. A new Command reference section documents every command, grouped into nine areas, with each command's
options and their defaults. It also records which entries are aliases rather than distinct commands: refresh,
metadata refresh, commits refresh, cleans refresh and savepoints refresh are five names for one method that
reloads table metadata, and temp query / temp_query, temp delete / temp_delete and
temps show / temps_show are spelling variants of three commands.

3. New worked sections for the commands that had no documentation at all:

Section Commands
Auditing Storage Locks the five locks audit commands, the layout under .hoodie/.locks, and what validate reports as an error versus a warning
Inspecting the Timeline timeline show active / incomplete and the two metadata timeline equivalents, with their output columns
Diffing a File or Partition diff file, diff partition
Repairing a Table rename partition, repair deprecated partition, repair show empty commit metadata
Changing the Meta Fields Mode table set-meta-fields-mode and its two guards

Four more are documented in the sections they belong to: trigger archival under Archived Commits,
show restore / show restores under Savepoint and Restore, kerberos kdestroy under the Kerberos section, and
metadata delete-record-index under Record Index Lookup.

Every command name, option, default and behaviour was read from the @ShellMethod and @ShellOption declarations
on master, not from the help strings, which have drifted.

Things the source read turned up that the help text does not say

  • diff file and diff partition ignore --startTs and --endTs unless --includeArchivedTimeline is also
    true.
    CLIUtils#getTimelineInRange (:46-62) applies the bounds only on the archived branch and returns the
    whole active timeline otherwise, so a narrow range silently does nothing. The help text advertises the defaults
    with no hint of the precondition.
  • repair show empty commit metadata returns void and reports through log.warn, so it renders no result
    table; its findings go to the CLI log.
  • rename partition physically removes the old partition directory after its delete_partition write
    (SparkMain#renamePartition), while repair deprecated partition leaves the emptied default directory. The two
    are otherwise the same shape.

Verification

cd website && npm run build
  -> [SUCCESS] Generated static files in "build"

docs markdown link-format checks (the ones asf-site.ci.yml runs on website/docs/**)
  -> no absolute /docs/ paths, no links missing .md, no ../ or ./ prefixes

coverage check, parsing @ShellMethod keys out of hudi-cli on master and grepping cli.md
  -> 106 source commands, 0 missing, 0 documented only in the help listing

The extraction behind the command reference was validated against the source as well: the 18 commands recorded as
taking no options were each confirmed to declare none, and the captured option count reconciles exactly with the
404 @ShellOption occurrences in the tree once the two alias methods that double-count are accounted for.

Sections and the reference were confirmed in the rendered build/docs/next/cli/index.html, including that the
escaped angle brackets in the rename partition usage string render as literal < and >.

Impact

Documentation only; no code or config changes. The page is the current (next) docs version, which tracks
master, where these commands live. Versioned copies under website/versioned_docs/ are deliberately untouched,
since several of these commands do not exist in those releases.

Risk Level

none

Documentation Update

This is the documentation update.

Contributor's checklist

  • Read through contributor's guide
  • Enough context is provided in the sections above
  • Adequate tests were added if applicable
  • CI passes on my PR

@github-actions github-actions Bot added docs size:M PR with lines of changes in (100, 300] labels Aug 31, 2026
@rangareddy
rangareddy force-pushed the docs-15376-cli-commands branch from a11a0e2 to 70a311d Compare August 31, 2026 04:31
@rangareddy rangareddy changed the title docs(cli): document the 20 undocumented CLI commands and refresh the help listing docs(cli): document the undocumented CLI commands and how to set Hudi properties Aug 31, 2026
@voonhous

Copy link
Copy Markdown
Member

Is this a 2 part PR or? The description says part of. If this is a 2 part PR, please make it clear in the title this is Part 1 of N, where N should be clearly defined.

@github-actions github-actions Bot added size:L PR with lines of changes in (300, 1000] and removed size:M PR with lines of changes in (100, 300] labels Aug 31, 2026
@rangareddy
rangareddy marked this pull request as draft August 31, 2026 05:03
@rangareddy rangareddy changed the title docs(cli): document the undocumented CLI commands and how to set Hudi properties docs(cli): document all 106 CLI commands and how to set Hudi properties Aug 31, 2026
Closes apache#15376 (HUDI-4689).

hudi-cli exposes 106 commands across 26 command classes. cli.md covered 86 of them, and of
those only 30 had their options documented anywhere; the other 56 existed on the page as a
single line in the embedded help output. Twenty were absent entirely, including the whole
locks audit family, both timeline commands and both diff commands.

Every command name, option, default and behaviour below was read from the @ShellMethod and
@ShellOption declarations on master, not from the help strings, which have drifted.

The help listing now carries all 106 commands, inserted at their alphabetical positions
rather than regenerated, so the diff stays reviewable.

A new "Command reference" section documents every command, grouped into nine areas, with
each command's options and defaults. It also records which entries are aliases rather than
distinct commands: refresh, metadata refresh, commits refresh, cleans refresh and
savepoints refresh are five names for one method, and temp query / temp_query,
temp delete / temp_delete and temps show / temps_show are spelling variants.

New worked sections for what had no documentation at all:

  Auditing Storage Locks          locks audit enable / disable / status / validate /
                                  cleanup, the layout under .hoodie/.locks, and what
                                  validate reports as an error versus a warning
  Inspecting the Timeline         timeline show active / incomplete and the two metadata
                                  timeline equivalents, with the output columns
  Diffing a File or Partition     diff file, diff partition
  Repairing a Table               rename partition, repair deprecated partition,
                                  repair show empty commit metadata
  Changing the Meta Fields Mode   table set-meta-fields-mode and its two guards

Four more are documented in the sections they belong to: trigger archival under Archived
Commits, show restore / show restores under Savepoint and Restore, kerberos kdestroy under
the Kerberos section, and metadata delete-record-index under Record Index Lookup.

Three things the source read turned up that the help text does not tell you:

  - diff file and diff partition ignore --startTs and --endTs unless
    --includeArchivedTimeline is also true. CLIUtils#getTimelineInRange applies the bounds
    only on the archived branch and returns the whole active timeline otherwise, so a narrow
    range silently does nothing.
  - repair show empty commit metadata returns void and reports through log.warn, so it
    renders no result table.
  - rename partition physically removes the old partition directory after its
    delete_partition write; repair deprecated partition leaves the emptied directory.

Angle brackets in generated text are escaped: the rename partition usage string contains
<oldPartition>, which MDX otherwise parses as a JSX tag and fails the build on.
@rangareddy
rangareddy force-pushed the docs-15376-cli-commands branch from 4e1cc4c to 2dd66c7 Compare August 31, 2026 06:09
@rangareddy rangareddy changed the title docs(cli): document all 106 CLI commands and how to set Hudi properties docs(cli): document all 106 CLI commands Aug 31, 2026
@rangareddy
rangareddy marked this pull request as ready for review August 31, 2026 06:21
@rangareddy

Copy link
Copy Markdown
Collaborator Author

Hi @voonhous I have update the PR description and documentation changes.

@hudi-agent hudi-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ 🤖 This review was generated by an AI agent and may contain mistakes. Please verify any suggestions before applying.

Thanks for the docs update! This is a thorough and impressively accurate expansion of cli.md — I cross-checked the command names, options, defaults, and behavioral notes (diff range semantics, lock-audit paths and verdicts, delete-record-index backup path, set-meta-fields-mode guards, trigger archival, etc.) against the @ShellMethod/@ShellOption declarations on master and they line up. The only concern is a handful of reference entries that print an unresolved Java constant as the --sparkMaster default instead of its value. Please route to a Hudi committer/PMC member (e.g. @yihua) for a final pass before merge.

Comment thread website/docs/cli.md
- **`cleans show`** Show the cleans.
<br />Options: `--limit` (`-1`), `--sortBy`, `--startTs`, `--endTs`, `--includeArchivedTimeline` (`false`), `--desc` (`false`), `--headeronly` (`false`)
- **`clustering run`** Run Clustering.
<br />Options: `--sparkMaster` (`SparkUtil.DEFAULT_SPARK_MASTER`), `--sparkMemory` (`4g`), `--parallelism` (`1`), `--retry` (`1`), `--clusteringInstant`, `--propsFilePath`, `--hoodieConfigs`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 This entry lists the --sparkMaster default as the raw Java constant SparkUtil.DEFAULT_SPARK_MASTER rather than its value. That constant resolves to yarn (SparkUtil.DEFAULT_SPARK_MASTER = "yarn"), so it would help to substitute the concrete value here — the way the other Spark commands in this reference already do (e.g. compaction/marker show local). The same unresolved constant appears on the clustering schedule / clustering scheduleAndExecute entries (lines 1177, 1179) and on metadata create / metadata init / metadata list-partitions (lines 1246, 1252, 1256). It might also be worth a one-line note that this default is yarn, since that differs from the local default used by the compaction and other Spark commands and could surprise a reader running these on a non-YARN setup.

⚠️ AI-generated; verify before applying. React 👍/👎 to flag quality.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

minor: Not blocking, but the same trap is wider than these six entries. SparkUtil.getDefaultConf (SparkUtil.java:89-95) treats a blank master as absent, so the twelve --sparkMaster options rendered bare in this reference (defaultValue = "") and the "empty by default" wording at line 998 also resolve to yarn. The legend at lines 1070-1071 has no state for the 119 options rendered without a value. Could we add a legend clause for unset defaults and one sentence that an unset --sparkMaster means yarn?

@voonhous voonhous left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Site build, MDX compile and the asf-site link checks pass on this head, and the reference matches the master annotations on 105 of 106 option surfaces. Findings inline.

Comment thread website/docs/cli.md
To drop the record index partition from the Metadata Table entirely, for example before rebuilding it:

```shell
hudi:trips->metadata delete-record-index --backup true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

major: This transcript cannot be produced from a fresh session: deleteRecordIndex passes new HoodieSparkEngineContext(jsc) (MetadataCommand.java:156) and jsc is only set by metadata create / init / list-partitions (:460), so connect followed by this command NPEs in jsc.sc(). metadata delete (:143) uses HoodieLocalEngineContext, and deleteMetadataTablePartition never reads the context. Could we note that prerequisite here, and follow up with a one-line master fix to HoodieLocalEngineContext so the output shown is reachable?

Comment thread website/docs/cli.md
All five commands require a table to be connected, and report `No Hudi table loaded. Please connect to a table first.`
otherwise.

## Command reference

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

major: The site's default docs version is 1.2.0, not next (versions.json; docusaurus.config.js:563-565 maps 1.2.0 to path ""), so hudi.apache.org/docs/cli will not show any of this. On release-1.2.0 every command documented here exists with the same options except table set-meta-fields-mode, and the older spelling there is commits show_infights. Could we mirror the change into versioned_docs/version-1.2.0/cli.md, minus the Meta Fields Mode section and reference entry?

Comment thread website/docs/cli.md
Comment on lines +1257 to +1258
- **`metadata lookup-record-index`** Print Record index information for a record_key.
<br />Options: `--record_key` (required), `--partition_path` (required)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

major: --partition_path is optional in source (MetadataCommand.java:398-399, defaultValue = ""), and line 770 of this page already says so for a global RLI; (required) here contradicts both. The description is also cut at the first string literal, dropping the global-vs-partitioned rule. Could we take this?

Suggested change
- **`metadata lookup-record-index`** Print Record index information for a record_key.
<br />Options: `--record_key` (required), `--partition_path` (required)
- **`metadata lookup-record-index`** Print Record index information for a record_key. For global RLI, only record key is required. For partitioned RLI, both record key and partition path are required.
<br />Options: `--record_key` (required), `--partition_path`

Comment thread website/docs/cli.md
* exit - Exits the shell
* export instants - Export Instants and their metadata from the Timeline
* fetch table schema - Fetches latest table schema
* hdfsparquetimport - Imports Parquet table to a hoodie table

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

major: hdfsparquetimport no longer exists: HDFSParquetImportCommand was deleted in aeebfcf (#12695), and the new Command reference correctly omits it, so the listing now contradicts the reference. Could we drop the line while this block is being reconciled?

Suggested change
* hdfsparquetimport - Imports Parquet table to a hoodie table

Comment thread website/docs/cli.md
* fetch table schema - Fetches latest table schema
* hdfsparquetimport - Imports Parquet table to a hoodie table
* help - List all commands usage
* kerberos kdestroy - Destroy Kerberos authentication

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

major: The listing still misses four commands that exist on master, so it covers 102 rather than all 106: commits show_inflights (after line 254), kerberos kinit (here, next to its new counterpart), metadata lookup-record-index (after line 292) and table change-table-type (before line 332). Could we add them, starting with:

Suggested change
* kerberos kdestroy - Destroy Kerberos authentication
* kerberos kdestroy - Destroy Kerberos authentication
* kerberos kinit - Perform Kerberos authentication

Comment thread website/docs/cli.md
@@ -291,6 +321,8 @@ hudi:trips->help
* show fsview latest - Show latest file-system view

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: Feel free to ignore, but line 317 just above is a pre-existing copy of the show archived commits line: the source string is "Read commits from archived files and show file group details" (ArchivedCommitsCommand.java:99). Could we fix it while the block is open?

Comment thread website/docs/cli.md

If you see "Kerberos authentication success" in the command output, it means Kerberos authentication has been successful.

**kerberos kdestroy** is the counterpart: it logs the current user out of the keytab and resets the cached

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: Feel free to ignore. The code logs out the login user, not the current user, and only when it holds Kerberos credentials (KerberosAuthenticationCommand.java:70-76). Could we say "logs the login user out of the keytab"?

Comment thread website/docs/cli.md
### Inspecting the Timeline

`commits show` lists completed commits. The timeline commands show every instant regardless of action and state, which
is what you want when diagnosing a stuck table: a compaction sitting in `REQUESTED`, or a rollback that never

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: Feel free to ignore. Rollbacks never appear in commits show regardless of state, since it filters to getCommitsTimeline() (CommitsCommand.java:73; commit, deltacommit, replacecommit and clustering only). Could we drop "that never completed" so the reason reads as action rather than state?

Comment thread website/docs/cli.md
back is to rebuild the index.

Either way the command first flips the partition off in the table config, so readers stop consulting the index before
the files go away. If the record index partition does not exist, nothing is deleted and the message still prints, with

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: Feel free to ignore. null is also printed when the backup rename fails or returns false (HoodieTableMetadataUtil.java:1774-1781); in that case the partition is neither backed up nor deleted, yet the success line still prints. Could we widen this sentence to "or if the rename fails"?

Comment thread website/docs/cli.md
`UserGroupInformation`, which is what you want before authenticating as a different principal in the same session.

```shell
hudi->kerberos kdestroy --krb5conf /etc/krb5.conf

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: Feel free to ignore. This block and the metadata delete-record-index one at line 774 use shell, while the other fourteen new transcript blocks use java. Could we pick one for the new blocks?

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

Labels

docs size:L PR with lines of changes in (300, 1000]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants