[HUDI-1019] Clean refresh command in CLI (#1725)
This commit is contained in:
@@ -84,12 +84,6 @@ public class CleansCommand implements CommandMarker {
|
||||
return HoodiePrintHelper.print(header, new HashMap<>(), sortByField, descending, limit, headerOnly, rows);
|
||||
}
|
||||
|
||||
@CliCommand(value = "cleans refresh", help = "Refresh the commits")
|
||||
public String refreshCleans() {
|
||||
HoodieCLI.refreshTableMetadata();
|
||||
return "Metadata for table " + HoodieCLI.getTableMetaClient().getTableConfig().getTableName() + " refreshed.";
|
||||
}
|
||||
|
||||
@CliCommand(value = "clean showpartitions", help = "Show partition level details of a clean")
|
||||
public String showCleanPartitions(@CliOption(key = {"clean"}, help = "clean to show") final String instantTime,
|
||||
@CliOption(key = {"limit"}, help = "Limit commits", unspecifiedDefaultValue = "-1") final Integer limit,
|
||||
|
||||
@@ -214,12 +214,6 @@ public class CommitsCommand implements CommandMarker {
|
||||
}
|
||||
}
|
||||
|
||||
@CliCommand(value = "commits refresh", help = "Refresh the commits")
|
||||
public String refreshCommits() throws IOException {
|
||||
HoodieCLI.refreshTableMetadata();
|
||||
return "Metadata for table " + HoodieCLI.getTableMetaClient().getTableConfig().getTableName() + " refreshed.";
|
||||
}
|
||||
|
||||
@CliCommand(value = "commit rollback", help = "Rollback a commit")
|
||||
public String rollbackCommit(@CliOption(key = {"commit"}, help = "Commit to rollback") final String instantTime,
|
||||
@CliOption(key = {"sparkProperties"}, help = "Spark Properties File Path") final String sparkPropertiesPath)
|
||||
@@ -238,7 +232,7 @@ public class CommitsCommand implements CommandMarker {
|
||||
InputStreamConsumer.captureOutput(process);
|
||||
int exitCode = process.waitFor();
|
||||
// Refresh the current
|
||||
refreshCommits();
|
||||
HoodieCLI.refreshTableMetadata();
|
||||
if (exitCode != 0) {
|
||||
return "Commit " + instantTime + " failed to roll back";
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public class SavepointsCommand implements CommandMarker {
|
||||
InputStreamConsumer.captureOutput(process);
|
||||
int exitCode = process.waitFor();
|
||||
// Refresh the current
|
||||
refreshMetaClient();
|
||||
HoodieCLI.refreshTableMetadata();
|
||||
if (exitCode != 0) {
|
||||
return String.format("Failed: Could not create savepoint \"%s\".", commitTime);
|
||||
}
|
||||
@@ -123,19 +123,13 @@ public class SavepointsCommand implements CommandMarker {
|
||||
InputStreamConsumer.captureOutput(process);
|
||||
int exitCode = process.waitFor();
|
||||
// Refresh the current
|
||||
refreshMetaClient();
|
||||
HoodieCLI.refreshTableMetadata();
|
||||
if (exitCode != 0) {
|
||||
return String.format("Savepoint \"%s\" failed to roll back", instantTime);
|
||||
}
|
||||
return String.format("Savepoint \"%s\" rolled back", instantTime);
|
||||
}
|
||||
|
||||
@CliCommand(value = "savepoints refresh", help = "Refresh the savepoints")
|
||||
public String refreshMetaClient() {
|
||||
HoodieCLI.refreshTableMetadata();
|
||||
return "Metadata for table " + HoodieCLI.getTableMetaClient().getTableConfig().getTableName() + " refreshed.";
|
||||
}
|
||||
|
||||
@CliCommand(value = "savepoint delete", help = "Delete the savepoint")
|
||||
public String deleteSavepoint(@CliOption(key = {"commit"}, help = "Delete a savepoint") final String instantTime,
|
||||
@CliOption(key = {"sparkProperties"}, help = "Spark Properties File Path") final String sparkPropertiesPath,
|
||||
@@ -161,7 +155,7 @@ public class SavepointsCommand implements CommandMarker {
|
||||
InputStreamConsumer.captureOutput(process);
|
||||
int exitCode = process.waitFor();
|
||||
// Refresh the current
|
||||
refreshMetaClient();
|
||||
HoodieCLI.refreshTableMetadata();
|
||||
if (exitCode != 0) {
|
||||
return String.format("Failed: Could not delete savepoint \"%s\".", instantTime);
|
||||
}
|
||||
|
||||
@@ -131,4 +131,14 @@ public class TableCommand implements CommandMarker {
|
||||
});
|
||||
return HoodiePrintHelper.print(header, new HashMap<>(), "", false, -1, false, rows);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh table metadata.
|
||||
*/
|
||||
@CliCommand(value = {"refresh", "metadata refresh", "commits refresh", "cleans refresh", "savepoints refresh"},
|
||||
help = "Refresh table metadata")
|
||||
public String refreshMetadata() {
|
||||
HoodieCLI.refreshTableMetadata();
|
||||
return "Metadata for table " + HoodieCLI.getTableMetaClient().getTableConfig().getTableName() + " refreshed.";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user