Skip to content

Commit

Permalink
0000945: batchCommit was being called for earlyCommit and for normal …
Browse files Browse the repository at this point in the history
…commit. The api is suppose to only be call for a normal commit
  • Loading branch information
chenson42 committed Dec 10, 2012
1 parent 392af25 commit 0e2bb02
Showing 1 changed file with 8 additions and 5 deletions.
Expand Up @@ -220,8 +220,7 @@ public void write(CsvData data) {

protected void checkForEarlyCommit() {
if (uncommittedCount >= writerSettings.getMaxRowsBeforeCommit()) {
notifyFiltersEarlyCommit();
commit();
commit(true);
/*
* Chances are if SymmetricDS is configured to commit early in a
* batch we want to give other threads a chance to do work and
Expand All @@ -236,12 +235,16 @@ protected void checkForEarlyCommit() {
}
}

protected void commit() {
protected void commit(boolean earlyCommit) {
if (transaction != null) {
try {
statistics.get(batch).startTimer(DataWriterStatisticConstants.DATABASEMILLIS);
this.transaction.commit();
notifyFiltersBatchCommitted();
if (!earlyCommit) {
notifyFiltersBatchCommitted();
} else {
notifyFiltersEarlyCommit();
}
} finally {
statistics.get(batch).stopTimer(DataWriterStatisticConstants.DATABASEMILLIS);
}
Expand Down Expand Up @@ -999,7 +1002,7 @@ public void end(Batch batch, boolean inError) {
}
if (!inError) {
notifyFiltersBatchComplete();
commit();
commit(false);
} else {
rollback();
}
Expand Down

0 comments on commit 0e2bb02

Please sign in to comment.