Skip to content

Commit

Permalink
0002890: For long running batches, log not only the dml count, but the
Browse files Browse the repository at this point in the history
dml count by table
  • Loading branch information
chenson42 committed Nov 7, 2016
1 parent 2c7e634 commit 73dbf94
Showing 1 changed file with 6 additions and 3 deletions.
Expand Up @@ -174,6 +174,7 @@ protected LoadStatus insert(CsvData data) {
this.currentDmlStatement.getLookupKeyData(getLookupDataMap(data, conflict)));
long count = execute(data, values);
statistics.get(batch).increment(DataWriterStatisticConstants.INSERTCOUNT, count);
statistics.get(batch).increment(String.format("%s %s", targetTable.getName(), DataWriterStatisticConstants.INSERTCOUNT), count);
if (count > 0) {
return LoadStatus.SUCCESS;
} else {
Expand All @@ -194,7 +195,7 @@ protected LoadStatus insert(CsvData data) {
throw ex;
}
}
} catch (SqlException ex) {
} catch (RuntimeException ex) {
logFailureDetails(ex, data, true);
throw ex;
} finally {
Expand Down Expand Up @@ -294,13 +295,14 @@ protected LoadStatus delete(CsvData data, boolean useConflictDetection) {
lookupDataMap = lookupDataMap == null ? getLookupDataMap(data, conflict) : lookupDataMap;
long count = execute(data, this.currentDmlStatement.getLookupKeyData(lookupDataMap));
statistics.get(batch).increment(DataWriterStatisticConstants.DELETECOUNT, count);
statistics.get(batch).increment(String.format("%s %s", targetTable.getName(), DataWriterStatisticConstants.DELETECOUNT), count);
if (count > 0) {
return LoadStatus.SUCCESS;
} else {
context.put(CUR_DATA,null); // since a delete conflicted, there's no row to delete, so no cur data.
return LoadStatus.CONFLICT;
}
} catch (SqlException ex) {
} catch (RuntimeException ex) {
if (platform.getSqlTemplate().isUniqueKeyViolation(ex)
&& !platform.getDatabaseInfo().isRequiresSavePointsInTransaction()) {
context.put(CUR_DATA,null); // since a delete conflicted, there's no row to delete, so no cur data.
Expand Down Expand Up @@ -457,6 +459,7 @@ protected LoadStatus update(CsvData data, boolean applyChangesOnly, boolean useC
long count = execute(data, values);
statistics.get(batch)
.increment(DataWriterStatisticConstants.UPDATECOUNT, count);
statistics.get(batch).increment(String.format("%s %s", targetTable.getName(), DataWriterStatisticConstants.UPDATECOUNT), count);
if (count > 0) {
return LoadStatus.SUCCESS;
} else {
Expand All @@ -480,7 +483,7 @@ protected LoadStatus update(CsvData data, boolean applyChangesOnly, boolean useC
// There was no change to apply
return LoadStatus.SUCCESS;
}
} catch (SqlException ex) {
} catch (RuntimeException ex) {
logFailureDetails(ex, data, true);
throw ex;
} finally {
Expand Down

0 comments on commit 73dbf94

Please sign in to comment.