Skip to content

Commit

Permalink
0004743: losing parent when both pk and uk lose
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Jan 8, 2021
1 parent 25a688e commit f169b97
Showing 1 changed file with 7 additions and 7 deletions.
Expand Up @@ -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<String> conflictLosingParentRows = writer.getWriterSettings().getConflictLosingParentRows();
if (conflictLosingParentRows != null) {
Map<String, String> 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 {}",
Expand Down Expand Up @@ -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<String> 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(),
Expand Down

0 comments on commit f169b97

Please sign in to comment.