in holo-shipper/src/main/java/com/alibaba/hologres/shipper/HoloShipper.java [64:157]
public void getUserRequirements(String[] args) throws ParseException{
//get user requirements about source, sink, tables to ship, restore owner,schema,guc... or not
restoreOwner = true;
restoreAllRoles = true;
restoreGUC = true;
restoreExt = true;
restorePriv = true;
restoreData = true;
restoreForeign = true;
restoreView = true;
allowSinkTableExists = false;
disableShardCopy = false;
Options options = new Options();
options.addOption(Option.builder("s").hasArgs().required().build());
options.addOption(Option.builder("d").hasArgs().required().build());
options.addOption(Option.builder("l").hasArg().required().build());
options.addOption(Option.builder().longOpt("max-task-num").hasArg().optionalArg(true).build());
options.addOption(Option.builder().longOpt("no-owner").build());
options.addOption(Option.builder().longOpt("no-all-roles").build());
options.addOption(Option.builder().longOpt("no-guc").build());
options.addOption(Option.builder().longOpt("no-ext").build());
options.addOption(Option.builder().longOpt("no-priv").build());
options.addOption(Option.builder().longOpt("no-data").build());
options.addOption(Option.builder().longOpt("no-foreign").build());
options.addOption(Option.builder().longOpt("no-view").build());
options.addOption(Option.builder().longOpt("allow-table-exists").build());
options.addOption(Option.builder().longOpt("disable-shard-copy").build());
CommandLineParser parser = new DefaultParser();
CommandLine commandLine = parser.parse(options, args);
String[] srcInfo = commandLine.getOptionValues("s");
LOGGER.info("Source info:");
this.setSource(parseInstannce(srcInfo));
String[] dstInfo = commandLine.getOptionValues("d");
LOGGER.info("Destination info:");
this.setSink(parseInstannce(dstInfo));
this.shipListPath = commandLine.getOptionValue("l");
if (commandLine.getOptionValue("max-task-num") != null) {
Integer threadNum = Integer.parseInt(commandLine.getOptionValue("max-task-num"));
LOGGER.info("user config max-task-num: " + threadNum);
this.MAX_NUM_THREAD_TABLE = Math.min(this.MAX_NUM_THREAD_TABLE, threadNum);
this.MAX_NUM_THREAD_SHARD = Math.min(this.MAX_NUM_THREAD_SHARD, threadNum);
}
if (commandLine.hasOption("disable-shard-copy")) {
this.disableShardCopy = true;
LOGGER.info("Disable shard copy");
}
if (commandLine.hasOption("no-owner"))
{
LOGGER.info("Do not ship owner");
this.restoreOwner = false;
}
if (commandLine.hasOption("no-all-roles"))
{
LOGGER.info("Do not ship all roles");
this.restoreAllRoles = false;
}
if (commandLine.hasOption("no-guc"))
{
LOGGER.info("Do not ship guc parameters");
this.restoreGUC = false;
}
if (commandLine.hasOption("no-ext"))
{
LOGGER.info("Do not ship extensions");
this.restoreExt = false;
}
if (commandLine.hasOption("no-priv"))
{
LOGGER.info("Do not ship privileges");
this.restorePriv = false;
}
if (commandLine.hasOption("no-data"))
{
LOGGER.info("Do not ship data");
this.restoreData = false;
}
if (commandLine.hasOption("no-foreign"))
{
LOGGER.info("Do not ship foreign tables");
this.restoreForeign = false;
}
if (commandLine.hasOption("no-view"))
{
LOGGER.info("Do not ship view");
this.restoreView = false;
}
if (commandLine.hasOption("allow-table-exists"))
{
LOGGER.info("Allow table exists");
this.allowSinkTableExists = true;
}
}