Skip to content

Commit cbf786f

Browse files
committed
BugFix
1 parent a34798a commit cbf786f

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
@@ -97,8 +97,8 @@ public void close(TaskAttemptContext context) throws IOException {
9797
try {
9898
if (!emptyData) {
9999
getStatement().executeBatch();
100-
getConnection().commit();
101100
}
101+
getConnection().commit();
102102
} catch (SQLException e) {
103103
try {
104104
getConnection().rollback();
@@ -135,6 +135,7 @@ public void write(K key, V value) throws IOException {
135135
// This is done to reduce memory usage in the worker, as processed records can now be GC'd.
136136
if (batchSize > 0 && numWrittenRecords % batchSize == 0) {
137137
getStatement().executeBatch();
138+
emptyData = true;
138139
}
139140
} catch (SQLException e) {
140141
throw new IOException(e);

0 commit comments

Comments
 (0)