RussellSpitzer commented on code in PR #5311:
URL: https://github.com/apache/iceberg/pull/5311#discussion_r930351044
##########
core/src/main/java/org/apache/iceberg/io/DataWriter.java:
##########
@@ -78,7 +80,14 @@ public long length() {
@Override
public void close() throws IOException {
- if (dataFile == null) {
+ /* As close is called couple times from BaseTaskWriter
+ on rollToNewFile and close, we don't want to create a data file
+ if appender.close was already called and failed due to an internal close
failure.
+ Subsequent call to close after failure should not create a data file and
keep it null.
+ We have observed appender.close failed when S3OutputStream.close fails
and subsequent call
+ from flink tries to close the writer and use the data file which was
never uploaded.
+ */
+ if (closed.compareAndSet(false, true)) {
Review Comment:
Do we need a new variable here or can we make dataFile into an Atomic
reference?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]