Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@
/**
* Performs bootstrap from a non-hudi source.
*/
public class BootstrapExecutor implements Serializable {
public class BootstrapExecutor implements Serializable {

private static final Logger LOG = LogManager.getLogger(BootstrapExecutor.class);

/**
* Config.
* Config.
*/
private final HoodieDeltaStreamer.Config cfg;

Expand Down Expand Up @@ -97,9 +97,10 @@ public class BootstrapExecutor implements Serializable {

/**
* Bootstrap Executor.
* @param cfg DeltaStreamer Config
* @param jssc Java Spark Context
* @param fs File System
*
* @param cfg DeltaStreamer Config
* @param jssc Java Spark Context
* @param fs File System
* @param properties Bootstrap Writer Properties
* @throws IOException
*/
Expand Down Expand Up @@ -168,9 +169,15 @@ private void syncHive() {
}

private void initializeTable() throws IOException {
if (fs.exists(new Path(cfg.targetBasePath))) {
throw new HoodieException("target base path already exists at " + cfg.targetBasePath
+ ". Cannot bootstrap data on top of an existing table");
Path basePath = new Path(cfg.targetBasePath);
if (fs.exists(basePath)) {
if (cfg.bootstrapOverwrite) {
LOG.warn("Target base path already exists, overwrite it");
fs.delete(basePath, true);
} else {
throw new HoodieException("target base path already exists at " + cfg.targetBasePath
+ ". Cannot bootstrap data on top of an existing table");
}
}
HoodieTableMetaClient.withPropertyBuilder()
.setTableType(cfg.tableType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ public static class Config implements Serializable {
@Parameter(names = {"--run-bootstrap"}, description = "Run bootstrap if bootstrap index is not found")
public Boolean runBootstrap = false;

@Parameter(names = {"--bootstrap-overwrite"}, description = "Overwrite existing target table, default false")
public Boolean bootstrapOverwrite = false;

@Parameter(names = {"--bootstrap-index-class"}, description = "subclass of BootstrapIndex")
public String bootstrapIndexClass = HFileBootstrapIndex.class.getName();

Expand Down