Skip to content

Commit fa52d76

Browse files
committed
BugFix
1 parent 2e79ff6 commit fa52d76

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

database-commons/src/main/java/io/cdap/plugin/db/sink/ETLDBOutputFormat.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ public void close(TaskAttemptContext context) throws IOException {
8989
try {
9090
if (!emptyData) {
9191
getStatement().executeBatch();
92-
getConnection().commit();
9392
}
93+
getConnection().commit();
9494
} catch (SQLException e) {
9595
try {
9696
getConnection().rollback();
@@ -127,6 +127,7 @@ public void write(K key, V value) throws IOException {
127127
// This is done to reduce memory usage in the worker, as processed records can now be GC'd.
128128
if (batchSize > 0 && numWrittenRecords % batchSize == 0) {
129129
getStatement().executeBatch();
130+
emptyData = true;
130131
}
131132
} catch (SQLException e) {
132133
throw new IOException(e);

0 commit comments

Comments
 (0)