kezhuw commented on a change in pull request #7300: [FLINK-11151][rest] Create
parent directories in FileUploadHandler
URL: https://github.com/apache/flink/pull/7300#discussion_r241967901
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/rest/FileUploadHandler.java
##########
@@ -102,6 +102,10 @@ protected void channelRead0(final ChannelHandlerContext
ctx, final HttpObject ms
checkState(currentUploadDir ==
null);
currentHttpPostRequestDecoder =
new HttpPostRequestDecoder(DATA_FACTORY, httpRequest);
currentHttpRequest =
ReferenceCountUtil.retain(httpRequest);
+
+ // make sure that we still have
a upload dir in case that it got deleted in the meanwhile
+
RestServerEndpoint.createUploadDir(uploadDir, LOG);
Review comment:
Branch `msg instanceof HttpContent && currentHttpPostRequestDecoder != null`
has this statement too. Seems that line is useless and can be deleted safely
since following receiving work happens in `currentUploadDir` not its parent
`uploadDir`. If `uploadDir` got deleted meanwhile, the upload request should
fail due to potential lost of uploaded files, this is what will happen in
`fileUpload.renameTo(dest.toFile())`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services