docs(cli): document all 106 CLI commands - #19799
Conversation
a11a0e2 to
70a311d
Compare
|
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. |
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.
4e1cc4c to
2dd66c7
Compare
|
Hi @voonhous I have update the PR description and documentation changes. |
hudi-agent
left a comment
There was a problem hiding this comment.
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.
| - **`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` |
There was a problem hiding this comment.
🤖 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.
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
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?
| All five commands require a table to be connected, and report `No Hudi table loaded. Please connect to a table first.` | ||
| otherwise. | ||
|
|
||
| ## Command reference |
There was a problem hiding this comment.
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?
| - **`metadata lookup-record-index`** Print Record index information for a record_key. | ||
| <br />Options: `--record_key` (required), `--partition_path` (required) |
There was a problem hiding this comment.
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?
| - **`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` |
| * 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 |
There was a problem hiding this comment.
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?
| * hdfsparquetimport - Imports Parquet table to a hoodie table |
| * 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 |
There was a problem hiding this comment.
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:
| * kerberos kdestroy - Destroy Kerberos authentication | |
| * kerberos kdestroy - Destroy Kerberos authentication | |
| * kerberos kinit - Perform Kerberos authentication |
| @@ -291,6 +321,8 @@ hudi:trips->help | |||
| * show fsview latest - Show latest file-system view | |||
There was a problem hiding this comment.
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?
|
|
||
| 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 |
There was a problem hiding this comment.
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"?
| ### 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 |
There was a problem hiding this comment.
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?
| 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 |
There was a problem hiding this comment.
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"?
| `UserGroupInformation`, which is what you want before authenticating as a different principal in the same session. | ||
|
|
||
| ```shell | ||
| hudi->kerberos kdestroy --krb5conf /etc/krb5.conf |
There was a problem hiding this comment.
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?
Describe the issue this Pull Request addresses
Closes #15376 (JIRA: HUDI-4689, epic
HUDI-1388), "Add documentation for all CLI commands".
hudi-cliexposes 106 commands across 26 command classes.website/docs/cli.mdhad two gaps:discover they exist. The whole
locks auditfamily, bothtimelinecommands and bothdiffcommands were amongthem.
helpoutput, with their options documentednowhere on the page.
Summary and Changelog
One file,
website/docs/cli.md.1. The
helplisting now carries all 106 commands. Entries were inserted at their alphabetical positionsrather than the block being regenerated, so the diff stays reviewable.
2. A new
Command referencesection documents every command, grouped into nine areas, with each command'soptions and their defaults. It also records which entries are aliases rather than distinct commands:
refresh,metadata refresh,commits refresh,cleans refreshandsavepoints refreshare five names for one method thatreloads table metadata, and
temp query/temp_query,temp delete/temp_deleteandtemps show/temps_showare spelling variants of three commands.3. New worked sections for the commands that had no documentation at all:
Auditing Storage Lockslocks auditcommands, the layout under.hoodie/.locks, and whatvalidatereports as an error versus a warningInspecting the Timelinetimeline show active/incompleteand the twometadata timelineequivalents, with their output columnsDiffing a File or Partitiondiff file,diff partitionRepairing a Tablerename partition,repair deprecated partition,repair show empty commit metadataChanging the Meta Fields Modetable set-meta-fields-modeand its two guardsFour more are documented in the sections they belong to:
trigger archivalunder Archived Commits,show restore/show restoresunder Savepoint and Restore,kerberos kdestroyunder the Kerberos section, andmetadata delete-record-indexunder Record Index Lookup.Every command name, option, default and behaviour was read from the
@ShellMethodand@ShellOptiondeclarationson
master, not from the help strings, which have drifted.Things the source read turned up that the help text does not say
diff fileanddiff partitionignore--startTsand--endTsunless--includeArchivedTimelineis alsotrue.CLIUtils#getTimelineInRange(:46-62) applies the bounds only on the archived branch and returns thewhole 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 metadatareturnsvoidand reports throughlog.warn, so it renders no resulttable; its findings go to the CLI log.
rename partitionphysically removes the old partition directory after itsdelete_partitionwrite(
SparkMain#renamePartition), whilerepair deprecated partitionleaves the emptieddefaultdirectory. The twoare otherwise the same shape.
Verification
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
@ShellOptionoccurrences 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 theescaped angle brackets in the
rename partitionusage string render as literal<and>.Impact
Documentation only; no code or config changes. The page is the current (
next) docs version, which tracksmaster, where these commands live. Versioned copies underwebsite/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