Skip to content

Commit b88107a

Browse files
authored
fix: close batcher for writeToMultipleTables (#4182)
* fix: close batcher for writeToMultipleTables * fix write * move mutates.clear() to finally
1 parent b82bea1 commit b88107a

File tree

1 file changed

+10
-7
lines changed
  • bigtable-dataflow-parent/bigtable-hbase-beam/src/main/java/com/google/cloud/bigtable/beam

1 file changed

+10
-7
lines changed

bigtable-dataflow-parent/bigtable-hbase-beam/src/main/java/com/google/cloud/bigtable/beam/CloudBigtableIO.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,15 +1003,18 @@ private BufferedMutator getMutator(Object context, String tableName) throws IOEx
10031003

10041004
@FinishBundle
10051005
public void finishBundle(FinishBundleContext c) throws Exception {
1006-
for (BufferedMutator bufferedMutator : mutators.values()) {
1007-
try {
1008-
bufferedMutator.flush();
1009-
} catch (RetriesExhaustedWithDetailsException exception) {
1010-
logExceptions(c, exception);
1011-
rethrowException(exception);
1006+
try {
1007+
for (BufferedMutator bufferedMutator : mutators.values()) {
1008+
try {
1009+
bufferedMutator.close();
1010+
} catch (RetriesExhaustedWithDetailsException exception) {
1011+
logExceptions(c, exception);
1012+
rethrowException(exception);
1013+
}
10121014
}
1015+
} finally {
1016+
mutators.clear();
10131017
}
1014-
mutators.clear();
10151018
}
10161019
}
10171020

0 commit comments

Comments
 (0)