Skip to content

Commit

Permalink
0005106: Fixed manual conflict resolution for Postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-miller-jumpmind committed Aug 4, 2022
1 parent 094d67a commit ff8d36e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Expand Up @@ -59,6 +59,7 @@ public static enum LoadStatus {

protected boolean lastUseConflictDetection = true;
protected boolean lastApplyChangesOnly = false;
protected boolean isRequiresSavePointsInTransaction = false;
protected Table sourceTable;
protected Table targetTable;
protected Map<String, Table> targetTables = new HashMap<String, Table>();
Expand Down Expand Up @@ -160,6 +161,22 @@ public void write(CsvData data) {
default:
break;
}
if (isRequiresSavePointsInTransaction && conflictResolver != null) {
Statistics batchStatistics = getStatistics().get(getBatch());
long statementCount = batchStatistics.get(DataWriterStatisticConstants.ROWCOUNT);
ResolvedData resolvedData = getWriterSettings().getResolvedData(statementCount);
if (resolvedData != null) {
if (resolvedData.isIgnoreRow()) {
statistics.get(batch).increment(DataWriterStatisticConstants.IGNOREROWCOUNT);
} else {
Conflict conflict = new Conflict();
conflict.setDetectType(DetectConflict.USE_PK_DATA);
conflict.setResolveType(ResolveConflict.FALLBACK);
conflictResolver.attemptToResolve(resolvedData, data, this, conflict);
}
return;
}
}
LoadStatus loadStatus = LoadStatus.SUCCESS;
switch (data.getDataEventType()) {
case UPDATE:
Expand Down
Expand Up @@ -74,7 +74,6 @@ public class DefaultDatabaseWriter extends AbstractDatabaseWriter {
protected DmlStatement currentDmlStatement;
protected Object[] currentDmlValues;
protected LogSqlBuilder logSqlBuilder = new LogSqlBuilder();
protected boolean isRequiresSavePointsInTransaction;
protected Boolean isCteExpression;

public DefaultDatabaseWriter(IDatabasePlatform platform) {
Expand Down

0 comments on commit ff8d36e

Please sign in to comment.