You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/10/31 16:51:39 UTC

[GitHub] [hudi] nsivabalan commented on a diff in pull request #7076: [HUDI-5032] Add archive to cli

nsivabalan commented on code in PR #7076:
URL: https://github.com/apache/hudi/pull/7076#discussion_r1009644201


##########
hudi-cli/src/main/java/org/apache/hudi/cli/commands/ArchivedCommitsCommand.java:
##########
@@ -52,6 +67,35 @@
  */
 @ShellComponent
 public class ArchivedCommitsCommand {
+  private static final Logger LOG = LogManager.getLogger(ArchivedCommitsCommand.class);
+  private JavaSparkContext jsc;
+  @ShellMethod(key = "trigger archival", value = "trigger archival")
+  public void triggerArchival(
+      @ShellOption(value = {"--minCommits"},
+        help = "Minimum number of instants to retain in the active timeline. See hoodie.keep.min.commits",
+        defaultValue = "20") int minCommits,
+      @ShellOption(value = {"--maxCommits"},
+          help = "Maximum number of instants to retain in the active timeline. See hoodie.keep.max.commits",
+          defaultValue = "30") int maxCommits,
+      @ShellOption(value = {"--commitsRetained"}, help = "Number of commits to retain, without cleaning",
+          defaultValue = "10") int retained) {
+
+    initJavaSparkContext();
+    HoodieWriteConfig config = HoodieWriteConfig.newBuilder().withPath(HoodieCLI.basePath)
+        .withArchivalConfig(HoodieArchivalConfig.newBuilder().archiveCommitsWith(minCommits,maxCommits).build())
+        .withCleanConfig(HoodieCleanConfig.newBuilder().retainCommits(retained).build())
+        .withEmbeddedTimelineServerEnabled(false)
+        .withMetadataConfig(HoodieMetadataConfig.newBuilder().enable(false).build())

Review Comment:
   actually, lets take enableMetadata as an argument as well. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org