Skip to content

Commit

Permalink
0005194: DBCompare support for load only target nodes and log based
Browse files Browse the repository at this point in the history
source nodes.
  • Loading branch information
joshahicks committed Jan 14, 2022
1 parent 402d8d6 commit d3c9ada
Showing 1 changed file with 8 additions and 8 deletions.
Expand Up @@ -136,7 +136,7 @@ protected OutputStream getSqlDiffOutputStream(DbCompareTables tables) {
}

protected TableReport compareTables(DbCompareTables tables, OutputStream sqlDiffOutput) {
String sourceSelect = getSourceComparisonSQL(tables, sourceEngine.getDatabasePlatform());
String sourceSelect = getSourceComparisonSQL(tables, sourceEngine.getTargetDialect().getTargetPlatform());
String targetSelect = getTargetComparisonSQL(tables, targetEngine.getTargetDialect().getTargetPlatform());
//String targetSelect = getTargetComparisonSQL(tables, targetEngine.getDatabasePlatform());

Expand Down Expand Up @@ -347,14 +347,14 @@ protected List<DbCompareTables> loadTables(List<String> tableNames, List<String>
for (int i = 0; i < filteredTablesNames.size(); i++) {
String tableName = filteredTablesNames.get(i);
Table sourceTable = null;
Map<String, String> tableNameParts = sourceEngine.getDatabasePlatform().parseQualifiedTableName(tableName);
Map<String, String> tableNameParts = sourceEngine.getTargetDialect().getTargetPlatform().parseQualifiedTableName(tableName);
if (tableNameParts.size() == 1) {
sourceTable = sourceEngine.getDatabasePlatform().getTableFromCache(tableName, true);
sourceTable = sourceEngine.getTargetDialect().getTargetPlatform().getTableFromCache(tableName, true);
} else {
sourceTable = sourceEngine.getDatabasePlatform().getTableFromCache(tableNameParts.get("catalog"), tableNameParts.get("schema"), tableNameParts
sourceTable = sourceEngine.getTargetDialect().getTargetPlatform().getTableFromCache(tableNameParts.get("catalog"), tableNameParts.get("schema"), tableNameParts
.get("table"), true);
if (sourceTable == null) {
sourceTable = sourceEngine.getDatabasePlatform().getTableFromCache(tableNameParts.get("schema"), tableNameParts.get("catalog"),
sourceTable = sourceEngine.getTargetDialect().getTargetPlatform().getTableFromCache(tableNameParts.get("schema"), tableNameParts.get("catalog"),
tableNameParts.get("table"), true);
}
}
Expand All @@ -365,10 +365,10 @@ protected List<DbCompareTables> loadTables(List<String> tableNames, List<String>
if (config.isUseSymmetricConfig()) {
String catalog = null;
String schema = null;
if (!StringUtils.equals(sourceEngine.getDatabasePlatform().getDefaultCatalog(), sourceTable.getCatalog())) {
if (!StringUtils.equals(sourceEngine.getTargetDialect().getTargetPlatform().getDefaultCatalog(), sourceTable.getCatalog())) {
catalog = sourceTable.getCatalog();
}
if (!StringUtils.equals(sourceEngine.getDatabasePlatform().getDefaultSchema(), sourceTable.getSchema())) {
if (!StringUtils.equals(sourceEngine.getTargetDialect().getTargetPlatform().getDefaultSchema(), sourceTable.getSchema())) {
schema = sourceTable.getSchema();
}
TriggerHistory hist = sourceEngine.getTriggerRouterService().findTriggerHistory(catalog, schema,
Expand Down Expand Up @@ -551,7 +551,7 @@ protected boolean compareTableNames(String sourceTableName, String targetTableNa
if (StringUtils.equalsIgnoreCase(sourceTableName, targetTableName)) {
return true;
} else {
Map<String, String> sourceTableNameParts = sourceEngine.getDatabasePlatform().parseQualifiedTableName(sourceTableName);
Map<String, String> sourceTableNameParts = sourceEngine.getTargetDialect().getTargetPlatform().parseQualifiedTableName(sourceTableName);
Map<String, String> targetTableNameParts = targetEngine.getTargetDialect().getTargetPlatform().parseQualifiedTableName(targetTableName);
return StringUtils.equalsIgnoreCase(sourceTableNameParts.get("table"), targetTableNameParts.get("table"));
}
Expand Down

0 comments on commit d3c9ada

Please sign in to comment.