Skip to content

Commit

Permalink
[Hotfix][Connector-V2] Close the tableWrite when task is close (#6897)
Browse files Browse the repository at this point in the history
  • Loading branch information
dailai committed May 25, 2024
1 parent 264934f commit 23a744b
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.seatunnel.api.sink.SupportMultiTableSinkWriter;
import org.apache.seatunnel.api.table.type.SeaTunnelRow;
import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
import org.apache.seatunnel.common.utils.SeaTunnelException;
import org.apache.seatunnel.connectors.seatunnel.paimon.config.PaimonHadoopConfiguration;
import org.apache.seatunnel.connectors.seatunnel.paimon.exception.PaimonConnectorErrorCode;
import org.apache.seatunnel.connectors.seatunnel.paimon.exception.PaimonConnectorException;
Expand Down Expand Up @@ -182,5 +183,14 @@ public List<PaimonSinkState> snapshotState(long checkpointId) throws IOException
public void abortPrepare() {}

@Override
public void close() throws IOException {}
public void close() throws IOException {
if (Objects.nonNull(tableWrite)) {
try {
tableWrite.close();
} catch (Exception e) {
log.error("Failed to close table writer in paimon sink writer.", e);
throw new SeaTunnelException(e);
}
}
}
}

0 comments on commit 23a744b

Please sign in to comment.