Skip to content

Commit

Permalink
0001611: Support snapshot fails when database does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed May 20, 2019
1 parent c659520 commit bd949bc
Showing 1 changed file with 12 additions and 6 deletions.
Expand Up @@ -151,13 +151,16 @@ public static File createSnapshot(ISymmetricEngine engine) {
}
}

List<String> catalogNames = engine.getDatabasePlatform().getDdlReader().getCatalogNames();
List<Trigger> triggers = triggerRouterService.getTriggers();
for (Trigger trigger : triggers) {
Table table = engine.getDatabasePlatform().getTableFromCache(trigger.getSourceCatalogName(), trigger.getSourceSchemaName(),
trigger.getSourceTableName(), false);
if (table != null) {
addTableToMap(catalogSchemas, new CatalogSchema(table.getCatalog(), table.getSchema()), table);
}
if (StringUtils.isBlank(trigger.getSourceCatalogName()) || catalogNames.contains(trigger.getSourceCatalogName())) {
Table table = engine.getDatabasePlatform().getTableFromCache(trigger.getSourceCatalogName(), trigger.getSourceSchemaName(),
trigger.getSourceTableName(), false);
if (table != null) {
addTableToMap(catalogSchemas, new CatalogSchema(table.getCatalog(), table.getSchema()), table);
}
}
}

for (CatalogSchema catalogSchema : catalogSchemas.keySet()) {
Expand All @@ -170,10 +173,13 @@ public static File createSnapshot(ISymmetricEngine engine) {
} else {
String extra = "";
if (!isDefaultCatalog && catalogSchema.getCatalog() != null) {
extra += catalogSchema.getCatalog() + "-";
extra += catalogSchema.getCatalog();
export.setCatalog(catalogSchema.getCatalog());
}
if (!isDefaultSchema && catalogSchema.getSchema() != null) {
if (!extra.equals("")) {
extra += "-";
}
extra += catalogSchema.getSchema();
export.setSchema(catalogSchema.getSchema());
}
Expand Down

0 comments on commit bd949bc

Please sign in to comment.