From f169b970c56cfb72e6107108289c073b553d1ef1 Mon Sep 17 00:00:00 2001 From: Eric Long Date: Fri, 8 Jan 2021 08:24:25 -0500 Subject: [PATCH] 0004743: losing parent when both pk and uk lose --- .../DefaultDatabaseWriterConflictResolver.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/symmetric-io/src/main/java/org/jumpmind/symmetric/io/data/writer/DefaultDatabaseWriterConflictResolver.java b/symmetric-io/src/main/java/org/jumpmind/symmetric/io/data/writer/DefaultDatabaseWriterConflictResolver.java index af03e44f05..2623b8017b 100644 --- a/symmetric-io/src/main/java/org/jumpmind/symmetric/io/data/writer/DefaultDatabaseWriterConflictResolver.java +++ b/symmetric-io/src/main/java/org/jumpmind/symmetric/io/data/writer/DefaultDatabaseWriterConflictResolver.java @@ -196,6 +196,13 @@ protected boolean isCaptureTimeNewer(Conflict conflict, AbstractDatabaseWriter w if (!isLoadOnlyNode) { writer.getContext().put(DatabaseConstants.IS_CONFLICT_WINNER, isWinner); } + if (!isWinner && !isWinnerByUk) { + Set conflictLosingParentRows = writer.getWriterSettings().getConflictLosingParentRows(); + if (conflictLosingParentRows != null) { + Map rowDataMap = data.toColumnNameValuePairs(targetTable.getColumnNames(), CsvData.ROW_DATA); + conflictLosingParentRows.add(getConflictRowKey(targetTable, rowDataMap)); + } + } if (log.isDebugEnabled()) { log.debug("{} row from batch {} with local time of {} and remote time of {} for table {} and pk of {}", @@ -290,13 +297,6 @@ protected boolean isCaptureTimeNewerForUk(AbstractDatabaseWriter writer, CsvData isWinner = existingTs == null || (loadingTs != null && (loadingTs.getTime() > existingTs.getTime() || (loadingTs.getTime() == existingTs.getTime() && writer.getContext().getBatch().getSourceNodeId().hashCode() > existingNodeId.hashCode()))); - if (!isWinner) { - Set conflictLosingParentRows = writer.getWriterSettings().getConflictLosingParentRows(); - if (conflictLosingParentRows != null) { - conflictLosingParentRows.add(getConflictRowKey(targetTable, rowDataMap)); - } - } - if (log.isDebugEnabled()) { log.debug("{} row from batch {} with local time of {} and remote time of {} for table {} and uk of {}", isWinner ? "Winning" : "Losing", writer.getContext().getBatch().getNodeBatchId(),