apache / paimon

Apache Paimon is a lake format that enables building a Realtime Lakehouse Architecture with Flink and Spark for both streaming and batch operations.
https://paimon.apache.org/
Apache License 2.0
2.43k stars 954 forks source link

[core] RollingFileWriter#abort shouldn't abort currentWriter twice #4546

Closed yuzelin closed 2 days ago

yuzelin commented 2 days ago

Purpose

For example, currentWriter#write occurs exception E1, it will abort, then the RollingFileWriter#abort will abort currentWriter again. Some OutputStream cannot be closed twice, so it will throw an new exception E2 which covers E1.

Tests

API and Format

Documentation

wwj6591812 commented 2 days ago

I think the second call to RollingFileWriter#abort is in RollingFileWriter#write's catch statement. But where was the first call to RollingFileWriter#abort?

yuzelin commented 2 days ago

I think the second call to RollingFileWriter#abort is in RollingFileWriter#write's catch statement. But where was the first call to RollingFileWriter#abort?

I mean RollingFileWriter will call currentWriter#abort when #write has exception, then it will call currentWriter#abort again.

wwj6591812 commented 2 days ago

I think the second call to RollingFileWriter#abort is in RollingFileWriter#write's catch statement. But where was the first call to RollingFileWriter#abort?

I mean RollingFileWriter will call currentWriter#abort when #write has exception, then it will call currentWriter#abort again.

OK, Thinks. The first time is in RollingFileWriter#write -> SingleFileWriter#write -> SingleFileWriter#writeImpl -> SingleFileWriter#abort. The second time is in RollingFileWriter#write -> RollingFileWriter#abort -> SingleFileWriter#abort.

yuzelin commented 2 days ago

Fixed in #4547