Skip to content
Permalink
Browse files

0003818: Ability to ignore incoming error

  • Loading branch information...
jumpmind-josh committed Dec 7, 2018
1 parent 9343a2d commit dd060e9b3ed1c5d73e15dfdf8b725dc22eb0582e
@@ -67,8 +67,6 @@ public DataServiceSqlMap(IDatabasePlatform platform, Map<String, String> replace

putSql("updateTableReloadRequestLoadId", "update $(table_reload_request) set load_id = ?, table_count = ?, last_update_time = ? where target_node_id = ? and source_node_id = ? and trigger_id = ? and router_id = ? and create_time = ?");

putSql("updateTableReloadRequestCounts", "update $(table_reload_request) set batch_count = ?, row_count = ? where load_id = ?");

putSql("updateTableReloadRequestLoadedCounts", "update $(table_reload_request) set "
+ " completed = (case when batch_loaded_count + 1 >= batch_count then 1 else 0 end), "
+ " batch_loaded_count = batch_loaded_count + ?, row_loaded_count = row_loaded_count + ?, last_update_time = ? "
@@ -230,18 +230,22 @@ public void write(CsvData data) {
rollback();
throw ex;
} catch (RuntimeException ex) {
if (filterError(data, ex)) {
if (!(ex instanceof SqlException)) {
/*
* SQL exceptions should have already been logged
*/
logFailureDetails(ex, data, false);
}
throw ex;
if (conflictResolver != null && conflictResolver.isIgnoreRow(this, data)) {
statistics.get(batch).increment(DataWriterStatisticConstants.IGNOREROWCOUNT);
} else {
uncommittedCount++;
statistics.get(batch).increment(DataWriterStatisticConstants.IGNORECOUNT);
checkForEarlyCommit();
if (filterError(data, ex)) {
if (!(ex instanceof SqlException)) {
/*
* SQL exceptions should have already been logged
*/
logFailureDetails(ex, data, false);
}
throw ex;
} else {
uncommittedCount++;
statistics.get(batch).increment(DataWriterStatisticConstants.IGNORECOUNT);
checkForEarlyCommit();
}
}
}
} else {
@@ -277,4 +277,18 @@ protected void performFallbackToInsert(AbstractDatabaseWriter writer, CsvData cs
}
}


@Override
public boolean isIgnoreRow(AbstractDatabaseWriter writer, CsvData data) {
DatabaseWriterSettings writerSettings = writer.getWriterSettings();
Statistics statistics = writer.getStatistics().get(writer.getBatch());
long statementCount = statistics.get(DataWriterStatisticConstants.ROWCOUNT);
ResolvedData resolvedData = writerSettings.getResolvedData(statementCount);

if (resolvedData != null) {
return resolvedData.isIgnoreRow();
}
return false;
}

}
@@ -27,5 +27,7 @@
public interface IDatabaseWriterConflictResolver extends IExtensionPoint {

public void needsResolved(AbstractDatabaseWriter writer, CsvData data, LoadStatus loadStatus);

public boolean isIgnoreRow(AbstractDatabaseWriter writer, CsvData data);

}

0 comments on commit dd060e9

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