Skip to content
Permalink
Browse files

0003865: Improve logging readability and appropriate levels

  • Loading branch information...
erilong committed Jan 30, 2019
1 parent 88a7ccf commit cb8cb691c9ba43ac767344d3b95241d27d62b9ea
@@ -165,15 +165,14 @@ protected boolean checkForUniqueKeyViolation(AbstractDatabaseWriter writer, CsvD
String violatedIndexName = sqlTemplate.getUniqueKeyViolationIndexName(e);

if (violatedIndexName != null) {
log.info("Unique violation from index {} on table {} during {} with batch {}. Attempting to correct.", violatedIndexName, targetTable.getName(),
data.getDataEventType().toString(), writer.getContext().getBatch().getNodeBatchId());

// Use the violated unique index name to find the columns involved so we can run a delete statement
boolean foundUniqueIndex = false;
int count = 0;
for (IIndex index : targetTable.getIndices()) {
if (index.isUnique() && (index.getName().equals(violatedIndexName) || violatedIndexName.contentEquals("%"))) {
foundUniqueIndex = true;
log.info("Unique violation from index {} on table {} during {} with batch {}. Attempting to correct.", violatedIndexName, targetTable.getName(),
data.getDataEventType().toString(), writer.getContext().getBatch().getNodeBatchId());
count += deleteUniqueConstraintRow(platform, sqlTemplate, databaseWriter, targetTable, index, data);
}
}

0 comments on commit cb8cb69

Please sign in to comment.
You can’t perform that action at this time.