Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Added getNULL check on type check and convertNumberToText as a optional command line parameter #6

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
target
.idea
.classpath
.factorypath
.project
dependency-reduced-pom.xml
.settings/org.eclipse.jdt.apt.core.prefs
.settings/org.eclipse.jdt.apt.core.prefs
.settings/org.eclipse.jdt.core.prefs
.settings/org.eclipse.m2e.core.prefs
12 changes: 11 additions & 1 deletion src/main/java/com/citusdata/migration/DynamoDBReplicator.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ public static void main(String[] args) throws SQLException, IOException {
maxScanRateOption.setRequired(false);
options.addOption(maxScanRateOption);

Option convertNumberToText = new Option("ntx", "convert-numbers-to-text", false, "Convert Number Types to text");
convertNumberToText.setRequired(false);
options.addOption(convertNumberToText);

CommandLineParser parser = new DefaultParser();
HelpFormatter formatter = new HelpFormatter();
formatter.setWidth(120);
Expand All @@ -108,6 +112,7 @@ public static void main(String[] args) throws SQLException, IOException {

boolean useCitus = cmd.hasOption("citus");
boolean useLowerCaseColumnNames = cmd.hasOption("lower-case-column-names");
boolean convertNumbersToText = cmd.hasOption("convert-numbers-to-text");
int maxScanRate = Integer.parseInt(cmd.getOptionValue("scan-rate", "25"));
int dbConnectionCount = Integer.parseInt(cmd.getOptionValue("num-connections", "16"));
String tableNamesString = cmd.getOptionValue("table");
Expand Down Expand Up @@ -177,8 +182,8 @@ public void run() {
replicator.setAddColumnEnabled(true);
replicator.setUseCitus(useCitus);
replicator.setUseLowerCaseColumnNames(useLowerCaseColumnNames);
replicator.setConvertNumberTypesToText(convertNumbersToText);
replicator.setConversionMode(conversionMode);

replicators.add(replicator);
}

Expand Down Expand Up @@ -214,13 +219,16 @@ public void run() {
}

} catch (ParseException e) {
e.printStackTrace();
LOG.error(e.getMessage());
formatter.printHelp("podyn", options);
System.exit(3);
} catch (TableExistsException|NonExistingTableException e) {
e.printStackTrace();
LOG.error(e.getMessage());
System.exit(1);
} catch (ExecutionException e) {
e.printStackTrace();
Throwable cause = e.getCause();

if (cause.getCause() != null) {
Expand All @@ -230,6 +238,7 @@ public void run() {
}
System.exit(1);
} catch (EmissionException e) {
e.printStackTrace();
if (e.getCause() != null) {
LOG.error(e.getCause().getMessage());
} else {
Expand All @@ -240,6 +249,7 @@ public void run() {
e.printStackTrace();
System.exit(2);
} catch (Exception e) {
e.printStackTrace();
LOG.error(e);
System.exit(1);
}
Expand Down
Loading