You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/08/30 10:06:44 UTC

[GitHub] [flink] yuchuanchen commented on a diff in pull request #16927: [FLINK-18592][Connectors/FileSystem] StreamingFileSink fails due to truncating HDFS file failure

yuchuanchen commented on code in PR #16927:
URL: https://github.com/apache/flink/pull/16927#discussion_r958281789


##########
flink-filesystems/flink-hadoop-fs/src/main/java/org/apache/flink/runtime/fs/hdfs/HadoopRecoverableFsDataOutputStream.java:
##########
@@ -171,10 +189,20 @@ private static void safelyTruncateFile(
         }
 
         if (!truncated) {
-            // Truncate did not complete immediately, we must wait for
-            // the operation to complete and release the lease.
-            revokeLeaseByFileSystem(fileSystem, path);
+            // Truncate does not complete immediately if block recovery is needed,
+            // thus wait for block recovery
+            LOG.debug("Waiting for block recovery for file {}.", path);
+            boolean recovered = waitForBlockRecovery(fileSystem, path);
+            if (!recovered) {
+                throw new IOException(
+                        String.format(
+                                "Failed to recover blocks for file %s in %d ms.",
+                                path.toString(), BLOCK_RECOVERY_TIMEOUT_MS));
+            }

Review Comment:
   Should the revokeLeaseByFileSystem() called after blockrecovery?



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org