Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDDS-11775. Add tool to create RocksDB checkpoint #7664

Merged
merged 10 commits into from
Jan 19, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
*/
package org.apache.hadoop.ozone.debug.ldb;

Tejaskriya marked this conversation as resolved.
Show resolved Hide resolved
import org.apache.hadoop.hdds.cli.AbstractSubcommand;
import org.apache.hadoop.hdds.utils.db.managed.ManagedCheckpoint;
import org.apache.hadoop.hdds.utils.db.managed.ManagedRocksDB;
import org.apache.hadoop.ozone.debug.RocksDBUtils;
import org.rocksdb.ColumnFamilyDescriptor;
import org.rocksdb.ColumnFamilyHandle;
import picocli.CommandLine;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
Expand All @@ -36,7 +36,7 @@
name = "checkpoint",
description = "Create checkpoint for specified db"
)
public class Checkpoint implements Callable<Void> {
public class Checkpoint extends AbstractSubcommand implements Callable<Void> {
@CommandLine.Option(names = {"--output"},
required = true,
description = "Path to output directory for the checkpoint.")
Expand All @@ -45,9 +45,6 @@ public class Checkpoint implements Callable<Void> {
@CommandLine.ParentCommand
private RDBParser parent;

@CommandLine.Spec
private static CommandLine.Model.CommandSpec spec;

@Override
public Void call() throws Exception {
List<ColumnFamilyDescriptor> cfDescList =
Expand All @@ -59,13 +56,8 @@ public Void call() throws Exception {
parent.getDbPath(), cfDescList, cfHandleList)) {
ManagedCheckpoint cp = ManagedCheckpoint.create(db);
cp.get().createCheckpoint(outputPath);
out().println("Created checkpoint at " + outputPath);
spec().commandLine().getOut().println("Created checkpoint at " + outputPath);
Tejaskriya marked this conversation as resolved.
Show resolved Hide resolved
}
return null;
}

private static PrintWriter out() {
return spec.commandLine().getOut();
}

}
Loading